Method and device for center positioning of fiber image unit, electronic equipment

By calculating the subpixel-level coordinates of the fiber center in the fiber image, the problem of inaccurate fiber center positioning was solved, and higher-precision image correction was achieved.

CN116584875BActive Publication Date: 2026-06-16WUXI HISKY MEDICAL TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WUXI HISKY MEDICAL TECH
Filing Date
2023-04-03
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

In existing technologies, fiber optic center positioning can only reach the pixel level, resulting in inaccurate positioning and poor image correction.

Method used

By acquiring images from optical fibers, and utilizing the grayscale information of the target pixel with the largest pixel value and multiple pixels within a preset range around it, the sub-pixel level coordinates of the optical fiber center are calculated using the grayscale centroid method.

🎯Benefits of technology

Subpixel-level positioning of the fiber optic center was achieved, improving positioning accuracy. Image correction was performed using subpixel-level fiber optic center coordinates, enhancing the image correction effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116584875B_ABST
    Figure CN116584875B_ABST
Patent Text Reader

Abstract

The application discloses a center positioning method and device of an optical fiber image unit and electronic equipment. The method comprises the following steps: acquiring an image to be positioned collected by an optical fiber, wherein the optical fiber comprises a plurality of optical fiber bundles, and the image to be positioned comprises image units corresponding to the plurality of optical fiber bundles respectively; determining a plurality of pixel points in a preset range around a target pixel point with the maximum pixel value in the image unit according to the target pixel point and the preset range; and determining the optical fiber center coordinates of the image unit according to the plurality of pixel points in the preset range and the gray information of the pixel points, wherein the accuracy of the optical fiber center coordinates is sub-pixel level. The method solves the problem that the optical fiber center can only be positioned to the pixel level in the related art, and there is a deviation between the actual optical fiber center and the positioned optical fiber center, thereby causing inaccurate positioning of the optical fiber center and poor image correction effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of fiber optic imaging, and more specifically, to a method, apparatus, and electronic device for centering a fiber optic image unit. Background Technology

[0002] Microscopic endoscopes are widely used in medical observation and testing. Fiber optics and galvanometers are crucial components of microscopic endoscopes. A single optical fiber typically consists of tens of thousands of fiber bundles, and normally, the center position of each fiber bundle is fixed. However, in practical use, due to limitations in galvanometer scanning accuracy and the bending changes of the fiber during use, it is impossible to guarantee that each scan will be performed at the exact same position, even with a fixed end face. Therefore, over time, the galvanometer scanning position and the fiber position will change, and correspondingly, the center position of each fiber bundle within a single optical fiber will also change. This phenomenon is called fiber drift.

[0003] Ideally, the centers of each fiber bundle within the same optical fiber, at any given moment during the same usage process, should perfectly coincide with the centers of the fiber bundles in a previously acquired frame. However, due to fiber drift, there are pixel differences in the center positions between two moments. During image reconstruction, determining the centers of each fiber bundle is crucial for fast mesh removal. Fiber drift can lead to the extraction of incorrect fiber information during image processing, significantly impacting image quality. Furthermore, deviations in the grayscale values ​​between the centers of different fiber bundles also significantly affect image quality.

[0004] Existing technologies include a method for centering fiber optic image units. This method uses the previously acquired center marker of the fiber bundle as the origin, sets a search neighborhood within the fiber bundle's dimensions, and identifies the location of the maximum grayscale value within this neighborhood as the target location. When the distance difference between the target location and the center marker reaches a certain threshold, the location with the maximum grayscale value in the current image—the target location—is taken as the corrected center location of the fiber bundle. However, this method is overly simplistic in using the maximum grayscale value as the fiber center. Furthermore, its positioning accuracy is pixel-level, meaning it can only pinpoint a single pixel. The area of ​​a pixel still deviates significantly from the actual fiber center. In subsequent image reconstruction and correction processes, pixel-level coordinates often fail to meet high accuracy requirements, leading to inaccurate fiber center positioning and poor image correction results.

