X corner point positioning method and device
By filtering and fitting subpixel boundary points in images in computer vision applications, the problem that traditional positioning algorithms are difficult to achieve accurate positioning is solved, high-precision positioning of X corner points is achieved, and the coordinates at the subpixel level are obtained.
Patent Information
- Application Number
- CN202510466474.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-04-15
AI Technical Summary
In computer vision applications, traditional X-angle point positioning algorithms are difficult to achieve accurate positioning, especially when the center point of the X-angle point target is unclear and there is adhesion, it is impossible to accurately obtain subpixel-level coordinates.
By obtaining pixel points in the image containing X corner points in a preset direction, filter out the subpixel points on the black and white boundary line and the white and black boundary line, and fit these boundary points separately to obtain the straight line equation, and finally solve the intersection points to obtain the X corner points and their subpixel coordinates.
The accuracy of X corner point positioning is improved, and the coordinate acquisition at the sub-pixel level is realized, meeting the needs of high-precision image processing and measurement.
Smart Images

Figure CN119991817A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision and image processing, and in particular to an X-corner point positioning method and device. Background Art
[0002] In computer vision applications, black and white X-shaped corner points are often used as positioning markers, and it is crucial to accurately obtain the coordinates of the center of such corner points. In most practical application scenarios, it is far from enough to only obtain the pixel-level corner point coordinates, and often sub-pixel accuracy is required.
[0003] However, due to the limitations of the actual manufacturing process, the center point of the X-corner target may be unclear and have a certain degree of adhesion in some application scenarios. Traditional positioning algorithms often find it difficult to achieve accurate positioning when dealing with such unclear center points, resulting in the inability to accurately obtain the sub-pixel coordinates of the center of the X-corner target. Summary of the invention
[0004] In view of this, the present invention provides, on one hand, a method for locating an X corner point, comprising: Acquire pixel points in the image containing the X corner point according to a preset direction, where the preset direction is the order in which pixel points are selected from the black and white pixel area; Respectively obtain a plurality of sub-pixel boundary points located on the black-white boundary line and the white-black boundary line in the pixel point, wherein the black-white boundary line is a boundary line from a black pixel area to a white pixel area, and the white-black boundary line is a boundary line from a white pixel area to a black pixel area; Fitting the black-white dividing line and the sub-pixel dividing points on the white-black dividing line respectively to obtain a straight line equation of the black dividing line and a straight line equation of the white dividing line; The intersection of the black-white dividing line equation and the white-black dividing line equation is obtained to obtain the X corner point and the sub-pixel coordinates of the X corner point.
[0005] Optionally, obtaining a plurality of sub-pixel boundary points located on the black-white boundary line among the pixel points includes: For the pixel points where the black pixel area transitions to the white pixel area, all the pixel points are divided into blocks, and the pixel points of the adjacent pixel areas are fitted according to the blocks to obtain a plurality of first fitting curves, wherein the pixel values of the first fitting curves are from small to large; Selecting the pixel point with the largest pixel value change on each of the first fitting curves; Perform curve fitting on the pixel points with the largest pixel value changes to obtain a number of first parabolas; The extreme value points on each first parabola are selected to obtain a plurality of sub-pixel dividing points located on the black-white dividing line.
[0006] Optionally, obtaining a plurality of sub-pixel boundary points located on the black-white boundary line among the pixel points includes: For the pixel points where the black pixel area transitions to the white pixel area, all the pixel points are divided into blocks, and the pixel points in the adjacent pixel areas in the first block of the pixel points where the two black pixel areas transition to the white pixel area are fitted in sequence to obtain two first fitting curves, wherein the pixel values of the first fitting curves are from small to large; Select the pixel points with the largest pixel value changes on the two first fitting curves respectively; Perform curve fitting on the pixel points with the largest pixel value changes to obtain two first parabolas; Selecting two extreme value points on the first parabola respectively to obtain a sub-pixel dividing point located on the black-white dividing line; Continue to fit the pixel points of the adjacent pixel areas in the remaining blocks in order until the sub-pixel boundary points located on the black-white boundary line in all blocks are obtained.
[0007] Optionally, performing curve fitting on the pixel point with the largest pixel value change to obtain a first parabola includes: Calculate the pixel difference between adjacent pixels of the pixel with the largest pixel value change; The corresponding pixel points are subjected to curve fitting according to the pixel difference to obtain a first parabola.
[0008] Optionally, if the pixel difference is greater than 0, a maximum point on the first parabola is selected to obtain a plurality of sub-pixel boundary points located on the black-white boundary line.
[0009] Optionally, obtaining a plurality of sub-pixel boundary points located on the white-black boundary line among the pixel points includes: For the pixel points where the white pixel area transitions to the black pixel area, all the pixel points are divided into blocks, and the pixel points of the adjacent pixel areas are fitted according to the blocks to obtain a plurality of second fitting curves, wherein the pixel values of the second fitting curves are arranged from large to small; Selecting the pixel point with the largest pixel value change on each of the second fitting curves; Perform curve fitting on the pixel points with the largest pixel value changes to obtain several second parabolas; The extreme value points on each second parabola are selected to obtain a number of sub-pixel boundary points located on the white-black boundary line.
[0010] Optionally, obtaining a plurality of sub-pixel boundary points located on the white-black boundary line among the pixel points includes: For the pixel points where the white pixel area transitions to the black pixel area, all the pixel points are divided into blocks, and the pixel points in the adjacent pixel areas in the first block of the pixel points where the two white pixel areas transition to the black pixel area are fitted in sequence to obtain two second fitting curves, and the pixel values of the second fitting curves are from large to small; Select the pixel points with the largest pixel value changes on the two second fitting curves respectively; Perform curve fitting on the pixel points with the largest pixel value changes to obtain two second parabolas; Select two extreme value points on the second parabola respectively to obtain a sub-pixel dividing point located on the white-black dividing line; Continue to fit the pixel points of the adjacent pixel areas in the remaining blocks in order until the sub-pixel boundary points located on the white-black boundary line in all blocks are obtained.
[0011] Optionally, performing curve fitting on the pixel point with the largest pixel value change to obtain a second parabola includes: Calculate the pixel difference between adjacent pixels of the pixel with the largest pixel value change; The corresponding pixel points are subjected to curve fitting according to the pixel difference to obtain a second parabola.
[0012] Optionally, if the pixel difference is less than 0, a minimum point on the second parabola is selected to obtain a sub-pixel boundary point located on the white-black boundary line.
[0013] A second aspect of the present invention provides an X corner point positioning device, the device comprising: a processor and a memory connected to the processor; wherein the memory stores instructions executable by the processor, and the instructions are executed by the processor so that the processor executes the above-mentioned X corner point positioning method.
[0014] The present invention firstly obtains image pixel points in an orderly and complete manner according to a preset direction, laying a comprehensive data foundation for subsequent processing; then obtains sub-pixel dividing points by screening, improves the dividing line positioning accuracy to the sub-pixel level, eliminates the interference of useless pixels, and accurately determines the positions of the black-white dividing line and the white-black dividing line; then, the sub-pixel dividing points are fitted to the black-white dividing line and the white-black straight line equations respectively, and since the intersection of the two dividing lines is the X corner point, finally, the X corner point and its sub-pixel coordinates are accurately obtained by solving the intersection of the straight line equation, which meets the requirements of high-precision image processing and measurement for X corner point positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 Schematic diagram of the process of the X corner point positioning method in an embodiment of the present invention; Figure 2 A pixel point map selected in an embodiment of the present invention; Figure 3 is a first fitting curve diagram in an embodiment of the present invention; Figure 4 is a first parabola graph in an embodiment of the present invention; Figure 5 It is a diagram of the black-white dividing line and the dividing points on the black-white dividing line in the embodiment of the present invention. DETAILED DESCRIPTION
[0017] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0019] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0020] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0021] like Figure 1 As shown, an embodiment of the present invention provides an X corner point positioning method, which is executed by an electronic device such as a computer or a server, and specifically includes: S1, obtaining pixel points in the image including the X corner point according to a preset direction, wherein the preset direction is the order of selecting pixel points in the black and white pixel regions. The black pixel region and the white pixel region do not strictly refer to pure black (pixel value is 0) and white (pixel value is 255). The black pixel region refers to an area in the image where the pixel value is at a relatively low level as a whole, and the white pixel region refers to an area in the image where the pixel value is at a relatively high level as a whole.
[0022] The preset direction can be clockwise or counterclockwise. Before obtaining the pixel points, a coordinate system is established for the image with the lower left corner of the image as the origin, such as Figure 2 As shown. Figure 2 For example, starting from the direction of the arrow and rotating clockwise, it is divided into the first black pixel area, the first white pixel area, the second black pixel area and the second white pixel area. First, pixel points are selected in the order from the first black pixel area to the first white pixel area to the second black pixel area to the second white pixel area. When selecting pixel points in the first black pixel area and the first white pixel area, a coordinate is first set as the first pixel point (such as Figure 2 11), a row of pixels can be selected according to the rule that the ordinate remains unchanged while the abscissa changes (such as Figure 2 11, 12, ..., 1n in ), and then change the ordinate, and select a row of pixels with different abscissas (such as Figure 2 21, ..., 2n in the figure), and finally obtain multiple rows of pixel points; then when selecting the second black pixel area, select the pixel points in the first vertical column (such as Figure 2 Then, the horizontal coordinate is changed and the pixel points of the first white pixel area are selected according to the rule. Similarly, the pixel points of the second white pixel area are selected according to this rule.
[0023] S2, respectively obtaining a plurality of sub-pixel boundary points located on the black-white boundary line and the white-black boundary line in the pixel point, wherein the black-white boundary line is a boundary line from a black pixel area to a white pixel area, and the white-black boundary line is a boundary line from a white pixel area to a black pixel area.
[0024] Since the pixel point selected in step S1 is not the pixel point closest to the black-white dividing line or the white-black dividing line, it is necessary to screen some sub-pixel dividing points located on the black-white dividing line and the white-black dividing line. Figure 2The dividing line M in the figure is the black-white dividing line, and the dividing line N is the black-white dividing line.
[0025] S3, respectively fitting the black-white dividing line and the sub-pixel dividing points on the white-black dividing line to obtain a straight line equation of the black dividing line and a straight line equation of the white dividing line.
[0026] The equation of the line can be fitted by the least squares method.
[0027] S4, obtaining the intersection of the black boundary line equation and the white-black boundary line equation, and obtaining the X corner point and the sub-pixel coordinates of the X corner point.
[0028] This embodiment first obtains image pixels in an orderly and complete manner in a preset direction, laying a comprehensive data foundation for subsequent processing; then obtains sub-pixel dividing points by screening, improves the dividing line positioning accuracy to the sub-pixel level, eliminates the interference of useless pixels, and accurately determines the positions of the black-white dividing line and the white-black dividing line; then fits the sub-pixel dividing points to the black-white dividing line and the white-black straight line equations respectively, and since the intersection of the two dividing lines is the X corner point, finally the X corner point and its sub-pixel coordinates are accurately obtained by solving the intersection of the straight line equation, which meets the requirements of high-precision image processing and measurement for X corner point positioning.
[0029] In one embodiment, the step S2 of obtaining a plurality of sub-pixel boundary points located on the black-white boundary line in the pixel point specifically includes: S211a, for pixel points transitioning from a black pixel area to a white pixel area, all pixel points are divided into blocks, and pixel points in adjacent pixel areas are fitted according to the blocks to obtain a plurality of first fitting curves, wherein the pixel values of the first fitting curves are from small to large.
[0030] S212a, selecting the pixel point with the largest pixel value change on each first fitting curve.
[0031] S213a, performing curve fitting on the pixel points with the largest pixel value changes to obtain a plurality of first parabolas.
[0032] S214a, selecting extreme value points on each first parabola to obtain a plurality of sub-pixel boundary points located on the black-white boundary line.
[0033] Specifically, Figure 2 Taking the transition from the first black pixel area to the first white pixel area in the example, all the pixel points are divided into blocks according to the vertical coordinate, and the points with the same vertical coordinate are divided into the same block, such as points 11, 12, ..., 1n as a block, and points 21, ..., 2n as a block. Then, the pixel points of the same block are fitted into a curve according to the pixel values. The fitting curve reflects the change of pixel values of different pixel points in the same block. The fitting curve of one block is as follows Figure 3 As shown, the horizontal axis Pi The pixel point is the position, the horizontal axis is the pixel value, and the vertical axis is f(P i ) is the pixel value. Due to the limitations of the camera itself, the black and white boundary in the captured image is not ideal, where the individual pixels are clearly black and white. In reality, the pixel values at the edge are gradually changing. Therefore, we need to find a position with the largest change. It can be seen that the pixel values of h1 and h2 of the fitting curve have the largest change. Then the pixel point within this range is the position closest to the black and white boundary (that is, Figure 2 The green pixel in the middle), then Figure 3 The pixel points in the middle circle are fitted into the first parabola, and finally the extreme point of the first parabola is found, which is the dividing point on the black and white dividing line ( Figure 2 Then, use the above method to find the boundary points of other blocks, and the same applies to the transition from the second black pixel area to the second white pixel area. Finally, find all the boundary points on the black and white dividing line, such as Figure 5 The dividing point on the black and white dividing line.
[0034] In this embodiment, by performing block fitting on the pixel points transitioning from the black pixel area to the white pixel area, a first fitting curve that can reflect the change of pixel values from small to large is obtained, and the change of pixel values in different blocks is captured comprehensively and meticulously; then, the pixel points with the largest pixel change on each first fitting curve are selected, which not only reduces the amount of calculation, but also avoids useless points from affecting the fitting result, and can accurately locate the pixel position closest to the black-white dividing line; then, the pixel points with the largest pixel change are subjected to curve fitting to obtain a first parabola; finally, the extreme value points on each first parabola are selected to obtain the sub-pixel dividing point, thereby achieving an improvement in accuracy from the pixel level to the sub-pixel level, providing more accurate position information for accurately determining the black-white dividing line, and facilitating the subsequent more accurate completion of related tasks such as X corner point positioning.
[0035] In another embodiment, the step S2 of obtaining a plurality of sub-pixel boundary points located on the black-white boundary line in the pixel point specifically includes: S211b, for the pixel points where the black pixel area transitions to the white pixel area, all the pixel points are divided into blocks, and the pixel points in the adjacent pixel areas in the first block of the pixel points where the two black pixel areas transition to the white pixel area are fitted in sequence to obtain two first fitting curves, wherein the pixel values of the first fitting curves are from small to large.
[0036] S212b, respectively selecting the pixel points with the largest pixel value changes on the two first fitting curves.
[0037] S213b, performing curve fitting on the pixel points with the largest pixel value changes to obtain two first parabolas.
[0038] S214b, respectively selecting extreme value points on the two first parabolas to obtain sub-pixel dividing points located on the black-white dividing line.
[0039] S215b, continue to fit the pixel points of the adjacent pixel areas in the remaining blocks in order until the sub-pixel boundary points located on the black-white boundary line in all blocks are obtained.
[0040] Specifically, obtaining the sub-pixel boundary point located on the black-white dividing line also includes another method, which is also to divide all the pixel points that transition from the first black pixel area to the first white pixel area into blocks according to the vertical coordinates, and divide the pixels with the same vertical coordinates into the same block, such as points 11, 12, ..., 1n as a block, and points 21, ..., 2n as a block. Then, the pixel points that transition from the second black pixel area to the second white pixel area are divided into blocks according to the vertical coordinates, and the pixels with the same vertical coordinates are divided into the same block, such as points n1, ..., nn as a block. Then, in the order of the preset direction, the pixel points of the first layer are first processed, for example, the pixel points 11, 12, ..., 1n are fitted into a curve according to the pixel values, and then a position with the largest change is found in the curve. Then, the pixel points within the change range are the positions closest to the black-white dividing line, and then the pixel points within the range can be fitted into a first parabola. Finally, the extreme point of the first parabola is found, which is the point located on the black-white dividing line ( Figure 2 Then find the dividing points in blocks n1, ..., nn according to the above method ( Figure 2 The yellow point a2 in the middle) is found in sequence, respectively, the boundary point where the first black pixel area transitions to the second block of the first white pixel area, and the boundary point where the second black pixel area transitions to the second block of the second white pixel area, and finally all the boundary points located on the black-white boundary line are found, such as Figure 5 The dividing point on the black and white dividing line.
[0041] This embodiment fits the pixel points of the transition from two black pixel areas to white pixel areas by partitioning blocks to obtain two first fitting curves, which fully presents the change of pixel values from small to large when different black pixel areas transition, providing a basis for accurately locating the dividing line; then the pixel points with the largest pixel change on the two curves are selected, which not only reduces the amount of calculation, but also avoids useless points from affecting the fitting results, and can accurately locate the pixel position closest to the black and white dividing line; then these key pixel points are fitted into the first parabola, and then the extreme points on each first parabola are selected to obtain the sub-pixel dividing point, achieving the improvement of accuracy from the pixel level to the sub-pixel level, and providing more accurate position information for accurately determining the black and white dividing line. Repeat the operation for the remaining blocks in order to ensure that the sub-pixel dividing points in all blocks are obtained, and the black and white dividing line is completely covered, thereby providing comprehensive and accurate information for the subsequent accurate extraction of X corner points.
[0042] Furthermore, in the above steps S213a and S213b, the pixel point with the largest pixel value change is subjected to curve fitting to obtain a first parabola, which specifically includes: The pixel point with the largest pixel value change is used to calculate the pixel difference between adjacent points.
[0043] The corresponding pixel points are subjected to curve fitting according to the pixel difference to obtain a first parabola.
[0044] Specifically, Figure 3 As shown in the figure, the pixel points with the largest pixel value change are the pixels in the circle, and then the pixel values of these pixels are calculated by difference. Figure 2 Taking the green pixel points in the midpoints 11, 12, ..., 1n as an example, the pixel values are successively larger. The pixel values of adjacent pixel points can be sequentially calculated for difference and fitted to obtain the first parabola, such as Figure 4 As shown, the horizontal axis P i is the position of the pixel, the ordinate f'(P i ) is the pixel difference between the corresponding pixel and the adjacent pixel.
[0045] This embodiment can further explore the change relationship between pixel points, highlight the characteristics of pixel value change, and effectively enhance the recognizability of pixel change rules by calculating the pixel difference of adjacent points for the pixel point with the largest pixel value change. According to the pixel difference, the corresponding pixel points are curve-fitted to obtain the first parabola, which accurately describes the trend of pixel value change and makes the change relationship between pixel points more intuitive and clear. This processing method provides a more accurate data basis for the subsequent precise positioning of sub-pixel demarcation points, which helps to improve the accuracy and reliability of the entire X corner point positioning process.
[0046] Furthermore, if the pixel difference is greater than 0, a maximum point on the first parabola is selected to obtain a plurality of sub-pixel boundary points located on the black-white boundary line.
[0047] Specifically, when performing the difference calculation, due to Figure 2 The pixel values of the green pixels in the black pixel area and the white pixel area change from small to large. If the pixel value of the latter pixel is subtracted from the pixel value of the previous pixel, the pixel difference is greater than 0, and the first parabola fitted is Figure 4 As shown in , ∆1 is the minimum pixel difference, ∆2 is the maximum pixel difference, and the maximum value point indicates the position where the pixel changes the most, which is the dividing point on the black-white dividing line. However, if the difference is calculated by subtracting the previous pixel from the next pixel, the selection method is opposite to the above.
[0048] In this embodiment, a specific point on the first parabola is selected according to the pixel difference to determine the sub-pixel dividing point on the black-white dividing line. When the pixel difference is greater than 0, a maximum point on the first parabola is selected as the sub-pixel dividing point. Combined with the actual situation that the pixel value changes from small to large from the black pixel area to the white pixel area, this rule conforms to the logic of the pixel value change. The maximum point can accurately represent the position where the pixel changes the most, that is, the key position of the black-white dividing line, thereby improving the accuracy and reliability of determining the sub-pixel dividing point on the black-white dividing line, and providing a solid foundation for subsequent image processing tasks such as X corner point positioning.
[0049] In one embodiment, the step S2 of obtaining a plurality of sub-pixel boundary points located on the white-black boundary line in the pixel point specifically includes: S221a, for the pixel points where the white pixel area transitions to the black pixel area, all the pixel points are divided into blocks, and the pixel points of the adjacent pixel areas are fitted according to the blocks to obtain a plurality of second fitting curves, wherein the pixel values of the second fitting curves are arranged from large to small. S222a, selecting the pixel point with the largest pixel value change on each second fitting curve.
[0050] S223a, performing curve fitting on the pixel points with the largest pixel value changes to obtain a plurality of second parabolas.
[0051] S224a, selecting extreme value points on each second parabola to obtain a plurality of sub-pixel boundary points located on the white-black boundary line.
[0052] Specifically, when obtaining the dividing point on the white-black dividing line, the transition from the first white pixel area to the second black pixel area and the transition from the second white pixel area to the first black pixel area are mainly considered. First, the pixel image in the transition from the first white pixel area to the second black pixel area is divided into blocks, and all pixel points are divided into blocks according to the horizontal coordinate. The points with the same horizontal coordinate are divided into the same block, such as points 1n, 2n, ..., nn as a block. In this way, multiple blocks are divided, and then the pixel points of the same block are fitted into a curve according to the pixel values. The fitting curve reflects the change of pixel values of different pixel points in the same block. Due to the limitation of the camera itself, in the captured picture, the black and white boundary is not ideally black and white between single pixels. In reality, the pixel value of the edge is gradually changing, so a position with the largest change is to be found. Then the pixel points in this range are the positions closest to the black and white dividing line. Then the pixel points in this range can be fitted into a second parabola. Finally, the extreme point of the second parabola is found, which is the dividing point on the white-black dividing line. Then, the above method is used to find the boundary points of other blocks. The same is true for the transition from the second white pixel area to the first black pixel area. Finally, all the boundary points located on the white-black boundary line are found, such as Figure 5 The dividing point on the white-black dividing line.
[0053] In this embodiment, by performing block fitting on the pixel points transitioning from the white pixel area to the black pixel area, a second fitting curve that can reflect the change of pixel values from large to small is obtained, and the change of pixel values in different blocks is captured comprehensively and meticulously; then, the pixel points with the largest pixel change on each second fitting curve are selected, which not only reduces the amount of calculation, but also avoids useless points from affecting the fitting result, and can accurately locate the pixel position closest to the white-black dividing line; then, the pixel points with the largest pixel change are subjected to curve fitting to obtain a second parabola; finally, the extreme value points on each second parabola are selected to obtain the sub-pixel dividing point, thereby achieving an improvement in accuracy from the pixel level to the sub-pixel level, providing more accurate position information for accurately determining the white-black dividing line, and facilitating the subsequent more accurate completion of related tasks such as X corner point positioning.
[0054] In another embodiment, the step S2 of obtaining a plurality of sub-pixel boundary points located on the white-black boundary line in the pixel point specifically includes: S221b, for the pixel points where the white pixel area transitions to the black pixel area, all the pixel points are divided into blocks, and the pixel points in the adjacent pixel areas in the first block of the pixel points where the two white pixel areas transition to the black pixel areas are fitted in sequence to obtain two second fitting curves, and the pixel values of the second fitting curves are from large to small.
[0055] S222b, respectively selecting the pixel points with the largest pixel value changes on the two second fitting curves.
[0056] S223b, performing curve fitting on the pixel points with the largest pixel value changes to obtain two second parabolas.
[0057] S224b, respectively selecting two extreme value points on the second parabola to obtain a sub-pixel dividing point located on the white-black dividing line.
[0058] S225b, continue to fit the pixel points of the adjacent pixel areas in the remaining blocks in order until the sub-pixel boundary points located on the white-black boundary line in all blocks are obtained.
[0059] Specifically, obtaining the sub-pixel boundary point located on the white-black dividing line also includes another method, which is also to divide all the pixel points where the first white pixel area transitions to the second black pixel area into blocks according to the horizontal coordinate, and divide the pixel points with the same horizontal coordinate into the same block, such as points 1n, 2n, ..., nn as one block, and divide multiple blocks in this way, and then divide all the pixel points where the second white pixel area transitions to the first black pixel area into blocks according to the horizontal coordinate, and divide the pixel points with the same horizontal coordinate into the same block, such as points 11, 21, ..., n1 as one block. Then, in the order of the preset direction, the pixel points of the first layer are processed first, for example, the pixel points 1n, 2n, ..., nn are fitted into a curve according to the pixel values, and then a position with the largest change is found in the curve. Then the pixel points within the change range are the positions closest to the white-black dividing line. Then the pixel points within the range can be fitted into a second parabola, and finally the extreme point of the second parabola is found, which is the point on the white-black dividing line. Then, according to the above method, the dividing points in blocks 11, 21, ..., n1 are found, and the dividing points of the second block where the first white pixel area transitions to the second black pixel area and the dividing points of the second block where the second white pixel area transitions to the first black pixel area are found in sequence, and finally all the dividing points on the white-black dividing line are found, such as Figure 5 The dividing point on the white-black dividing line.
[0060] This embodiment fits the pixel points of the transition from two white pixel areas to black pixel areas by partitioning blocks to obtain two second fitting curves, which fully presents the change of pixel values from large to small when different black pixel areas transition, providing a basis for accurately locating the dividing line; then the pixel points with the largest pixel change on the two curves are selected, which not only reduces the amount of calculation, but also avoids useless points from affecting the fitting results, and can accurately locate the pixel position closest to the black and white dividing line; then these key pixel points are fitted into a second parabola, and then the extreme points on each second parabola are selected to obtain the sub-pixel dividing point, achieving an accuracy improvement from the pixel level to the sub-pixel level, and providing more accurate position information for accurately determining the white-black dividing line. Repeat the operation for the remaining blocks in order to ensure that the sub-pixel dividing points in all blocks are obtained, and the white-black dividing line is completely covered, thereby providing comprehensive and accurate information for the subsequent accurate extraction of X corner points.
[0061] Furthermore, in step S223a and step S223b, the pixel point with the largest pixel value change is subjected to curve fitting to obtain a second parabola, which specifically includes: The pixel point with the largest pixel value change is used to calculate the pixel difference between adjacent points.
[0062] The corresponding pixel points are subjected to curve fitting according to the pixel difference to obtain a second parabola.
[0063] Specifically, the pixel points with the largest pixel value change are the pixel points in the circle, and then the pixel values of these pixel points are difference calculated. The pixel values of these pixel points with the largest change are successively smaller. The pixel values of adjacent pixel points can be difference calculated in turn and fitted to obtain the second parabola.
[0064] This embodiment can further explore the change relationship between pixel points, highlight the characteristics of pixel value change, and effectively enhance the recognizability of pixel change rules by calculating the pixel difference of adjacent points for the pixel point with the largest pixel value change. According to the pixel difference, the corresponding pixel points are curve-fitted to obtain the second parabola, which accurately describes the trend of pixel value change and makes the change relationship between pixel points more intuitive and clear. This processing method provides a more accurate data basis for the subsequent precise positioning of sub-pixel demarcation points, which helps to improve the accuracy and reliability of the entire X corner point positioning process.
[0065] Furthermore, if the pixel difference is less than 0, a minimum point on the second parabola is selected to obtain a sub-pixel boundary point located on the white-black boundary line.
[0066] Specifically, when performing difference calculation, since the pixel value of the green pixel point changes from the white pixel area to the black pixel area, if the pixel value of the latter pixel point is subtracted from the pixel value of the previous pixel point, the pixel difference is less than 0, then the minimum point represents the position where the pixel change is the largest, which is the dividing point on the white-black dividing line. However, if the difference calculation is the previous pixel point minus the next pixel point, the selection method is opposite to the above.
[0067] In this embodiment, a specific point on the second parabola is selected according to the pixel difference to determine the sub-pixel dividing point on the white-black dividing line. When the pixel difference is less than 0, a minimum point on the second parabola is selected as the sub-pixel dividing point. Combined with the actual situation that the pixel value changes from large to small from the white pixel area to the black pixel area, this rule conforms to the logic of the pixel value change. The minimum point can accurately represent the position where the pixel changes the most, that is, the key position of the white-black dividing line, thereby improving the accuracy and reliability of determining the sub-pixel dividing point on the white-black dividing line, and providing a solid foundation for subsequent image processing tasks such as X corner point positioning.
[0068] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented 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.
[0069] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0070] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0071] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0072] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.
Claims
1. A method for locating an X corner point, characterized in that: include: Acquire pixel points in the image containing the X corner point according to a preset direction, where the preset direction is the order in which pixel points are selected from the black and white pixel area; Respectively obtain a plurality of sub-pixel boundary points located on the black-white boundary line and the white-black boundary line in the pixel point, wherein the black-white boundary line is a boundary line from a black pixel area to a white pixel area, and the white-black boundary line is a boundary line from a white pixel area to a black pixel area; Fitting the black-white dividing line and the sub-pixel dividing points on the white-black dividing line respectively to obtain a straight line equation of the black dividing line and a straight line equation of the white dividing line; The intersection of the black-white dividing line equation and the white-black dividing line equation is obtained to obtain the X corner point and the sub-pixel coordinates of the X corner point.
2. The method according to claim 1, characterized in that Acquiring a plurality of sub-pixel boundary points located on the black-white boundary line in the pixel point, including: For the pixel points where the black pixel area transitions to the white pixel area, all the pixel points are divided into blocks, and the pixel points of the adjacent pixel areas are fitted according to the blocks to obtain a plurality of first fitting curves, wherein the pixel values of the first fitting curves are from small to large; Selecting the pixel point with the largest pixel value change on each of the first fitting curves; Perform curve fitting on the pixel points with the largest pixel value changes to obtain a number of first parabolas; The extreme value points on each first parabola are selected to obtain a plurality of sub-pixel dividing points located on the black-white dividing line.
3. The method according to claim 2, characterized in that Acquiring a plurality of sub-pixel boundary points located on the black-white boundary line in the pixel point, including: For the pixel points where the black pixel area transitions to the white pixel area, all the pixel points are divided into blocks, and the pixel points in the adjacent pixel areas in the first block of the pixel points where the two black pixel areas transition to the white pixel area are fitted in sequence to obtain two first fitting curves, wherein the pixel values of the first fitting curves are from small to large; Select the pixel points with the largest pixel value changes on the two first fitting curves respectively; Perform curve fitting on the pixel points with the largest pixel value changes to obtain two first parabolas; Selecting two extreme value points on the first parabola respectively to obtain a sub-pixel dividing point located on the black-white dividing line; Continue to fit the pixel points of the adjacent pixel areas in the remaining blocks in order until the sub-pixel boundary points located on the black-white boundary line in all blocks are obtained.
4. The method according to claim 3, characterized in that: The pixel point with the largest pixel value change is subjected to curve fitting to obtain the first parabola, including: Calculate the pixel difference between adjacent pixels of the pixel with the largest pixel value change; The corresponding pixel points are subjected to curve fitting according to the pixel difference to obtain a first parabola.
5. The method according to claim 3, characterized in that: If the pixel difference is greater than 0, the maximum point on the first parabola is selected to obtain a plurality of sub-pixel boundary points located on the black-white boundary line.
6. The method according to claim 1, characterized in that Acquiring a plurality of sub-pixel boundary points located on the white-black boundary line in the pixel point, including: For the pixel points where the white pixel area transitions to the black pixel area, all the pixel points are divided into blocks, and the pixel points of the adjacent pixel areas are fitted according to the blocks to obtain a plurality of second fitting curves, wherein the pixel values of the second fitting curves are arranged from large to small; Selecting the pixel point with the largest pixel value change on each of the second fitting curves; Perform curve fitting on the pixel points with the largest pixel value changes to obtain several second parabolas; The extreme value points on each second parabola are selected to obtain a number of sub-pixel boundary points located on the white-black boundary line.
7. The method according to claim 6, characterized in that Acquiring a plurality of sub-pixel boundary points located on the white-black boundary line in the pixel point, including: For the pixel points where the white pixel area transitions to the black pixel area, all the pixel points are divided into blocks, and the pixel points in the adjacent pixel areas in the first block of the pixel points where the two white pixel areas transition to the black pixel area are fitted in sequence to obtain two second fitting curves, and the pixel values of the second fitting curves are from large to small; Select the pixel points with the largest pixel value changes on the two second fitting curves respectively; Perform curve fitting on the pixel points with the largest pixel value changes to obtain two second parabolas; Select two extreme value points on the second parabola respectively to obtain a sub-pixel dividing point located on the white-black dividing line; Continue to fit the pixel points of the adjacent pixel areas in the remaining blocks in order until the sub-pixel boundary points located on the white-black boundary line in all blocks are obtained.
8. The method according to claim 7, characterized in that The pixel point with the largest pixel value change is subjected to curve fitting to obtain the second parabola, including: Calculate the pixel difference between adjacent pixels of the pixel with the largest pixel value change; The corresponding pixel points are subjected to curve fitting according to the pixel difference to obtain a second parabola.
9. The method according to claim 7, characterized in that: If the pixel difference is less than 0, the minimum point on the second parabola is selected to obtain a sub-pixel boundary point located on the white-black boundary line.
10. An X-corner positioning device, characterized in that: include: A processor and a memory connected to the processor; wherein the memory stores instructions executable by the processor, and the instructions are executed by the processor so that the processor executes the X corner point positioning method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Satellite target extraction method
CN103020997A
Straight line fitting method and system with sub-pixel precision
CN115601540A
Fluorescence image registration method, gene sequencing instrument, and storage medium
US20220108462A1