Fiber optic center positioning method, fiber optic image correction method, electronic equipment

By determining the sub-pixel level coordinates of the fiber center using the cosine curve fitting method, the problem of inaccurate fiber center positioning was solved, and higher-precision image correction was achieved.

CN116580087BActive Publication Date: 2026-04-03WUXI HISKY MEDICAL TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-03
Publication Date
2026-04-03

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

The cosine curve fitting method is used to calculate the sub-pixel level coordinates of the fiber center by obtaining the target pixel with the largest pixel value and its neighboring pixels in the fiber image.

Benefits of technology

It improves the accuracy of fiber optic center positioning and enhances image correction performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116580087B_ABST
    Figure CN116580087B_ABST
Patent Text Reader

Abstract

This application discloses a fiber optic center positioning method, a fiber optic image correction method, and an electronic device. The method includes: acquiring a fiber optic image to be processed, wherein the fiber optic image includes an imaging region of multiple fiber optic units; determining a target pixel with the largest pixel value in the imaging region, and multiple adjacent pixels adjacent to the target pixel; and determining the fiber optic center coordinates of the fiber optic units using a cosine curve fitting method based on the target pixel and the multiple adjacent pixels, wherein the accuracy of the fiber optic center coordinates is at the sub-pixel level. This solves the problem in related technologies where fiber optic center positioning can only be done at the pixel level, resulting in deviation from the actual fiber optic center, leading to inaccurate fiber optic center positioning and poor image correction effects.
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 fiber optic center positioning method, a fiber optic image correction method, and an electronic device. Background Technology

[0002] Existing technologies include a fiber optic center localization method that uses the previously acquired center marker position of the fiber unit as the origin, sets a search neighborhood range within the size of the fiber unit, and identifies the location of the maximum grayscale value within this neighborhood as the target position. When the distance difference between the target position and the center marker position reaches a certain threshold, the location with the maximum grayscale value in the current fiber image, i.e., the target position, is taken as the corrected center position of the fiber unit. However, this method not only oversimplifies by using the maximum grayscale value as the fiber center, but also provides pixel-level accuracy, meaning it can only pinpoint a specific pixel. The area of ​​a pixel still has a significant error compared to 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 localization and poor image correction results.

[0003] 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

[0004] The main objective of this application is to provide a fiber optic center positioning method, a fiber optic image correction method, and an electronic device to solve the problem in related technologies where the fiber optic center can only be located at the pixel level, resulting in a deviation from the actual fiber optic center, which in turn leads to inaccurate fiber optic center positioning and poor image correction effect.

[0005] To achieve the above objectives, according to one aspect of this application, a fiber optic center positioning method is provided. The method includes: acquiring a fiber optic image to be processed, wherein the fiber optic image includes an imaging region of multiple fiber optic units; determining a target pixel with the largest pixel value in the imaging region, and multiple adjacent pixels adjacent to the target pixel; and determining the fiber optic center coordinates of the fiber optic units using a cosine curve fitting method based on the target pixel and the multiple adjacent pixels, wherein the accuracy of the fiber optic center coordinates is at the sub-pixel level.

[0006] Optionally, determining the fiber center coordinates of the fiber unit using a cosine curve fitting method based on the target pixel and multiple adjacent pixels includes: determining the target pixel coordinates and target pixel value of the target pixel, the first pixel coordinates and first pixel values ​​of multiple horizontally adjacent first pixels, and the second pixel coordinates and second pixel values ​​of multiple vertically adjacent second pixels; determining the horizontal coordinate of the fiber center based on the target pixel coordinates and target pixel value, and the first pixel coordinates and first pixel values; and determining the vertical coordinate of the fiber center based on the target pixel coordinates and target pixel value, and the second pixel coordinates and second pixel values.

[0007] Optionally, determining the abscissa of the fiber center based on the target pixel coordinates and target pixel value, as well as the first pixel coordinates and first pixel value, includes: determining a first cosine parameter based on the target pixel value and the first pixel value; determining a second cosine parameter based on the target pixel value, the first pixel value, the first cosine parameter, and the azimuth angle of the target pixel; and determining the abscissa of the fiber center based on the first cosine parameter and the second cosine parameter.