[0005] There is currently no effective solution to the problem that the fiber optic center can only be located at the pixel level in related technologies, which deviates from the actual fiber optic center and leads to inaccurate fiber optic center positioning and poor image correction effect. Summary of the Invention

[0006] The main objective of this application is to provide a method, apparatus, and electronic device for center positioning of an optical fiber image unit, in order to solve the problem in related technologies that the optical fiber center can only be positioned at the pixel level, which deviates from the actual optical fiber center, resulting in inaccurate optical fiber center positioning and poor image correction effect.

[0007] To achieve the above objectives, according to one aspect of this application, a method for centering an optical fiber image unit is provided. The method includes: acquiring an image to be positioned by an optical fiber, wherein the optical fiber includes multiple fiber bundles, and the image to be positioned includes image units corresponding to each of the multiple fiber bundles; determining multiple pixels within a preset range around the target pixel based on a target pixel with the largest pixel value in the image unit and a preset range; and determining the optical fiber center coordinates of the image unit based on the multiple pixels within the preset range and the grayscale information of the pixels, wherein the accuracy of the optical fiber center coordinates is at the sub-pixel level.

[0008] Optionally, determining the fiber optic center coordinates of the image unit based on multiple pixels within the preset range and their grayscale information includes: traversing the preset range to obtain the pixel coordinates and corresponding pixel values ​​of multiple pixels within the preset range, wherein the grayscale information includes the pixel coordinates and pixel values; wherein the pixel coordinates of each pixel include an abscissa and a ordinate; calculating the abscissa of the fiber optic center based on the abscissas of the multiple pixels and their pixel values; and calculating the ordinate of the fiber optic center based on the ordinates of the multiple pixels and their pixel values.

[0009] Optionally, calculating the abscissa of the fiber center based on the abscissas of multiple pixels and the pixel values ​​includes: calculating the abscissa using the following formula: In the formula, x0 is the x-coordinate, x i f(x) is the x-coordinate of the pixel. i ,y j Let be the pixel value of the pixel in the i-th column and j-th row within the preset range, h1 and h2 be the minimum and maximum values ​​of the preset range in the vertical direction, and w1 and w2 be the minimum and maximum values ​​of the preset range in the horizontal direction, where the value of x0 is accurate to the decimal point. i It is an integer.

[0010] Optionally, calculating the ordinate of the fiber center based on the ordinates of multiple pixels and the pixel values ​​includes: calculating the ordinate using the following formula: In the formula, y0 is the ordinate, y j Let f(x) be the ordinate of the pixel. i ,y j Let y0 be the pixel value of the pixel in the i-th column and j-th row within the preset range, h1 and h2 be the minimum and maximum values ​​of the preset range in the vertical direction, and w1 and w2 be the minimum and maximum values ​​of the preset range in the horizontal direction, where the value of y0 is accurate to the decimal point. j It is an integer.

[0011] Optionally, before determining multiple pixels within a preset range around the target pixel based on the target pixel with the largest pixel value in the image unit and a preset range, the method further includes: determining the target pixel with the largest pixel value in the image unit; determining the distance between the target pixel and the edge of the image unit; and determining the preset range based on the distance, wherein the preset range is a rectangle with the target pixel as its geometric center, and the preset range is located within the image unit.

[0012] Optionally, determining the preset range based on the distance includes: determining a first shortest distance to the edge in the horizontal direction and a second shortest distance to the edge in the vertical direction; determining the horizontal dimension of the preset range of the rectangle based on twice the first shortest distance, and determining the vertical dimension of the preset range of the rectangle based on twice the second shortest distance; and determining the preset range based on the horizontal dimension and the vertical dimension, with the target pixel as the geometric center.

