Method for calibrating convex quadrilateral image, electronic device and computer readable medium
By calibrating the nearest neighbor rectangle vertices and step residuals of a convex quadrilateral in software, and combining this with hardware raster scanning, convex quadrilateral calibration without the need for multipliers in hardware was achieved. This solved the problem of complex hardware calculations and saved hardware area.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FUZHOU ROCKCHIP SEMICON
- Filing Date
- 2023-03-21
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies require complex fixed-point calibration and multiplication operations when calibrating convex quadrilaterals in hardware, which leads to increased hardware area and performance impact.
The software calibrates the coordinates of the nearest neighbor rectangle vertices and the step residual of the convex quadrilateral. The hardware calibrates the rectangular regions in the image according to the image raster scanning order and calibrates the difference region according to the residual. Finally, the hardware removes the difference region by accumulation, thus realizing the calibration of the convex quadrilateral.
The calibration of convex quadrilaterals can be achieved in hardware without the need for multipliers, saving hardware implementation area and simplifying the calculation process.
Smart Images

Figure CN116468798B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a method for calibrating a convex quadrilateral in an image, an electronic device and a computer readable medium. BACKGROUND
[0002] A convex quadrilateral refers to a quadrilateral with all interior angles less than 180 degrees. Currently, a method for calibrating a convex quadrilateral in an image by using hardware involves fixed-point operations and multiplication or even more complex operations. These operations not only increase the hardware area, but also affect the hardware performance. Calibrating a convex quadrilateral in image processing is a function of marking a region of interest (ROI). SUMMARY
[0003] The present application provides a method for calibrating a convex quadrilateral in an image, an electronic device and a computer readable medium, which can improve the performance of marking a convex quadrilateral.
[0004] In one aspect of the present application, a method for calibrating a convex quadrilateral in an image is provided. The method comprises the steps of: obtaining the vertex coordinates of a nearest neighbor rectangle of a calibrated convex quadrilateral, and obtaining the step residual between the nearest neighbor rectangle and each side of the convex quadrilateral; receiving an input image to be calibrated, and calibrating a target nearest neighbor rectangle region in the image to be calibrated according to the vertex coordinates of the nearest neighbor rectangle; calibrating a difference region between the target nearest neighbor rectangle and a target convex quadrilateral according to the step residual; and obtaining the target convex quadrilateral of the image to be calibrated according to the calibrated target nearest neighbor rectangle region and the difference region.
[0005] In another aspect of the present application, an electronic device is provided. The electronic device comprises a memory configured to store a computer program; and a processor configured to execute the computer program to perform the above-mentioned method for calibrating a convex quadrilateral in an image.
[0006] In yet another aspect of the present application, a computer readable medium is provided. The medium stores a computer program, which is executed by a processor to implement the above-mentioned method for calibrating a convex quadrilateral in an image.
[0007] According to the embodiment of the present application, in the software calibration stage, the coordinates of the 4 vertices of the nearest-neighbor rectangle of the convex quadrangle in the image are calibrated in sequence, and the step residuals of the corresponding 4 edges are calculated. In the hardware calibration stage, the processing is performed in the image raster scanning sequence, the nearest-neighbor rectangle is calibrated according to the 4 vertices of the rectangle, the difference area between each edge and the rectangle is calibrated in sequence using the step residuals of the 4 edges of the convex quadrangle, and the difference areas are excluded from the nearest-neighbor rectangle area. Thus, the function of calibrating the convex quadrangle in the image can be realized by simple calculation, and the multiplier is not needed in the hardware to calibrate the convex quadrangle, thereby greatly saving the hardware implementation area. BRIEF DESCRIPTION OF DRAWINGS
[0008] Figure 1 A flowchart of calibrating a convex quadrangle in an image according to an embodiment of the present application;
[0009] Figure 2 A flowchart of the whole according to an embodiment of the present application;
[0010] Figure 3 A convex quadrangle in software calibration according to an embodiment of the present application;
[0011] Figure 4 A convex quadrangle and its nearest-neighbor rectangle in software calibration according to an embodiment of the present application;
[0012] Figure 5 A difference area between the first edge of the convex quadrangle and the nearest-neighbor rectangle according to an embodiment of the present application;
[0013] Figure 6 A difference area between the second edge of the convex quadrangle and the nearest-neighbor rectangle according to an embodiment of the present application;
[0014] Figure 7 A difference area between the third edge of the convex quadrangle and the nearest-neighbor rectangle according to an embodiment of the present application;
[0015] Figure 8 A difference area between the fourth edge of the convex quadrangle and the nearest-neighbor rectangle according to an embodiment of the present application
[0016] Figure 9 A difference area in software calibration according to an embodiment of the present application;
[0017] Figure 10 A difference area in software calibration according to an embodiment of the present application;
[0018] Figure 11 A structure schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0019] To make the technical contents of the present application, the purposes achieved and the effects clear, the following will be described in conjunction with the embodiments and the accompanying drawings.
[0020] In the prior art, calibrating the convex quadrilateral by hardware needs to involve fixed-point operation or more complex operation such as multiplication, which affects the hardware performance.
[0021] To solve at least the above technical problems, the present disclosure provides a method for calibrating a convex quadrilateral in an image. According to the present disclosure, in the software calibration, the vertex coordinates of the nearest neighbor rectangle of the convex quadrilateral need to be calibrated, and the step residual between the nearest neighbor rectangle and each side of the convex quadrilateral needs to be calculated; after the image to be calibrated is input, in the hardware, the region of the nearest neighbor rectangle in the image to be calibrated is calibrated according to the vertex coordinates of the nearest neighbor rectangle in the order of image raster scanning, the difference region between the nearest neighbor rectangle and the convex quadrilateral is calibrated according to the step residual, and the convex quadrilateral of the image to be calibrated is obtained by removing the difference region from the calibrated nearest neighbor rectangle.
[0022] The software calibration stage is the process of configuring the calibration function of the hardware module for the upper application, which is executed by the application processor. The hardware calibration function is placed in the image signal processor (ISP) hardware module. The ISP is a hardware module specially used for image processing. The process of software calibration is the process of inputting the adjacent quadrilateral and residual data to the hardware module, so that the hardware module knows how to calibrate the input image. The step residual is equivalent to the reciprocal of the slope of a straight line. In image processing, pixels are stepped in integer units. The present solution uses it to determine whether the current pixel falls within the inner right triangle or trapezoid.
[0023] According to the embodiments of the present disclosure, the function of calibrating the convex quadrilateral in the image can be realized only by simple calculation, and the hardware does not need to use a multiplier to calibrate the convex quadrilateral, which greatly saves the hardware implementation area.
[0024] In the following, the technical solution according to the present disclosure will be described with reference to specific embodiments and in conjunction with the accompanying drawings.
[0025] Figure 1 is a flowchart showing a method 100 for calibrating a convex quadrilateral in an image according to an embodiment of the present disclosure. Referring to Figure 1 , the method 100 includes the following steps 102 to 108.
[0026] In step 102, the vertex coordinates of the nearest-neighbor rectangle of the calibrated convex quadrilateral are obtained, and the step residual between the nearest-neighbor rectangle and the edges of the convex quadrilateral is obtained. In some embodiments, the application processor sequentially labels the vertex coordinates of the convex quadrilateral in a clockwise direction starting from the coordinate with the smallest longitudinal coordinate, labels the vertex coordinates of the nearest-neighbor rectangle of the convex quadrilateral in the image raster scanning order, and calculates the step residual of the edges of the convex quadrilateral. The image signal processor receives the vertex coordinates of the nearest-neighbor rectangle and the step residual from the application processor. In this way, the vertex coordinates of the nearest-neighbor rectangle and the step residual of the edges of the convex quadrilateral are marked by software in advance, facilitating subsequent hardware calibration by accumulation.
[0027] In some embodiments, the method for calculating the step residual is as follows: the application processor calculates a first absolute value according to the horizontal coordinate difference of the two vertices of the edge of the convex quadrilateral, and calculates a second absolute value according to the longitudinal coordinate difference of the two vertices of the edge of the convex quadrilateral; the application processor divides the first absolute value by the second absolute value for each edge of the convex quadrilateral, and performs upward rounding to obtain the step residual between the nearest-neighbor rectangle and the edges of the convex quadrilateral. In this way, the step residual is equivalent to the inverse of the slope of the edge of the convex quadrilateral, facilitating subsequent determination of the difference area between the convex quadrilateral and its nearest-neighbor quadrilateral.
[0028] In step 104, an input image to be calibrated is received, and a target nearest-neighbor rectangle region in the image to be calibrated is labeled according to the vertex coordinates of the nearest-neighbor rectangle. In some embodiments, the image signal processor labels the target nearest-neighbor rectangle region in the image to be calibrated in the hardware image scanning order according to the vertex coordinates of the nearest-neighbor rectangle, and each coordinate in the labeled region falls within the rectangular range formed by the vertex coordinates of the nearest-neighbor rectangle. In this way, the labeling of the target nearest-neighbor rectangle in the hardware is completed.
[0029] In step 106, a difference area between the target nearest-neighbor rectangle and the target convex quadrilateral is labeled according to the step residual. In some embodiments, the image signal processor calculates the difference area between the edges of the convex quadrilateral and the nearest-neighbor rectangle according to the step residual and the horizontal and longitudinal coordinate difference of the two vertices of the edge of the convex quadrilateral.
[0030] Specifically, calculating the difference area between the first edge of the convex quadrilateral and the nearest-neighbor rectangle includes: when the step residual of the first edge is 0, the calculation of the first edge L0 is completed. When the step residual of the first edge is not 0, it is determined whether the horizontal coordinate of the first coordinate is less than the horizontal coordinate of the second coordinate. If yes, the coordinate in the difference area is x c >=x0+(D0*(y c -y0)) and x c <=a1; otherwise, the coordinate in the difference area is xc > = x0 - (D0 * (y c - y0)) and x c < = a1; wherein x c represents the horizontal coordinate of the coordinate in the difference region, y c represents the vertical coordinate of the coordinate in the difference region, D0 represents the step residual of the first side, x0 represents the horizontal coordinate of the first coordinate, y0 represents the vertical coordinate of the first coordinate, and a1 represents the horizontal coordinate of the second nearest-neighbor rectangular vertex.
[0031] The calculation of the difference region between the second side of the convex quadrilateral and the nearest-neighbor rectangle comprises: when the step residual of the second side is 0, the calculation of the second side L1 is completed. When the step residual of the second side is not 0, it is determined whether the vertical coordinate of the second coordinate is less than the vertical coordinate of the third coordinate. If not, the coordinate in the difference region is: x c > = a3 and x c < = x2 + (D1 * (y c - y2)) + x2 - a3; if yes, when the horizontal coordinate of the second coordinate is equal to the horizontal coordinate of the third nearest-neighbor rectangular vertex, the coordinate in the difference region is: x c > = x1 - (D1 * (y c - y1)) and x c < = a2; when the horizontal coordinate of the second coordinate is not equal to the horizontal coordinate of the third nearest-neighbor rectangular vertex, the coordinate in the difference region is: x c > = x1 + (D1 * (y c - y1)) and x c < = a2; wherein x c represents the horizontal coordinate of the coordinate in the difference region, y c represents the vertical coordinate of the coordinate in the difference region, D1 represents the step residual of the second side, x1 represents the horizontal coordinate of the second coordinate, y1 represents the vertical coordinate of the second coordinate, x2 represents the horizontal coordinate of the third coordinate, y2 represents the vertical coordinate of the third coordinate, and a2 represents the horizontal coordinate of the third nearest-neighbor rectangular vertex.
[0032] The calculation of the difference region between the third side of the convex quadrilateral and the nearest-neighbor rectangle comprises: when the step residual of the third side is 0, the calculation of the third side L2 is completed. When the step residual of the third side is not 0, it is determined whether the vertical coordinate of the third coordinate is less than the vertical coordinate of the fourth coordinate. If yes, the coordinate in the difference region is: x c > = x2 - (D2 * (y c - y2)) and x c < = a2; otherwise, when the horizontal coordinate of the fourth coordinate is equal to the horizontal coordinate of the fourth nearest-neighbor rectangular vertex, the coordinate in the difference region is: x c > = a3 and x c < = x0 - (D3 * (y cx = a0 and x c > = x0 + (D3*(y c -y0)) and x c < = x2; wherein x c represents the horizontal coordinate of the coordinate in the difference region, y c represents the vertical coordinate of the coordinate in the difference region, D2 represents the step residual of the third edge, x0 represents the horizontal coordinate of the first coordinate, y0 represents the vertical coordinate of the first coordinate, x3 represents the horizontal coordinate of the fourth coordinate, and y3 represents the vertical coordinate of the fourth coordinate.
[0033] The calculation of the difference region between the fourth edge of the convex quadrilateral and the nearest neighbor rectangle comprises: when the step residual of the fourth edge is 0, the calculation of the fourth edge L3 is completed. When the step residual of the fourth edge is not 0, it is determined whether the horizontal coordinate of the fourth coordinate is less than the horizontal coordinate of the first coordinate. If yes, the coordinate in the difference region is: x c > = a0 and x c < = x0 - (D3*(y c -y0)) + x3 - a0; otherwise, the coordinate in the difference region is: x c > = a0 and x c < = x0 + (D3*(y c -y0)); wherein x c represents the horizontal coordinate of the coordinate in the difference region, y c represents the vertical coordinate of the coordinate in the difference region, D3 represents the step residual of the fourth edge, x0 represents the horizontal coordinate of the first coordinate, y0 represents the vertical coordinate of the first coordinate, x3 represents the horizontal coordinate of the fourth coordinate, and a0 represents the horizontal coordinate of the first nearest neighbor rectangle vertex.
[0034] In this way, the marking of the difference region can be completed in hardware, and the cumulative method is used in the marking process, avoiding the use of complex calculation methods such as fixed-point operation or multiplier.
[0035] In step 108, the target convex quadrilateral of the image to be marked is obtained according to the region of the target nearest neighbor rectangle and the difference region obtained by marking. In some embodiments, the image signal processor removes the difference region corresponding to each edge of the target convex quadrilateral from the region of the target nearest neighbor rectangle to obtain the target convex quadrilateral. In this way, the convex quadrilateral can be marked in hardware without using a multiplier.
[0036] In the following, the application scenarios of the method and device for marking the convex quadrilateral of the image according to the embodiments of the present application will be described by examples.
[0037] Figure 2is a flow chart showing a method of calibrating a convex quadrilateral in an image according to an embodiment of the present application, comprising the following steps 202 to 214.
[0038] Step 202, the software calibrates the coordinates of the 4 vertices of the convex quadrilateral in a specific order.
[0039] In some embodiments, as shown in Figure 3 , the smallest image vertical y coordinate of the convex quadrilateral in the image is taken as the starting point, if there are 2 vertices with equal y coordinates and both are the smallest coordinates, then the vertex corresponding to the smallest x coordinate of the 2 vertices is taken as the starting point; secondly, the coordinates of the 4 vertices (x0, y0), (x1, y1), (x2, y2), (x3, y3) are calibrated in turn in a clockwise direction, and the corresponding 4 edges are recorded as L0, L1, L2, L3 in turn.
[0040] Step 204, the software calibrates the coordinates of the 4 vertices of the nearest neighbor rectangle corresponding to the quadrilateral.
[0041] In some embodiments, as shown in Figure 4 , the 4 vertices of the nearest neighbor rectangle are calibrated in turn in a clockwise direction from left to right and from top to bottom according to the image raster scan sequence, where a0 = a3, a1 = a2, b0 = b1, b2 = b3.
[0042] Step 206, the software calculates the step residuals of the 4 edges of the quadrilateral corresponding to the right triangle or trapezoid.
[0043] In some embodiments, as shown in Figure 4 , for the 4 edges of the quadrilateral, as many right triangles or right trapezoids are spaced between the edges as there are oblique edges, and the step residual calculation formula of these areas is D = dx / dy, and the upward rounding, where dx is the absolute value of the difference between the horizontal x coordinates of the two vertices of each edge, and dy is the absolute value of the difference between the vertical y coordinates of the two vertices of each edge. If there is a straight line that is horizontal or vertical relative to the image among the 4 edges of the quadrilateral, its step residual is recorded as D = 0. The step residuals of the 4 edges are recorded as D0, D1, D2, D3 respectively.
[0044] Step 208, input the image to be calibrated.
[0045] Step 210, the hardware calibrates the position of the nearest neighbor rectangle region in the image.
[0046] In some embodiments, the position of the nearest neighbor rectangle region in the image is calibrated, and the image raster scan sequence is scanned one line at a time from top to bottom in the horizontal direction, specifically: in the process of the image entering the image signal processing subsystem in the raster scan sequence, the current pixel point coordinates (xc ,y c (x) must satisfy the following condition. c >= a0 and x c <= a1 and y c >= b1 and y c <= b2.
[0047] Step 212: The hardware uses the step residual to define the right-angled triangle or right-angled trapezoidal shaded areas between each side of the quadrilateral and the rectangle.
[0048] In some embodiments, the step residuals of the four sides are used to form an arithmetic sequence to mark the right-angled triangles or right-angled trapezoidal regions between each side and the rectangle. Specifically, for each side of the quadrilateral, the coordinates of the two vertices of each side determine whether the arithmetic sequence increases or decreases from top to bottom of the image. Processing the four sides requires four sets of processing units to perform parallel processing, such as... Figures 5 to 8 As shown. Because the image is sequentially incremented line by line according to the raster scan order, in Figures 5 to 8 In the formula, D0*(y c -y0), D1*(y c -y2), D2*(y c -y2) and D3*(y c In hardware implementation, -y0 can be achieved simply by accumulating row by row, without the need for a multiplier.
[0049] Step 214: The hardware calculates the rectangular area, subtracting the shaded area to obtain the required convex quadrilateral area.
[0050] like Figure 9 and Figure 10 As shown, subtracting these right-angled triangles or trapezoids from the previously obtained rectangular area yields the required calibration area for the convex quadrilateral.
[0051] According to another aspect of the invention, Figure 11 This is a schematic diagram illustrating an electronic device 1100 according to an embodiment of the present invention. (Refer to...) Figure 11 The electronic device 1100 includes a memory 1102, a processor 1104, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method for calibrating a convex quadrilateral as described above.
[0052] According to another aspect of the present invention, a computer-readable medium is provided. The computer-readable medium stores a computer program that is executed by a processor to implement the method for calibrating a convex quadrilateral image as described above.
[0053] In summary, the application provides a method for calibrating a convex quadrangle in an image, which comprises the following steps: in a software calibration stage, sequentially calibrating the coordinates of the four vertices of the nearest-neighbor rectangle of the convex quadrangle in the image, and calculating the step residual of the corresponding four edges; in a hardware calibration stage, processing in the order of image raster scanning, calibrating the nearest-neighbor rectangle according to the four vertices of the nearest-neighbor rectangle; using the step residual of the four edges of the convex quadrangle to sequentially calibrate the difference area between each edge and the rectangle, and excluding the nearest-neighbor rectangle area from the difference area to obtain the convex quadrangle to be calibrated. Therefore, the function of calibrating the convex quadrangle in the image can be realized by simple calculation, and the multiplier is not needed in the hardware to calibrate the convex quadrangle, thereby greatly saving the hardware implementation area.
[0054] The above description is only an embodiment of the application, and does not limit the patent scope of the application. Any equivalent transformation or direct or indirect application in the related technical field based on the content of the specification and drawings is also included in the patent protection scope of the application.
Claims
1. A method for calibrating a convex quadrilateral in an image, characterized in that, include: Obtain the vertex coordinates of the nearest neighbor rectangle of the calibrated convex quadrilateral, and obtain the step residual between the nearest neighbor rectangle and each side of the convex quadrilateral; Receive the input image to be calibrated, and calibrate the region of the target nearest neighbor rectangle in the image to be calibrated based on the vertex coordinates of the nearest neighbor rectangle; The difference region between the target nearest neighbor rectangle and the target convex quadrilateral is determined based on the step residual. as well as The target convex quadrilateral in the image to be calibrated is obtained by using the nearest neighbor rectangle region and the difference region obtained from the calibration. The process of obtaining the step residual between the nearest neighbor rectangle and each side of the convex quadrilateral includes: in the software calibration stage, the application processor calculates the absolute value of the difference between the x-coordinates of two vertices of each side of the convex quadrilateral to obtain a first absolute value, and calculates the absolute value of the difference between the y-coordinates of two vertices of each side of the convex quadrilateral to obtain a second absolute value; the application processor divides the first absolute value of each side of the convex quadrilateral by the second absolute value and rounds it up to obtain the step residual between the nearest neighbor rectangle and each side of the convex quadrilateral; and the image signal processor receives the step residual from the application processor. The determination of the difference region between the target nearest neighbor rectangle and the target convex quadrilateral based on the step residual includes: in the hardware calibration stage, the image signal processor calculates the difference region between the target nearest neighbor rectangle and the first, second, third, and fourth sides of the target convex quadrilateral based on the step residual and the difference between the horizontal and vertical coordinates of two vertices of each side of the convex quadrilateral. The process of obtaining the target convex quadrilateral of the image to be calibrated based on the region of the target nearest neighbor rectangle obtained by calibration and the difference region includes: in the hardware calibration stage, the image signal processor removes the difference region corresponding to each side of the target convex quadrilateral from the region of the target nearest neighbor rectangle to obtain the target convex quadrilateral.
2. The method according to claim 1, characterized in that, Obtaining the vertex coordinates of the nearest neighbor rectangle of the calibrated convex quadrilateral includes: During the software calibration phase, the application processor establishes a coordinate system for the plane containing the convex quadrilateral and calibrates the convex quadrilateral. In the coordinate system, the application processor sequentially calibrates the vertex coordinates of the nearest neighbor rectangles of the convex quadrilateral according to the image raster scan order, obtaining the first, second, third, and fourth nearest neighbor rectangle vertices in sequence. The image raster scan order is from left to right and from top to bottom, and the vertical side of each nearest neighbor rectangle is parallel to the y-axis of the coordinate system, while the horizontal side is parallel to the x-axis. The image signal processor receives the vertex coordinates of the nearest neighbor rectangle from the application processor.
3. The method according to claim 2, characterized in that, The convex quadrilateral is calibrated as follows: With the horizontal direction to the left as the positive x-axis and the vertical direction downwards as the positive y-axis, the first, second, third, and fourth coordinates of the vertices of the convex quadrilateral are sequentially labeled clockwise, starting from the coordinate with the smallest ordinate. The first side of the convex quadrilateral is obtained based on the first coordinate and the second coordinate; the second side of the convex quadrilateral is obtained based on the second coordinate and the third coordinate; the third side of the convex quadrilateral is obtained based on the third coordinate and the fourth coordinate; and the fourth side of the convex quadrilateral is obtained based on the fourth coordinate and the first coordinate.
4. The method according to claim 1, characterized in that, The region of the target nearest neighbor rectangle in the image to be calibrated, based on the vertex coordinates of the nearest neighbor rectangle, includes: During the hardware calibration phase, the image signal processor calibrates the region of the target nearest neighbor rectangle in the image to be calibrated according to the vertex coordinates of the nearest neighbor rectangle and in the hardware image scanning order. Each coordinate in the calibrated region falls within the rectangular area formed by the vertex coordinates of the nearest neighbor rectangle.
5. The method according to claim 1, characterized in that, Calculating the difference region between the nearest neighbor rectangle and the first side of the target convex quadrilateral includes: Determine whether the x-coordinate of the first coordinate of a vertex of the convex quadrilateral is less than the x-coordinate of the second coordinate of a vertex of the convex quadrilateral. If so, the coordinates in the difference region are: x c >= x0+(D0*(y c -y0))andx c <= a1; Otherwise, the coordinates in the difference region are: x c >= x0-(D0*(y c -y0))andx c <= a1; In the formula, x c The x-coordinate of the coordinates in the difference region is represented by y. c The ordinate of the coordinates in the difference region is represented by D0, the step residual of the first side is represented by x0, the abscissa of the first coordinate is represented by y0, and the abscissa of the second nearest neighbor rectangle vertex is represented by a1.
6. The method according to claim 1, characterized in that, Calculating the difference region between the target nearest neighbor rectangle and the second side of the target convex quadrilateral includes: Determine whether the ordinate of the second coordinate of a vertex of the convex quadrilateral is less than the ordinate of the third coordinate of a vertex of the convex quadrilateral. If not, the coordinates in the difference region are: x c >= a3 and x c <= x2+(D1*(y c -y2))+x2-a3; If so, then when the x-coordinate of the second coordinate is equal to the x-coordinate of the third nearest neighbor rectangle vertex, the coordinates in the difference region are: x c >= x1-(D1*(y c -y1))andx c <= a2; When the x-coordinate of the second coordinate is not equal to the x-coordinate of the third nearest neighbor rectangle vertex, the coordinates in the difference region are: x c >= x1+(D1*(y c -y1))andx c <= a2; In the formula, x c The x-coordinate of the coordinates in the difference region is represented by y. c The ordinate of the coordinates in the difference region is represented by D1, the step residual of the second side is represented by x1, the abscissa of the second coordinate is represented by y1, the ordinate of the second coordinate is represented by x2, the abscissa of the third coordinate is represented by y2, the ordinate of the third coordinate is represented by a2, the abscissa of the third nearest neighbor rectangle vertex is represented by a3, and the abscissa of the fourth nearest neighbor rectangle vertex is represented by a3.
7. The method according to claim 1, characterized in that, Calculating the difference region between the target nearest neighbor rectangle and the third side of the target convex quadrilateral includes: Determine whether the ordinate of the third coordinate of a vertex of the convex quadrilateral is less than the ordinate of the fourth coordinate of a vertex of the convex quadrilateral. If so, the coordinates in the difference region are: x c >= x2-(D2*(y c -y2))andx c <= a2; Otherwise, when the x-coordinate of the fourth coordinate is equal to the x-coordinate of the fourth nearest neighbor rectangle vertex, the coordinates in the difference region are: x c >= a3 and x c <= x0-(D3*(y c -y0)); When the x-coordinate of the fourth coordinate is not equal to the x-coordinate of the fourth nearest neighbor rectangle vertex, the coordinates in the difference region are: x c >= x0+(D3*(y c -y0)) and x c <= x2; In the formula, x c The x-coordinate of the coordinates in the difference region is represented by y. c D1 represents the ordinate of the coordinates in the difference region, D2 represents the step residual of the third side, x0 represents the abscissa of the first coordinate, y0 represents the ordinate of the first coordinate, x3 represents the abscissa of the fourth coordinate, y3 represents the ordinate of the fourth coordinate, a3 represents the abscissa of the fourth nearest neighbor rectangle vertex, and a2 represents the abscissa of the third nearest neighbor rectangle vertex.
8. The method according to claim 1, characterized in that, Calculating the difference region between the target nearest neighbor rectangle and the fourth side of the target convex quadrilateral includes: Determine whether the x-coordinate of the fourth coordinate of the vertex of the convex quadrilateral is less than the x-coordinate of the first coordinate of the vertex of the convex quadrilateral. If so, the coordinates in the difference region are: x c >= a0 and x c <= x0-(D3*(y c -y0))+x3-a0; Otherwise, the coordinates in the difference region are: x c >= a0 and x c <= x0+(D3*(y c -y0)); In the formula, x c The x-coordinate of the coordinates in the difference region is represented by y. c D3 represents the ordinate of the coordinates in the difference region, x0 represents the step residual of the fourth side, y0 represents the abscissa of the first coordinate, x3 represents the abscissa of the fourth coordinate, and a0 represents the abscissa of the vertex of the first nearest neighbor rectangle.
9. An electronic device, characterized in that, include: Memory, configured to store computer programs; as well as The processor is configured to execute the computer program to perform the method according to any one of claims 1 to 8.
10. A computer-readable medium having a computer program stored thereon, characterized in that, The computer program is executed by a processor to implement the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Image processor and image processing method
JP2001283242A