[0008] Optionally, the plurality of horizontally adjacent first pixels include two first pixels that are horizontally adjacent to the target pixel. Determining the first cosine parameter based on the target pixel value and the first pixel value includes calculating the first cosine parameter using the following formula: In the formula, w1 is the first cosine parameter, gray1 and gray3 are the first pixel values ​​of the two first pixel points respectively, and gray2 is the target pixel value of the target pixel point; determining the second cosine parameter based on the target pixel value, the first pixel value, the first cosine parameter, and the azimuth angle of the target pixel point includes: calculating the second cosine parameter using the following formula: θ1=atan2(gray1-gray3,2*gray2*sin(w1)), where θ1 is the second cosine parameter and atan2 is the azimuth angle of the target pixel point; determining the abscissa of the fiber center based on the first cosine parameter and the second cosine parameter includes: calculating the abscissa using the following formula: In the formula, x0 is the horizontal coordinate, and x2 is the horizontal coordinate of the target pixel coordinates. The value is accurate to the decimal point, and x2 is an integer.

[0009] Optionally, determining the abscissa of the fiber center based on the target pixel coordinates and target pixel value, as well as the second pixel coordinates and second pixel value, includes: determining a third cosine parameter based on the target pixel value and the second pixel value; determining a fourth cosine parameter based on the target pixel value, the second pixel value, the third cosine parameter, and the azimuth angle of the target pixel; and determining the ordinate of the fiber center based on the third cosine parameter and the fourth cosine parameter.

[0010] Optionally, the plurality of vertically adjacent second pixels includes two second pixels that are vertically adjacent to the target pixel. Determining the third cosine parameter based on the target pixel value and the second pixel value includes calculating the third cosine parameter using the following formula: In the formula, w2 is the third cosine parameter, gray11 and gray33 are the second pixel values ​​of the two second pixel points respectively, and gray2 is the target pixel value of the target pixel point; determining the fourth cosine parameter based on the target pixel value, the second pixel value, the third cosine parameter, and the azimuth angle of the target pixel point includes: calculating the fourth cosine parameter using the following formula: θ2=atan2(gray11-gray33,2*gray2*sin(w2)), where θ2 is the fourth cosine parameter, and atan2 is the azimuth angle of the target pixel point; determining the ordinate of the fiber center based on the third cosine parameter and the fourth cosine parameter includes: calculating the ordinate using the following formula: In the formula, y0 is the ordinate, and y2 is the ordinate in the target pixel coordinates. The value is accurate to the decimal point, and y2 is an integer.

[0011] To achieve the above objectives, according to another aspect of this application, a fiber optic image correction method is provided, the method comprising: determining the fiber center coordinates of a fiber optic unit according to the fiber optic center positioning method described in any one of the preceding claims; determining the fiber optic image correction coefficient based on the fiber center coordinates; and correcting the fiber optic image according to the correction coefficient.

[0012] To achieve the above objectives, according to another aspect of this application, a fiber optic center positioning device is provided, comprising: an acquisition module for acquiring a fiber optic image to be processed, wherein the fiber optic image includes an imaging region of a plurality of fiber optic units; a determination module for determining a target pixel with the largest pixel value in the imaging region, and a plurality of adjacent pixels adjacent to the target pixel; and a fitting module for determining the fiber optic center coordinates of the fiber optic units using a cosine curve fitting method based on the target pixel and the plurality of adjacent pixels, wherein the accuracy of the fiber optic center coordinates is at the sub-pixel level.

[0013] 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 fiber optic center positioning method or the fiber optic image correction method described in any one of the above claims.

[0014] 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 any of the fiber optic center positioning methods or fiber optic image correction methods described above.

[0015] This application acquires an image of the optical fiber to be processed, wherein the optical fiber image includes an imaging area of ​​multiple optical fiber units; it determines the target pixel with the largest pixel value in the imaging area, as well as multiple adjacent pixels adjacent to the target pixel; based on the target pixel and multiple adjacent pixels, it uses a cosine curve fitting method to determine the coordinates of the optical fiber center of the optical fiber unit, wherein the accuracy of the optical fiber center coordinates is at the sub-pixel level. This achieves sub-pixel level positioning of the optical fiber center using the cosine curve fitting method, improving the accuracy of optical fiber center positioning. Image correction is performed better based on the sub-pixel level optical fiber center coordinates. This solves the problem in related technologies where the optical fiber center can only be located at the pixel level, resulting in deviation from the actual optical fiber center, leading to inaccurate optical fiber center positioning and poor image correction results. Attached Figure Description