[0013] To achieve the above objectives, according to another aspect of this application, an image correction method is provided, the method comprising: determining the optical fiber center coordinates of the image unit according to the above-described optical fiber image unit center positioning method; determining the optical fiber center coordinates of the image unit; determining the gain coefficient and offset coefficient of the image based on the optical fiber center coordinates and the pixel value at the center of the optical fiber; determining the correction coefficient of the image based on the gain coefficient and the offset coefficient; and correcting the image based on the correction coefficient and the pixel value of the image.

[0014] To achieve the above objectives, according to another aspect of this application, a center positioning device for an optical fiber image unit is provided, comprising: an acquisition module for acquiring an image to be positioned acquired by an optical fiber, wherein the optical fiber includes multiple fiber bundles, and the image to be positioned includes image units corresponding to each of the multiple fiber bundles; a determination module for determining multiple pixels within a preset range around the target pixel based on a target pixel with the largest pixel value in the image unit and a preset range; and a positioning module for determining the optical fiber center coordinates of the image unit using a grayscale centroid method based on the multiple pixels within the preset range, wherein the accuracy of the optical fiber center coordinates is at the sub-pixel level.

[0015] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided for storing a program, wherein the program executes the center positioning method or image correction method of the fiber optic image unit described in any one of the preceding claims.

[0016] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the center positioning method or image correction method of the fiber optic image unit as described in any one of the above.

[0017] This application acquires an image to be processed, which includes image units composed of multiple fiber bundles. Based on a target pixel with the largest pixel value in each image unit and a preset range, multiple pixels within a preset range surrounding the target pixel are determined. Based on these multiple pixels within the preset range and their grayscale information, the coordinates of the fiber center of the image unit are determined, with the accuracy of the fiber center coordinates being sub-pixel level. This achieves sub-pixel level positioning of the fiber center of the image unit, improving the accuracy of fiber center positioning. Image correction is performed better based on the sub-pixel level fiber center coordinates. This solves the problem in related technologies where fiber center positioning can only be done at the pixel level, resulting in deviations from the actual fiber center and thus inaccurate fiber center positioning and poor image correction. Attached Figure Description

[0018] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0019] Figure 1 This is a flowchart of a method for centering an optical fiber image unit according to an embodiment of this application;

[0020] Figure 2 This is a flowchart of an image correction method provided according to an embodiment of this application;

[0021] Figure 3 This is a schematic diagram comparing pixel-level fiber center and sub-pixel-level fiber center according to an embodiment of this application;

[0022] Figure 4 This is a schematic diagram of a center positioning device for an optical fiber image unit according to an embodiment of this application;

[0023] Figure 5 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] The present invention will now be described in conjunction with preferred implementation steps. Figure 1 This is a flowchart of a method for centering an optical fiber image unit according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:

[0028] Step S101: Acquire the image to be located by optical fiber acquisition, wherein the optical fiber includes multiple optical fiber bundles and the image to be located includes image units corresponding to each of the multiple optical fiber bundles.

[0029] Step S102: Based on the target pixel with the largest pixel value in the image unit and the preset range, determine multiple pixels within the preset range surrounding the target pixel.

[0030] Step S103: Determine the optical fiber center coordinates of the image unit based on multiple pixels within a preset range and the grayscale information of the pixels, wherein the precision of the optical fiber center coordinates is at the sub-pixel level.

[0031] The above steps involve acquiring an image to be processed, which comprises image units of multiple fiber bundles; determining multiple pixels within a preset range around the target pixel based on the target pixel with the highest pixel value in the image unit; and determining the fiber center coordinates of the image unit based on the multiple pixels within the preset range and the grayscale information of the pixels, with the fiber center coordinates having a sub-pixel accuracy. This achieves sub-pixel-level positioning of the fiber center of the image unit, improving the accuracy of fiber center positioning. Image correction is more effective based on the sub-pixel-level fiber center coordinates. This solves the problem in related technologies where fiber center positioning can only be done at the pixel level, resulting in deviations from the actual fiber center and thus inaccurate fiber center positioning and poor image correction.