[0016] 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:

[0017] Figure 1 This is a flowchart of an optical fiber center positioning method provided according to an embodiment of this application;

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

[0019] Figure 3 This is a schematic diagram of an optical fiber center positioning device provided according to an embodiment of this application;

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

[0021] 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.

[0022] 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.

[0023] 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.

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

[0025] Step S101: Obtain the optical fiber image to be processed, wherein the optical fiber image includes the imaging area of ​​multiple optical fiber units;

[0026] Step S102: Determine the target pixel with the largest pixel value in the imaging region, as well as multiple adjacent pixels adjacent to the target pixel.

[0027] Step S103: Based on the target pixel and multiple adjacent pixels, the cosine curve fitting method is used to determine the fiber center coordinates of the fiber unit, wherein the accuracy of the fiber center coordinates is at the sub-pixel level.

[0028] The above steps involve acquiring an image of the optical fiber to be processed, which includes the imaging area of ​​multiple optical fiber units; determining the target pixel with the largest pixel value in the imaging area, as well as multiple adjacent pixels; and using a cosine curve fitting method based on the target pixel and the multiple adjacent pixels to determine the coordinates of the optical fiber center of the optical fiber unit, where the accuracy of the optical fiber center coordinates is at the sub-pixel level. This achieves sub-pixel-level positioning of the optical fiber center using the cosine curve fitting method, improving the accuracy of optical fiber center positioning. Image correction is performed better based on the sub-pixel-level coordinates of the optical fiber center. This solves the problem in related technologies where the optical fiber center can only be located at the pixel level, resulting in deviations from the actual optical fiber center and thus inaccurate optical fiber center positioning and poor image correction effects.

[0029] The entity performing the above steps can be a medical endoscope 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.

[0030] The aforementioned medical endoscope may include an endoscope, optical fiber, an image processor, and a display. The endoscope acquires images and transmits them via optical fiber to the image processor for image processing, which then displays the images on the display. The image processor may include the aforementioned processor, calculator, controller, or server, or other devices with data processing capabilities.

[0031] The aforementioned optical fibers comprise fiber bundles with a regular hexagonal cross-section. Their stable structure and resistance to movement facilitate efficient fiber propagation within the bundle. The target image consists of multiple fiber regions, each corresponding to a fiber bundle.

[0032] The aforementioned optical fiber image can be the image transmitted through the aforementioned optical fiber, including multiple imaging regions. Each imaging region corresponds to an optical fiber unit in the optical fiber, and the optical fiber unit specifically transmits the corresponding imaging region. All optical fiber units divide the light image into imaging regions for transmission.

[0033] Then, at the optical image receiving end, the various imaging regions are combined and merged to reconstruct the optical image. However, due to fiber drift, it is impossible to effectively and accurately locate the fiber center of the imaging region when merging the imaging regions.

[0034] In response to the above-mentioned problems, this embodiment provides a method using cosine curve fitting to determine the coordinates of the fiber center of the fiber unit, thereby achieving sub-pixel-level precision positioning of the fiber center of the fiber unit.

[0035] It should be noted that the fiber optic center positioning in related technologies is at most pixel-level, meaning the final coordinates of the fiber optic center are integer pixel distances, and the determined fiber optic center can only be a region of one pixel. Sub-pixel coordinates, however, can be accurate to decimal places, providing more precise fiber optic center coordinates.

[0036] Specifically, first determine the target pixel with the largest pixel value in each imaging region, as well as the multiple pixels adjacent to the target pixel. Since the pixels are arranged in rows and columns, the adjacent pixels to the target pixel can be horizontally or vertically adjacent, or diagonally adjacent.

[0037] In addition, adjacent adjacent pixels can be pixels that are directly adjacent to the target pixel, or pixels that are indirectly adjacent to the target pixel through directly adjacent adjacent pixels.

[0038] However, the selection of adjacent pixels also has certain requirements, such as the pixel value being non-zero or the pixel value reaching a preset pixel value. Therefore, when selecting indirectly adjacent pixels, all pixels separated from the target pixel must meet the selection requirements.

[0039] Based on the target pixel and multiple adjacent pixels, a cosine curve fitting method is used to determine the sub-pixel level coordinates of the fiber optic unit's center. This improves the accuracy of fiber center positioning, and image correction is more effective when using sub-pixel level fiber center coordinates.

[0040] Optionally, based on the target pixel and multiple adjacent pixels, the cosine curve fitting method is used to determine the fiber center coordinates of the fiber unit, including: determining the target pixel coordinates and target pixel value of the target pixel, as well as the first pixel coordinates and first pixel values ​​of multiple horizontally adjacent first pixels, and the second pixel coordinates and second pixel values ​​of multiple vertically adjacent second pixels; determining the horizontal coordinate of the fiber center based on the target pixel coordinates and target pixel value, as well as the first pixel coordinates and first pixel values; and determining the vertical coordinate of the fiber center based on the target pixel coordinates and target pixel value, as well as the second pixel coordinates and second pixel values.

[0041] The first pixel coordinates of the first pixel point include both integer x-coordinates and y-coordinates. The second pixel coordinates of the second pixel point also include both integer x-coordinates and y-coordinates. The target pixel coordinates are also integers, representing a specific pixel point.

[0042] Since cosine curve fitting requires pixel values, it's crucial to select pixels with higher values. Pixels with extremely low values, close to zero, are not recommended. Therefore, not all pixels can be used as the first or second pixel for cosine curve fitting. Indirect adjacency refers to all pixels between the current pixel and the target pixel that meet the pixel value requirements and are selected as the first or second pixel for cosine curve fitting. Only then can the current pixel and the target pixel be considered indirectly adjacent.

[0043] Theoretically, the more data points a cosine curve fits, the higher the accuracy. However, it's important to consider that the size of a fiber optic region itself is only a few pixels. In this embodiment, the lateral size of a fiber optic region is approximately 3 to 7 pixels. Considering that the target pixel with the largest pixel value could be located anywhere within the fiber optic region, this embodiment only selects the two first pixels directly adjacent to the target pixel.

[0044] Optionally, determining the abscissa of the fiber center based on the target pixel coordinates and target pixel value, as well as the first pixel coordinates and first pixel value, includes: determining a first cosine parameter based on the target pixel value and first pixel value; determining a second cosine parameter based on the target pixel value, first pixel value, first cosine parameter, and azimuth angle of the target pixel; and determining the abscissa of the fiber center based on the first cosine parameter and second cosine parameter.

[0045] Specifically, the multiple horizontally adjacent first pixels include the two first pixels that are horizontally adjacent to the target pixel on the left and right. The first cosine parameter is determined based on the target pixel value and the first pixel values, calculated using the following formula:

[0046]

[0047] In the formula, w1 is the first cosine parameter, gray1 and gray3 are the first pixel values ​​of the two first pixel points, and gray2 is the target pixel value. Based on the target pixel value, the first pixel value, the first cosine parameter, and the azimuth angle of the target pixel point, the second cosine parameter is determined by calculating the second cosine parameter using the following formula:

[0048] θ1=atan2(gray1-gray3,2*gray2*sin(w1))

[0049] In the formula, θ1 is the second cosine parameter, and atan2 is the azimuth angle of the target pixel. The abscissa of the fiber center is determined based on the first and second cosine parameters by calculating the abscissa using the following formula:

[0050]

[0051] In the formula, x0 is the x-coordinate, and x2 is the x-coordinate of the target pixel coordinates. The value is accurate to the decimal point, and x2 is an integer.

[0052] This allows us to calculate the x-coordinate x0 of the fiber center, accurate to the sub-pixel level after the decimal point.

[0053] Optionally, determining the abscissa of the fiber center based on the target pixel coordinates and target pixel value, as well as the second pixel coordinates and second pixel value, includes: determining the third cosine parameter based on the target pixel value and second pixel value; determining the fourth cosine parameter based on the target pixel value, second pixel value, third cosine parameter, and azimuth angle of the target pixel; and determining the ordinate of the fiber center based on the third cosine parameter and fourth cosine parameter.