[0032] The entity performing the above steps can be a fiber optic imaging device, which may include a processor, calculator, or controller or other data processing device to perform the data processing operations in the above steps, such as steps S101-S103.

[0033] The aforementioned fiber optic imaging device may include an endoscope, optical fibers, image processing equipment, and a display. The endoscope acquires images and transmits them via the optical fiber to the image processing equipment for image processing, which then displays the images on the display. The aforementioned image processing equipment may include devices with data processing capabilities, such as processors, calculators, controllers, or servers.

[0034] The aforementioned optical fiber comprises multiple closely spaced fiber bundles. In this embodiment, the cross-section of the fiber bundle is a regular hexagon, which provides structural stability and prevents movement, thus facilitating the effective propagation of the optical fiber within the bundle. Similarly, the image is composed of multiple closely spaced image units, each corresponding to a fiber bundle.

[0035] The image to be located, acquired via optical fiber, is the image output from the optical fiber. While there are no clear boundaries between image units in the image, techniques exist for extracting pixels from the central region of each image unit, allowing for the acquisition of multiple pixels within that central region.

[0036] like Figure 3As shown, the pixels with grayscale around the white box can be considered as pixels in the central region of the image unit.

[0037] The target pixel with the largest pixel value in the image unit is used as the geometric center of a preset range to determine multiple pixels within that range. The size of the preset range is an integer number of pixels, and the coordinates of the target pixel are also an integer number of pixels. However, determining the center of the image unit as a specific pixel, that is, locating the center of the optical fiber with integer coordinates, requires pixel-level precision that is achievable with relevant technologies.

[0038] When determining the fiber optic center coordinates of an image unit based on multiple pixels within a preset range and the grayscale information of those pixels, various calculation methods based on grayscale information for sub-pixel positioning, such as the grayscale centroid method, the grayscale squared weighted centroid method, and the variable-weight grayscale centroid method, can be used to determine the fiber optic center coordinates of the image unit. In this embodiment, the grayscale centroid method is used, and it will be used as an example for explanation.

[0039] This application determines the optical fiber center coordinates of an image unit based on multiple pixels within a preset range and the grayscale information of those pixels. The precision of the optical fiber center coordinates is at the sub-pixel level, meaning that the final precision of the optical fiber center coordinates is after the decimal point. Compared to pixel-level precision, which can only be rounded down, this method has the advantage of being more accurate.

[0040] Optionally, the coordinates of the fiber center of the image unit are determined by using the gray-scale centroid method based on multiple pixels within a preset range and the gray-scale information of the pixels. This includes: obtaining the pixel coordinates and corresponding pixel values ​​of multiple pixels within the preset range by traversing the preset range, wherein the gray-scale information includes pixel coordinates and pixel values, and the pixel coordinates of the pixels include horizontal and vertical coordinates; calculating the horizontal coordinate of the fiber center based on the horizontal coordinates and pixel values ​​of the multiple pixels, and calculating the vertical coordinate of the fiber center based on the vertical coordinates and pixel values ​​of the multiple pixels.

[0041] The grayscale centroid method described above is a method for determining the centroid based on grayscale values. It calculates the abscissa of the fiber optic center based on the abscissas and pixel values ​​of multiple pixels. Similarly, it calculates the ordinate of the fiber optic center based on the ordinates and pixel values ​​of multiple pixels.

[0042] like Figure 3 As shown, the preset range can be a 3x3 pixel area, or other sizes. Its shape is rectangular, and the length and width of the rectangle can be integer values ​​within the range of 3-5 pixels to select multiple complete pixels.

[0043] Based on the principle of the gray-scale centroid method, this embodiment determines the formula for calculating the coordinates of the fiber optic center, as follows:

[0044] Optionally, the x-coordinate of the fiber optic center can be calculated based on the x-coordinates of multiple pixels and their pixel values, using the following formula:

[0045]

[0046] In the formula, x0 is the x-coordinate, x i f(x) is the x-coordinate of the pixel. i ,y j Let be the pixel value of the pixel in the i-th column and j-th row within the preset range, h1 and h2 be the minimum and maximum values ​​of the preset range in the vertical direction, and w1 and w2 be the minimum and maximum values ​​of the preset range in the horizontal direction, where the value of x0 is accurate to the decimal point, and x... i It is an integer.

[0047] In the above Figure 3 In this example, the number of pixels is 9. Theoretically, h1 can be 0, and h2 can theoretically be the number of pixels in the horizontal direction of the image. Figure 3 In this context, h1 and h2 can be 575 and 577 respectively. Similarly, w1 can theoretically be 0, and w2 can theoretically be the number of pixels in the vertical direction of the image. Figure 3 In the above, w1 and w2 can be 163 and 166 respectively.

[0048] x i These are the pixel coordinates of each pixel, and their smallest value is an integer. Therefore, their precision is limited to the pixel level, which is insufficient to meet the precision requirements of image correction.

[0049] Using the grayscale centroid method described above, the abscissa is determined to be at the sub-pixel level with precision after the decimal point. Figure 3 In the image unit, the fiber center coordinates are determined by the fiber center determination method of related technologies. The white dot in the figure has an abscissa of 576. Then, the subpixel coordinates are obtained by the gray centroid method, which is the cross point with an abscissa of 576.2279. From the overall gray distribution of the light spot, the center position of the cross point is more accurate than the center position of the dot for locating the light spot.

[0050] Optionally, the ordinate of the fiber center can be calculated based on the ordinates of multiple pixels and the pixel values, including by using the following formula:

[0051]

[0052] In the formula, y0 is the ordinate, y j f(x) is the ordinate of the pixel. i ,y jLet y0 be the pixel value of the i-th column and j-th row within a preset range, h1 and h2 be the minimum and maximum values ​​of the preset range in the vertical direction, and w1 and w2 be the minimum and maximum values ​​of the preset range in the horizontal direction, where the value of y0 is accurate to the decimal point. j It is an integer.

[0053] y ji These are the pixel coordinates of each pixel, and their smallest value is an integer. Therefore, their precision is limited to the pixel level, which is insufficient to meet the precision requirements of image correction.

[0054] Using the grayscale centroid method described above, the abscissa is determined to be at the sub-pixel level with precision after the decimal point. Figure 3 In the image unit, the coordinates of the fiber center are determined according to the fiber center determination method of related technologies. Figure 3 The white dot in the image has a vertical coordinate of 164. The sub-pixel coordinates of the cross point are obtained by using the gray-scale centroid method, with a vertical coordinate of 164.0613. From the overall gray-scale distribution of the light spot, the center of the cross point is more accurate in locating the light spot than the center of the dot.

[0055] Then, the sub-pixel level coordinates of the fiber center, x0 and y0, are calculated. This improves the accuracy of fiber center determination to meet the higher precision requirements of image correction.

[0056] Optionally, before determining multiple pixels within a preset range around the target pixel based on the target pixel with the largest pixel value in the image unit and the preset range, the method further includes: determining the target pixel with the largest pixel value in the image unit; determining the distance between the target pixel and the edge of the image unit; and determining the preset range based on the distance, wherein the preset range is a rectangle with the target pixel as its geometric center and the preset range is located within the image unit.

[0057] The size of the aforementioned preset range can be adjusted according to actual conditions. Specifically, the size of the preset range can be determined using the distance between the target pixel and the edge pixels of the image unit. This allows for the coverage of as many pixels as possible, thereby improving the pixel coordinates of the fiber center determined by the grayscale centroid method.