[0054] Specifically, the multiple vertically adjacent second pixels include two second pixels that are vertically adjacent to the target pixel. The third cosine parameter is determined based on the target pixel value and the second pixel value, calculated using the following formula:

[0055]

[0056] In the formula, w2 is the third cosine parameter, gray11 and gray33 are the second pixel values ​​of the two second pixel points respectively, and gray2 is the target pixel value; based on the target pixel value, the second pixel value, the third cosine parameter, and the azimuth angle of the target pixel point, the fourth cosine parameter is determined by: calculating the fourth cosine parameter using the following formula:

[0057] θ2=atan2(gray11-gray33,2*gray2*sin(w2))

[0058] In the formula, θ2 is the fourth cosine parameter, and atan2 is the azimuth angle of the target pixel. The ordinate of the fiber center is determined based on the third and fourth cosine parameters by calculating the ordinate using the following formula:

[0059]

[0060] In the formula, y0 is the ordinate, and y2 is the ordinate in the target pixel coordinates. The value is accurate to the decimal point, and y2 is an integer.

[0061] This allows us to calculate the ordinate y0 of the fiber center, accurate to the sub-pixel level after the decimal point.

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

[0063] Step S201: Determine the coordinates of the fiber center of the fiber unit according to the fiber center positioning method described above.

[0064] Step S202: Determine the fiber image correction coefficient based on the fiber center coordinates;

[0065] Step S203: Correct the fiber optic image according to the correction coefficient.

[0066] The above steps involve acquiring a target image, which includes the fiber optic region of multiple fiber optic units; identifying the target pixel with the largest pixel value within the fiber optic region, as well as multiple adjacent pixels; and determining the fiber center coordinates of the fiber optic unit using a parabolic fitting method based on the target pixel and its adjacent pixels, achieving sub-pixel accuracy. This achieves sub-pixel-level positioning of the fiber center using parabolic fitting, improving the accuracy of fiber center positioning. Image correction is further enhanced by using sub-pixel-level fiber center coordinates. This solves the problem in related technologies where fiber center positioning is limited to the pixel level, resulting in deviations from the actual fiber center and inaccurate positioning.

[0067] The aforementioned correction coefficients can be brightness correction coefficients. Based on the fiber center coordinates and the pixel value at the fiber center, the image gain coefficient and offset coefficient are determined; based on the gain coefficient and offset coefficient, the image correction coefficient is determined; and based on the correction coefficient and the image pixel value, the image is corrected.

[0068] The gain and bias coefficients mentioned above can be pre-inputted. The correction coefficients include gain and bias coefficients. By multiplying the pixel value of the image by the gain coefficient and then adding the bias coefficient, the corrected pixel value is obtained. This process corrects the image, making the pixel values ​​of the image closer to the input pixel values.

[0069] 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.

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

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

[0072] There are many methods for subpixel localization, generally divided into two categories: one is based on the edge of the fiber region, using a fitting method to obtain the coordinates of the fiber center; the other is based on the grayscale information of the fiber region, using the grayscale centroid method to obtain the coordinates of the fiber center. This implementation chooses to use cosine curve fitting to perform subpixel localization of the fiber center.

[0073] The formula for fitting a cosine curve is shown below:

[0074]

[0075] θ1=atan2(gray1-gray3,2*gray2*sin(w1))

[0076]

[0077] θ2=atan2(gray11-gray33,2*gray2*sin(w2))

[0078]

[0079] Where atan2 is the azimuth function, (x2,y2) is the point with the largest gray value in the fiber optic region, (x1,gray1), (x2,gray2), and (x3,gray3) are three adjacent points in the region, and gray1, gray2, and gray3 are the gray values ​​of that point, fitting the x0 coordinate; similarly, three adjacent points (y1,gray11), (y2,gray2), and (y3,gray33) are selected to fit the y0 coordinate.

[0080] Figure 3 This is a schematic diagram of an optical fiber center positioning device according to an embodiment of this application, such as... Figure 3 As shown in the figure, this application embodiment also provides a fiber optic center positioning device. It should be noted that the fiber optic center positioning device of this application embodiment can be used to execute the fiber optic center positioning method provided in this application embodiment. The fiber optic center positioning device provided in this application embodiment is described below. The device includes: an acquisition module 31, a determination module 32, and a fitting module 33, as detailed below.