[0058] Optionally, determining the preset range based on distance includes: determining a first shortest distance to the edge in the horizontal direction and a second shortest distance to the edge in the vertical direction; determining the horizontal dimension of the preset range of the rectangle based on twice the first shortest distance and determining the vertical dimension of the preset range of the rectangle based on twice the second shortest distance; and determining the preset range based on the horizontal and vertical dimensions with the target pixel as the geometric center.

[0059] Using twice the shortest distance as the preset range size in both the horizontal and vertical directions is to prevent the preset range from covering the pixels of other image units, which could affect the accuracy of fiber optic center positioning.

[0060] To achieve the above objectives, according to another aspect of this application, an image correction method is provided. Figure 2 This is a flowchart of an image correction method provided according to an embodiment of this application, such as... Figure 2 As shown, the method includes:

[0061] Step S201: Determine the optical fiber center coordinates of the image unit according to the above-described optical fiber image unit center positioning method;

[0062] Step S202: Based on the fiber center coordinates and the pixel value at the fiber center, determine the image gain coefficient and offset coefficient.

[0063] Step S203: Determine the correction coefficient of the image based on the gain coefficient and the bias coefficient;

[0064] Step S203: Correct the image based on the correction coefficient and the pixel value of the image.

[0065] The aforementioned correction coefficients can be brightness correction coefficients. The aforementioned gain coefficients and bias coefficients can be pre-input. The aforementioned correction coefficients include gain coefficients and bias coefficients. Multiplying the pixel value of the image's pixel by the gain coefficient and then adding the bias coefficient yields the corrected pixel value. This process corrects the image, making the image's pixel values ​​closer to the input pixel values.

[0066] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0067] It should be noted that this application also provides an optional implementation method, which will be described in detail below.

[0068] This embodiment provides a method for fiber optic center positioning using the grayscale centroid method. In the overall image correction process, including positioning, calibration, and brightness measurement, all steps are implemented using a sub-pixel scheme. The specific sub-pixel scheme will be described below:

[0069] There are many methods for subpixel localization, which are generally divided into two categories. One is based on the edge of the fiber region and uses a fitting method to obtain the coordinates of the fiber center. The other is based on the grayscale information of the fiber region and uses the grayscale centroid method to obtain the coordinates of the fiber center.

[0070] The formula for calculating the center coordinates of an optical fiber using the gray-scale centroid method is shown below:

[0071]

[0072] In the above formula, f(x,y) is the gray value of the image, x and y are the coordinate positions of the pixels, h1 and h2 are the minimum and maximum values ​​in the depth direction of the fiber optic region, and w1 and w2 are the minimum and maximum values ​​in the horizontal direction of the fiber optic region.

[0073] Based on the fiber center obtained above, the sub-pixel coordinates of the gray-scale centroid center of n pixels within a preset range (determined according to the actual spot size, such as 3×3) around the center of each fiber are calculated.

[0074] Figure 3 This is a schematic diagram comparing pixel-level fiber center and sub-pixel-level fiber center according to an embodiment of this application, as shown below. Figure 3 As shown above, the center coordinates of the optical fiber are obtained as the circle (576, 164) in the figure. Then, the sub-pixel coordinates are obtained by the gray centroid method as the cross point (576.2279, 164.0613). From the overall gray distribution of the light spot, the center position of the cross point is more accurate than the center position of the circle point in locating the light spot.

[0075] Figure 4 This is a schematic diagram of a center positioning device for an optical fiber image unit according to an embodiment of this application, such as... Figure 4 As shown, this application embodiment also provides a center positioning device for an optical fiber image unit. It should be noted that the center positioning device for an optical fiber image unit in this application embodiment can be used to execute the center positioning method for an optical fiber image unit provided in this application embodiment. The center positioning device for an optical fiber image unit provided in this application embodiment is described below. The device includes: an acquisition module 41, a determination module 42, and a positioning module 43, as detailed below.

[0076] The acquisition module 41 is used to acquire the image to be located by optical fiber acquisition, wherein the optical fiber includes multiple fiber bundles, and the image to be located includes image units corresponding to each of the multiple fiber bundles; the determination module 42 is connected to the acquisition module 41 and is used to determine multiple pixels within a preset range around the target pixel based on the target pixel with the largest pixel value in the image unit and a preset range; the positioning module 43 is connected to the determination module 42 and is used to determine the optical fiber center coordinates of the image unit by using the gray-scale centroid method based on the multiple pixels within the preset range, wherein the accuracy of the optical fiber center coordinates is at the sub-pixel level.

[0077] The aforementioned fiber optic image unit center positioning device acquires an image to be processed, which includes image units composed of multiple fiber bundles. Based on the target pixel with the largest pixel value in each image unit and a preset range, it determines multiple pixels within a preset range surrounding the target pixel. Based on these multiple pixels within the preset range, it determines the fiber optic center coordinates of the image unit, with the fiber optic center coordinates having sub-pixel accuracy. This achieves sub-pixel-level positioning of the fiber optic center of the image unit, improving the accuracy of fiber optic center positioning. Image correction is more effective based on the sub-pixel-level fiber optic center coordinates. This solves the problem in related technologies where fiber optic center positioning can only be done at the pixel level, resulting in deviations from the actual fiber optic center and thus inaccurate fiber optic center positioning and poor image correction.

[0078] The center positioning device of the fiber optic image unit includes a processor and a memory. The acquisition module 41, determination module 42, positioning module 43, etc. are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0079] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured. By adjusting the kernel parameters, the problem of users being unable to determine compatibility with non-capacitive screen original capacitive pens in related technologies can be solved.

[0080] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0081] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements a center positioning method or an image correction method for the fiber optic image unit.

[0082] This invention provides a processor for running a program, wherein the program executes a center positioning method or an image correction method for the fiber optic image unit.

[0083] Figure 5 This is a schematic diagram of an electronic device provided according to an embodiment of this application, such as... Figure 5 As shown, this application embodiment provides an electronic device 50, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the above-mentioned fiber optic image unit center positioning method or image correction method.

[0084] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0085] This application also provides a computer program product that, when executed on a fiber optic central positioning device, is suitable for executing a program that initializes any of the above-described method steps.

[0086] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0087] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable fiber optic central positioning device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable fiber optic central positioning device, generate instructions for implementing the process... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0088] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable fiber optic central positioning device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0089] These computer program instructions can also be loaded onto a computer or other programmable fiber optic central positioning device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0090] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0091] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0092] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0093] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0094] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0095] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for centering an optical fiber image unit, characterized in that, The method includes: The image to be located is acquired by optical fiber acquisition, wherein the optical fiber includes multiple fiber bundles, and the image to be located includes image units corresponding to each of the multiple fiber bundles. Identify the target pixel with the largest pixel value in the image unit; Determine the distance between the target pixel and the edge of the image unit; Based on the distance, a preset range is determined, wherein the preset range is a rectangle with the target pixel as its geometric center, and the preset range is located within the image unit; Based on the target pixel with the largest pixel value in the image unit and a preset range, determine multiple pixels within a preset range surrounding the target pixel; Based on multiple pixels within the preset range and the grayscale information of the pixels, the optical fiber center coordinates of the image unit are determined using the grayscale centroid method, wherein the accuracy of the optical fiber center coordinates is at the sub-pixel level. Determining the preset range based on the distance includes: Determine the first shortest distance to the edge in the horizontal direction and the second shortest distance to the edge in the vertical direction; The horizontal dimension of the preset range of the rectangle is determined based on twice the first shortest distance, and the vertical dimension of the preset range of the rectangle is determined based on twice the second shortest distance. The preset range is determined based on the target pixel as the geometric center, according to the horizontal dimension and the vertical dimension.