[0081] The acquisition module 31 is used to acquire the optical fiber image to be processed, wherein the optical fiber image includes the imaging area of ​​multiple optical fiber units; the determination module 32 is connected to the acquisition module 31 and is used to determine the target pixel with the largest pixel value in the imaging area, and multiple adjacent pixels adjacent to the target pixel; the fitting module 33 is connected to the determination module 32 and is used to determine the optical fiber center coordinates of the optical fiber unit by using a cosine curve fitting method based on the target pixel and multiple adjacent pixels, wherein the accuracy of the optical fiber center coordinates is at the sub-pixel level.

[0082] The aforementioned fiber optic center positioning device acquires an image of the fiber optic cable to be processed, which includes the imaging area of ​​multiple fiber optic units; determines the target pixel with the largest pixel value in the imaging area, as well as multiple adjacent pixels adjacent to the target pixel; and determines the fiber optic center coordinates of the fiber optic unit using a cosine curve fitting method based on the target pixel and the multiple adjacent pixels, where the accuracy of the fiber optic center coordinates is at the sub-pixel level. This achieves sub-pixel-level positioning of the fiber optic center using the cosine curve fitting method, improving the accuracy of fiber optic center positioning. Image correction is performed better 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 effects.

[0083] The fiber optic center positioning device includes a processor and a memory. The acquisition module 31, determination module 32, fitting module 33, 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.

[0084] 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.

[0085] 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.

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

[0087] This invention provides a processor for running a program, wherein the program executes the fiber optic center positioning method or the fiber optic image correction method during runtime.

[0088] Figure 4 This is a schematic diagram of an electronic device provided according to an embodiment of this application, such as... Figure 4 As shown, this application embodiment provides an electronic device 40, 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-described fiber optic center positioning method or fiber optic image correction method.

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

[0090] 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.

[0091] 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.

[0092] 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.

[0093] 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.

[0094] 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.

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

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

[0097] 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.

[0098] 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.

[0099] 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.

[0100] 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 fiber optic center positioning method, characterized in that, The method includes: Acquire an optical fiber image to be processed, wherein the optical fiber image includes an imaging region of multiple optical fiber units; Identify the target pixel with the largest pixel value in the imaging region, and multiple adjacent pixels adjacent to the target pixel; Based on the target pixel and multiple adjacent pixels, the fiber center coordinates of the fiber unit are determined using a cosine curve fitting method, wherein the accuracy of the fiber center coordinates is at the sub-pixel level; including: The target pixel coordinates and target pixel value of the target pixel are determined, as well as the first pixel coordinates and first pixel values ​​of a plurality of horizontally adjacent first pixels, and the second pixel coordinates and second pixel values ​​of a plurality of vertically adjacent second pixels; the plurality of horizontally adjacent first pixels include two first pixels that are horizontally adjacent to the target pixel to the left and right; the plurality of vertically adjacent second pixels include two second pixels that are vertically adjacent to the target pixel to the top and bottom. Based on the target pixel value and the first pixel value, a first cosine parameter is determined; this includes calculating the first cosine parameter using the following formula: In the formula, w1 The parameter of the first cosine is... gray1 and gray3 These are the first pixel values ​​of the two first pixel points, respectively. gray2 The target pixel value of the target pixel point; Based on the target pixel value, the first pixel value, the first cosine parameter, and the azimuth angle of the target pixel, a second cosine parameter is determined; wherein, the second cosine parameter is calculated using the following formula: In the formula, θ1 This is the second cosine parameter. atan 2 represents the azimuth angle of the target pixel; The abscissa of the fiber center is determined based on the first cosine parameter and the second cosine parameter; this includes calculating the abscissa using the following formula: In the formula, x 0 is the x-coordinate. x 2 is the x-coordinate of the target pixel coordinates, where, The value is accurate to the decimal point. x 2 is an integer; Based on the target pixel value and the second pixel value, a third cosine parameter is determined; this includes calculating the third cosine parameter using the following formula: In the formula, w2 The parameter of the third cosine. gray11 and gray33 These are the second pixel values ​​of the two second pixel points, respectively. gray2 The target pixel value of the target pixel point; Based on the target pixel value, the second pixel value, the third cosine parameter, and the azimuth angle of the target pixel, a fourth cosine parameter is determined; this includes calculating the fourth cosine parameter using the following formula: In the formula, θ2 The fourth cosine parameter is... atan 2 represents the azimuth angle of the target pixel; The ordinate of the fiber center is determined based on the third cosine parameter and the fourth cosine parameter; this includes calculating the ordinate using the following formula: In the formula, y 0 is the ordinate. y 2 is the ordinate in the target pixel coordinate system, where, The value is accurate to the decimal point. y 2 is an integer.

2. A fiber optic image correction method, characterized in that, The method includes: According to the optical fiber center positioning method of claim 1, the optical fiber center coordinates of the optical fiber unit are determined; The optical fiber image correction coefficient is determined based on the optical fiber center coordinates; The fiber optic image is corrected according to the correction coefficient.

3. A fiber optic center positioning device, characterized in that, include: An acquisition module is used to acquire an optical fiber image to be processed, wherein the optical fiber image includes an imaging area of ​​multiple optical fiber units; The determination module is used to determine the target pixel with the largest pixel value in the imaging region, as well as multiple adjacent pixels adjacent to the target pixel. The fitting module is used to determine the fiber center coordinates of the fiber unit by using a cosine curve fitting method based on the target pixel and multiple adjacent pixels, wherein the accuracy of the fiber center coordinates is at the sub-pixel level. The fitting module is specifically used to: determine the target pixel coordinates and target pixel value of the target pixel, as well as the first pixel coordinates and first pixel values ​​of a plurality of horizontally adjacent first pixels, and the second pixel coordinates and second pixel values ​​of a plurality of vertically adjacent second pixels; the plurality of horizontally adjacent first pixels include two first pixels that are horizontally adjacent to the left and right of the target pixel; the plurality of vertically adjacent second pixels include two second pixels that are vertically adjacent to the target pixel. Based on the target pixel value and the first pixel value, a first cosine parameter is determined; this includes calculating the first cosine parameter using the following formula: In the formula, w1 The parameter of the first cosine is... gray1 and gray3 These are the first pixel values ​​of the two first pixel points, respectively. gray2 The target pixel value of the target pixel point; Based on the target pixel value, the first pixel value, the first cosine parameter, and the azimuth angle of the target pixel, a second cosine parameter is determined; wherein, the second cosine parameter is calculated using the following formula: In the formula, θ1 This is the second cosine parameter. atan 2 represents the azimuth angle of the target pixel; The abscissa of the fiber center is determined based on the first cosine parameter and the second cosine parameter; this includes calculating the abscissa using the following formula: In the formula, x 0 is the x-coordinate. x 2 is the x-coordinate of the target pixel coordinates, where, The value is accurate to the decimal point. x 2 is an integer; Based on the target pixel value and the second pixel value, a third cosine parameter is determined; this includes calculating the third cosine parameter using the following formula: In the formula, w2 The parameter of the third cosine. gray11 and gray33 These are the second pixel values ​​of the two second pixel points, respectively. gray2 The target pixel value of the target pixel point; Based on the target pixel value, the second pixel value, the third cosine parameter, and the azimuth angle of the target pixel, a fourth cosine parameter is determined; this includes calculating the fourth cosine parameter using the following formula: In the formula, θ2 The fourth cosine parameter is... atan 2 represents the azimuth angle of the target pixel; The ordinate of the fiber center is determined based on the third cosine parameter and the fourth cosine parameter; this includes calculating the ordinate using the following formula: In the formula, y 0 is the ordinate. y 2 is the ordinate in the target pixel coordinate system, where, The value is accurate to the decimal point. y 2 is an integer.

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

5. 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 fiber optic center positioning method of claim 1, or the fiber optic image correction method of claim 2.

Citation Information

Patent Citations

  • Light spot detection method and device and electronic equipment

    CN110930351A

  • Two-dimensional autocollimator and image positioning calculation method and device based on two-dimensional autocollimator

    CN114111570A