2. The method according to claim 1, characterized in that, Determining the fiber optic center coordinates of the image unit based on multiple pixels within the preset range and the grayscale information of those pixels includes: By traversing multiple pixels within the preset range, the pixel coordinates and corresponding pixel values ​​of the multiple pixels within the preset range are obtained. The grayscale information includes the pixel coordinates and pixel values, and the pixel coordinates of the pixel include the horizontal coordinate and the vertical coordinate. The horizontal coordinate of the center of the optical fiber is calculated based on the horizontal coordinates of multiple pixels and the pixel values. The ordinate of the center of the optical fiber is calculated based on the ordinates of multiple pixels and the pixel values.

3. The method according to claim 2, characterized in that, Calculating the abscissa of the fiber center based on the abscissas of multiple pixels and the pixel values ​​includes: The x-coordinate is calculated using the following formula: In the formula, x 0 is the x-coordinate. x i Let x be the x-coordinate of the pixel. f ( x i , y j () represents the pixel value of the pixel in the i-th column and j-th row within the preset range. h 1. h 2 represents the minimum and maximum values ​​of the preset range in the vertical direction, respectively. w 1. w 2 represents the minimum and maximum values ​​of the preset range in the horizontal direction, respectively. x The value of 0 is accurate after the decimal point. x i It is an integer.

4. The method according to claim 2, characterized in that, Calculating the ordinate of the fiber center based on the ordinates of multiple pixels and the pixel values ​​includes: The ordinate is calculated using the following formula: In the formula, y 0 is the ordinate. y j The ordinate of the pixel is... f ( x i , y j () represents the pixel value of the pixel in the i-th column and j-th row within the preset range. h 1. h 2 represents the minimum and maximum values ​​of the preset range in the vertical direction, respectively. w 1. w 2 represents the minimum and maximum values ​​of the preset range in the horizontal direction, respectively. y The value of 0 is accurate after the decimal point. y j It is an integer.

5. An image correction method, characterized in that, The method includes: The optical fiber center coordinates of the image unit are determined according to the center positioning method of any one of claims 1 to 4. Based on the coordinates of the fiber center and the pixel value at the fiber center, the gain coefficient and bias coefficient of the image are determined. The correction coefficients of the image are determined based on the gain coefficient and the bias coefficient. The image is corrected based on the correction coefficient and the pixel values ​​of the image.

6. A center positioning device for an optical fiber image unit, characterized in that, include: The acquisition module is used to: acquire the image to be located by optical fiber acquisition, and determine the target pixel with the largest pixel value in the image unit; Determine the distance between the target pixel and the edge of the image unit; determine a preset range based on the distance, wherein the preset range is a rectangle with the target pixel as its geometric center, and the preset range is located within the image unit; The optical fiber includes multiple fiber bundles, and the image to be located includes image units corresponding to each of the multiple fiber bundles. The determining module is used to determine multiple pixels within a preset range around the target pixel based on the target pixel with the largest pixel value in the image unit and a preset range. The positioning module is used to determine the optical fiber center coordinates of the image unit using the gray-scale centroid method based on multiple pixels within the preset range and the gray-scale information of the pixels, wherein the accuracy of the optical fiber center coordinates is at the sub-pixel level. The acquisition module determines the preset range based on the distance by: determining a first shortest distance to the edge in the horizontal direction and a second shortest distance to the edge in the vertical direction; determining the horizontal dimension of the preset range of the rectangle based on twice the first shortest distance, and determining the vertical dimension of the preset range of the rectangle based on twice the second shortest distance; and determining the preset range based on the target pixel as the geometric center and the horizontal and vertical dimensions.

7. A computer-readable storage medium, characterized in that, The storage medium is used to store a program, wherein the program executes the center positioning method of the fiber optic image unit according to any one of claims 1 to 4, or the image correction method according to claim 5.

8. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the center positioning method of the fiber optic image unit according to any one of claims 1 to 4, or the image correction method according to claim 5.