Method and System for Obtaining Knife-Edge Position during Camera Resolution Test
Through shooting, image processing and removing bad corner points, the blade edge position in the camera resolution test is accurately obtained, which solves the problem of inaccurate blade edge position in the prior art and improves the accuracy of the test.
Patent Information
- Application Number
- CN202310439101.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-21
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2043-04-21
AI Technical Summary
In the prior art, the acquisition of the blade position during camera resolution test is not accurate enough, resulting in unstable test results.
By taking a chart diagram, obtaining the original data map, performing image processing to obtain a grayscale map, cropping it into multiple field of view block diagrams, identifying and removing bad corner points, calculating the side length and side length tolerance, and counting the cutting edge position in the H direction and V direction.
It improves the accuracy of the position of the knife edge, avoids judgment errors caused by dirty or bad points of the camera, and ensures the accuracy of the camera resolution test.
Smart Images

Figure CN116506591B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of camera module testing, and relates to a method and system for obtaining the edge position during the resolution test of a camera. Background Art
[0002] Cameras are widely used in various fields such as mobile phones, vehicles, medical, security, and AIOT (Artificial Intelligence of Things). Before leaving the factory, camera module manufacturers need to complete the resolution test of the camera. Currently, there are mainly three mainstream evaluation methods: TVline (line pairs) detection, MTF (Modulation Transfer Function) detection, and SFR (Spatial Frequency Response) detection. TVline is mainly used for subjective testing and there is no specific standard. Different people's readings and different states will lead to unstable reading values. MTF often reflects the image contrast at a certain spatial frequency. And SFR is used to measure the impact on a single image as the number of lines with increasing spatial frequency. Compared with MTF, SFR only requires a black and white bevel edge (hereinafter referred to as the edge) to approximately convert to the MTF at all spatial frequencies. Generally, one or two edges need to be obtained in the H direction and the V direction respectively. Therefore, for SFR detection, the accurate acquisition of its edge is particularly important. Summary of the Invention
[0003] Aiming at the deficiencies of the above-mentioned prior art, the technical problem to be solved by the present invention is: to provide a method and system for obtaining the edge position during the resolution test of a camera that can accurately obtain the edge position.
[0004] To achieve the above object, the present invention provides the following technical solutions:
[0005] A method for obtaining the edge position during the resolution test of a camera, comprising the following steps:
[0006] S1. Shoot a chart through the camera to obtain the original data image obtained by shooting;
[0007] S2. Process the original data image through image processing to obtain a grayscale image;
[0008] S3. Crop the grayscale image into multiple field block diagrams;
[0009] S4. Obtain the positions of the corner points in each field block diagram;
[0010] S5. Eliminate the bad corner points in each field block diagram, and calculate the side length and side length tolerance of the grids in each field block diagram;
[0011] S6. Count the edges in the H direction and the V direction in each field block diagram, and find the H-direction edge position and V-direction edge position closest to the field center in each field block diagram according to the side length and side length tolerance.
[0012] Further, the chart has grids with alternating black and white slanted and upright squares, and the inclination of the grids is 8° ± 1°.
[0013] Further, the step S3 includes the following sub-steps:
[0014] S310. Establish a rectangular coordinate system on the grayscale image;
[0015] S320. Determine the length and width dimensions of each field-of-view block diagram and the coordinates of the center of its field of view in the rectangular coordinate system;
[0016] S330. Crop the grayscale image according to the length and width dimensions of each field-of-view block diagram and the coordinates of the center of its field of view to obtain a plurality of field-of-view block diagrams.
[0017] Further, the method for determining the coordinates of the center of the field of view of each field-of-view block diagram includes the following steps:
[0018] S321. Calculate the coordinates of the center point of the grayscale image as the coordinates of the center of the field of view of a field-of-view block diagram;
[0019] S322. Take the center point of the grayscale image as the center of the circle, make a circle with the first magnification of the diagonal length of the grayscale image as the diameter, calculate the coordinates of the four intersection points obtained by the intersection of the circle and the two diagonals of the grayscale image, and take the coordinates of each of the above intersection points as the coordinates of the center of the field of view of a field-of-view block diagram; the first magnification is greater than 0.1 and less than 0.5;
[0020] S323. Take the center point of the grayscale image as the center of the circle, make a circle with the second magnification of the diagonal length of the grayscale image as the diameter, calculate the coordinates of the four intersection points obtained by the intersection of the circle and the horizontal center line and the vertical center line of the grayscale image, and take the coordinates of each of the above intersection points as the coordinates of the center of the field of view of a field-of-view block diagram; the second magnification is greater than the first magnification and less than 0.8;
[0021] S324. Take the center point of the grayscale image as the center of the circle, make a circle with the third magnification of the diagonal length of the grayscale image as the diameter, calculate the coordinates of the four intersection points obtained by the intersection of the circle and the two diagonals of the grayscale image, and take the coordinates of each of the above intersection points as the coordinates of the center of the field of view of a field-of-view block diagram; the third magnification is greater than the second magnification and less than or equal to 0.95.
[0022] Further, the step S5 includes the following sub-steps:
[0023] S510. Determine the coordinates of the corner point P i nearest to the center of its field of view in the field-of-view block diagram; i represents the serial number of the field-of-view block diagram;
[0024] S520. Calculate the corner point P iThe distance from other corner points in the field of view block diagram to find the corner point P i The nearest corner point Pn i of the coordinates, and calculate the corner point Pn i and the corner point P i The distance S between i ;
[0025] S530. Determine whether the corner point is a bad corner point according to the colors of the grids where the four extended coordinate points of each corner point are located, and eliminate the bad corner points;
[0026] S540. Determine the coordinates of the corner point P i ' that is the nearest to the center of its field of view from the remaining corner points in the field of view block diagram;
[0027] S550. Calculate the coordinates of the corner point Pn i ' that is the nearest to the corner point P i ', and calculate the corner point Pn i ' and the corner point P i ' The distance S between i ';
[0028] S560. Determine the side length tolerance according to the distance S i ', and record two corner points whose difference between the distance between the corner points and S i ' is less than the side length tolerance as an adjacent corner point pair;
[0029] S570. Divide the adjacent corner point pairs into H-direction corner point pairs and V-direction corner point pairs according to the positional relationship between the two corner points in the adjacent corner point pairs;
[0030] S580. Count the number of H-direction corner point pairs and V-direction corner point pairs respectively. When the number of H-direction corner point pairs or the number of V-direction corner point pairs is less than the preset number threshold, delete the corner point P i ', and return to execute step S540; otherwise, execute step S590;
[0031] S590. Take the distance S i ' at this time as the side length of the grid in the field of view block diagram, and obtain the side length tolerance of the field of view block diagram.
[0032] Further, in the step S520, when the distance S i is less than the predetermined distance threshold S, take S i = S; the distance threshold S is determined according to the resolution of the image, and the distance threshold S is less than the side length of the grid.
[0033] Further, in the step S530, the method for determining whether the corner point is a bad corner point according to the colors of the grids where the four extended coordinate points of the corner point are located includes the following steps:
[0034] S531. With the corner point as the center point, divide four quadrants in sequence, and respectively determine the coordinates of an extended coordinate point in each quadrant with as the extension distances in the x-axis direction and y-axis direction; where M represents an extension constant, 3 ≤ M ≤ 10;
[0035] S532. Obtain the gray values at the above four extended coordinate points. If the gray value is greater than a preset gray threshold, determine that the color of the grid where the coordinate point is located is white; otherwise, determine that the color of the grid where the coordinate point is located is black;
[0036] S533. If the colors of the grids where the extended coordinate points in two adjacent quadrants are located are the same, determine that the corner point is a bad corner point.
[0037] Further, in the step S560, the calculation formula for the side length tolerance is:
[0038]
[0039] where Side_tolerance i represents the side length tolerance of the i-th field-of-view block diagram.
[0040] Further, the step S6 includes the following sub-steps:
[0041] S610. Calculate the distances between two corner points among the remaining corner points of each field-of-view block diagram respectively; when the absolute value of the difference between the distance between two corner points and the side length of the grid in the field-of-view block diagram is less than the side length tolerance of the field-of-view block diagram, store the above two corner points as a pair of knife-edge corner points;
[0042] S620. According to the positional relationship between the two corner points in the pair of knife-edge corner points, divide the pair of knife-edge corner points into a pair of H-direction knife-edge corner points and a pair of V-direction knife-edge corner points;
[0043] S630. Calculate the midpoint coordinates of the two corner points in the pair of H-direction knife-edge corner points as the coordinates of the H-direction knife-edge center point, and calculate the midpoint coordinates of the two corner points in the pair of V-direction knife-edge corner points as the coordinates of the V-direction knife-edge center point; and count the coordinate information of the H-direction knife-edge center point and the coordinate information of the V-direction knife-edge center point;
[0044] S640. Calculate the distances from each H-direction knife-edge center point and V-direction knife-edge center point to the center of the field of view respectively;
[0045] S650. Find the H-direction knife-edge center point and V-direction knife-edge center that are closest to the center of the field of view, and obtain the H-direction knife-edge position and V-direction knife-edge position closest to each field-of-view center according to the corresponding pair of H-direction knife-edge corner points and pair of V-direction knife-edge corner points.
[0046] A system for obtaining the position of a knife edge during the resolution test of a camera, comprising
[0047] a camera module for photographing a chart to obtain an original data graph;
[0048] an image processing unit for performing image processing on the original data graph to obtain a grayscale graph;
[0049] an image cropping unit for cropping the grayscale graph into multiple field-of-view block diagrams;
[0050] a corner point recognition unit for obtaining the positions of corner points in each field-of-view block diagram;
[0051] a side length and tolerance calculation unit for removing bad corner points in each field-of-view block diagram and calculating the side lengths and side length tolerances of the grids in each field-of-view block diagram; and
[0052] a knife edge position recognition unit for counting the knife edges in the H direction and V direction in each field-of-view block diagram and finding the H-direction knife edge position and V-direction knife edge position closest to the field center in each field-of-view block diagram according to the side lengths and side length tolerances.
[0053] In the present invention, by removing bad corner points through the colors of the grids where the four extended coordinate points of the corner points are located, the phenomenon of misjudging corner points caused by camera dirt and bad points can be effectively solved. By obtaining the side length information of each field-of-view grid according to the principle of image distortion, the miscapture of the knife edge can be effectively avoided, and the knife edge position closest to the center of each field of view can be accurately and efficiently obtained, improving the accuracy of knife edge acquisition. Description of the Drawings
[0054] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0055] Figure 1 is a flowchart of the method for obtaining the position of the knife edge during the resolution test of the camera of the present invention in a preferred embodiment.
[0056] Figure 2 is a schematic diagram of a chart.
[0057] Figure 3 is a schematic diagram for determining the field center coordinates of each field-of-view block diagram.
[0058] Figure 4 is a schematic diagram after the corner points are recognized through step S4 in a field-of-view block diagram.
[0059] Figure 5 is a schematic diagram for determining the four extended coordinate points of each corner point in a field-of-view block diagram.
[0060] Figure 6 It is a flowchart of step S5.
[0061] Figure 7 It is a schematic diagram after removing bad corner points through step S5 in a field of view block diagram.
[0062] Figure 8 It is a schematic diagram of finding the two knife-edge centers with the smallest distances from the center of the field of view in the H direction and the V direction in a field of view block diagram.
[0063] Figure 9 It is a structural block diagram of the knife-edge position acquisition system during the camera resolution test of the present invention in a preferred embodiment. Detailed implementation manners
[0064] The following uses specific specific examples to illustrate the implementation manners of the present invention. The diagrams provided in the following embodiments only schematically illustrate the basic concept of the present invention. Without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0065] As Figure 1 shown, a preferred embodiment of the knife-edge position acquisition method during the camera resolution test of the present invention includes the following steps:
[0066] S1. Use a camera to capture a chart image to obtain the original data image (i.e., the original Raw image) obtained by the capture. The original Raw image is the original data obtained by the camera converting the captured light source signal into a digital signal. The Raw image can be raw8, raw10, raw12, raw14, or raw16.
[0067] As Figure 2 shown, the chart is a grid chart with alternating black and white diagonal and square blocks arranged on an SFR target board. Generally, the inclination of the grid is required to be 8° ± 1°, and the grid fills the entire image frame or at least covers the field of view to be tested. During shooting, a light source is required to provide a preset illuminance and a preset color temperature for the SFR target board. For example, the illuminance can be 650 ± 100 lux, and the color temperature can be 6000 ± 1000 K.
[0068] S2. Process the original Raw image through image processing to obtain a grayscale image. The methods adopted for image processing include image interpolation (bilinear interpolation, high-quality linear interpolation, or nearest neighbor interpolation, etc.), filtering processing (generally Gaussian filtering), and grayscale processing.
[0069] S3. Crop the grayscale image into multiple field of view block diagrams. This step may include the following sub-steps:
[0070] S310. Establish a plane rectangular coordinate system on the grayscale image. For example, asFigure 3 As shown, in this embodiment, the vertex at the upper left corner of the grayscale image is used as the origin, the horizontal rightward direction is used as the positive direction of the y-axis, and the vertical downward direction is used as the positive direction of the x-axis to establish a plane rectangular coordinate system. The size of the grayscale image is 3000×4000.
[0071] S320. Determine the length and width dimensions (roi_x i , roi_y i ) and the coordinates (x i , y i ) of the center of the field of view of each field-of-view block diagram in the plane rectangular coordinate system; where i represents the serial number of the field-of-view block diagram. For example, in this embodiment, the coordinates of the center of the field of view of each field-of-view block diagram are determined through the following steps:
[0072] S321. Calculate the coordinates of the center point of the grayscale image as the coordinates of the center of the field of view of a field-of-view block diagram; in Figure 3 , the coordinates (1500, 2000) of the center point of the grayscale image are used as the coordinates of the center of the field of view of the 0th field-of-view block diagram.
[0073] S322. Use the center point of the grayscale image as the center of the circle and use the first magnification of the diagonal length of the grayscale image as the diameter to draw a circle, calculate the coordinates of the four intersection points obtained by the intersection of the circle and the two diagonals of the grayscale image, and use the coordinates of each intersection point as the coordinates of the center of the field of view of a field-of-view block diagram respectively. The first magnification is greater than 0.1 and less than 0.5; in this embodiment, the first magnification is 0.3 times. As Figure 3 shown, the four intersection points are (1950, 1400), (1050, 1400), (1050, 2600) and (1950, 2600). Use the intersection point (1950, 1400) as the coordinates of the center of the field of view of the 1st field-of-view block diagram, use the intersection point (1050, 1400) as the coordinates of the center of the field of view of the 2nd field-of-view block diagram; use the intersection point (1050, 2600) as the coordinates of the center of the field of view of the 3rd field-of-view block diagram; use the intersection point (1950, 2600) as the coordinates of the center of the field of view of the 4th field-of-view block diagram.
[0074] S323. Use the center point of the grayscale image as the center of the circle and use the second magnification of the diagonal length of the grayscale image as the diameter to draw a circle, calculate the coordinates of the four intersection points obtained by the intersection of the circle and the horizontal center line and the vertical center line of the grayscale image, and use the coordinates of each intersection point as the coordinates of the center of the field of view of a field-of-view block diagram respectively. The second magnification is greater than the first magnification and less than 0.8; in this embodiment, the second magnification is 0.5 times. As Figure 3As shown, the four intersection points are (1500, 750), (250, 2000), (1500, 3250), and (2750, 2000) respectively. Take the intersection point (1500, 750) as the field of view center coordinates of the 5th field of view block diagram, and the intersection point (250, 2000) as the field of view center coordinates of the 6th field of view block diagram; take the intersection point (1500, 3250) as the field of view center coordinates of the 7th field of view block diagram; take the intersection point (2750, 2000) as the field of view center coordinates of the 8th field of view block diagram.
[0075] S324. Taking the center point of the grayscale image as the center of the circle, and taking the third multiple of the diagonal length of the grayscale image as the diameter to draw a circle, calculate the coordinates of the four intersection points obtained by the intersection of the circle and the two diagonals of the grayscale image, and take the coordinates of each of the above intersection points as the field of view center coordinates of a field of view block diagram respectively; the third multiple is greater than the second multiple and less than or equal to 0.95; in this embodiment, the third multiple is 0.9 times. As Figure 3 shown, the four intersection points are (300, 400), (300, 3600), (2700, 3600), and (2700, 400) respectively. Take the intersection point (300, 400) as the field of view center coordinates of the 9th field of view block diagram, and the intersection point (300, 3600) as the field of view center coordinates of the 10th field of view block diagram; take the intersection point (2700, 3600) as the field of view center coordinates of the 11th field of view block diagram; take the intersection point (2700, 400) as the field of view center coordinates of the 4th field of view block diagram.
[0076] Of course, other methods can also be used to determine the coordinates of the field of view centers of each field of view block diagram. The length and width dimensions of each field of view block diagram can be the same or different. In this embodiment, the length and width dimensions of each field of view block diagram are both (150, 200), that is, roi_x i = 150, roi_y i = 200.
[0077] S330. Crop the grayscale image according to the length and width dimensions of each field of view block diagram and the coordinates of its field of view center to obtain multiple field of view block diagrams. In this embodiment, 13 field of view block diagrams from the 0th to the 12th are obtained by cropping. Of course, more field of view block diagrams can be obtained according to actual needs.
[0078] S4. Obtain the positions of the corner points in each field of view block diagram. The corner points refer to the points that fall at the intersections of the black and white oblique square grids. In this embodiment, using the corner detection function goodFeaturesToTrack() and the sub-pixel detection function cornerSubpix() of opencv (a cross-platform computer vision and machine learning software library distributed under the BSD license), obtain all the corner point coordinates (corners_xi,j , corners_y i,j ); where j represents the serial number of the corner point in the field of view block diagram. By using the sub-pixel detection function cornerSubpix(), the corner points can be detected better. As Figure 4 shown, it is a schematic diagram of the corner points identified in a field of view block diagram. For easy viewing,[[]] Figure 4 the positions of each corner point are circled in black.[[]]
[0079] S5. Eliminate the bad corner points in each field of view block diagram, and calculate the side length Side_value i and side length tolerance Side_tolerance i of the grid in each field of view block diagram according to the image distortion principle. Bad corner points refer to the points that are not located at the intersection of black and white oblique square grids but are identified as corner points in step S4. The image distortion principle is that considering the different FOVs (field of view angles) of the camera module, some are wide-angle, ultra-wide-angle or even fish-eye. For such cases, the SFR chart shows normal in the center and distorted at the periphery, resulting in the distortion of the side length of the peripheral field of view as the field of view increases. Therefore, the principle of proximity to the center of the field of view is used to confirm the side length.[[]]
[0080] As Figure 6 shown, in this step, the method for eliminating the bad corner points in the field of view block diagram may include the following sub-steps:[[]]
[0081] S510. Determine the corner point P i closest to the center of its field of view in the field of view block diagram pi , corners_y pi ). That is, find out the corresponding corner point coordinates, which are the coordinates of corner point P i . Since i is the serial number of the field of view block diagram, it is easy to understand that P i represents the corner point closest to the center of the field of view determined in the i-th field of view block diagram; MIN{} i represents the minimum value of the distance between the corner points and the center of the field of view in the i-th field of view block diagram.[[]]
[0082] S520. Calculate the distances between corner point P i and other corner points in the field of view block diagram respectively, find the corner point Pn i closest to corner point P i (corners_x pni , corners_y pni ), and calculate the distance S i between corner point Pn i and corner point P i . The distance S iThe calculation formula is as follows:
[0083]
[0084] According to the principle of image distortion, considering that there may be dirty and defective pixels in the image, the distance S at this time i is not necessarily the side length of the skew square. To avoid the bad corner points from causing the value of the distance S i to be too small and affect the subsequent calculations, when the distance S i is less than the predetermined distance threshold S, take S i = S. The distance threshold S is determined according to the resolution of the image, and the distance threshold S is less than the side length of the grid. The value of the distance threshold S is generally adjusted according to the image resolution. For example, when the image resolution is 3000×4000 (unit: pixel), generally take 1 / 20 of the length as the side length of the grid. Therefore, the value range of S can be 10 - 20, and the calculation method of the value range of S is as follows:
[0085]
[0086] S530. Utilize the corner points and their characteristics, and determine whether a corner point is a bad corner point according to the colors of the grids where the four extended coordinate points of each corner point are located, and eliminate the bad corner points. The method for determining whether a corner point is a bad corner point according to the colors of the grids where the four extended coordinate points of the corner point are located may include the following steps:
[0087] S531. Take the corner point as the center point, divide four quadrants in turn, and respectively determine the coordinates of an extended coordinate point in each quadrant with as the extension distance in the x-axis direction and the y-axis direction. Among them, M represents the extension constant, and the value range of M is generally: 3 ≤ M ≤ 10.
[0088] In this embodiment, take the area above the left of the corner point as the first quadrant, and take as the coordinates of the extended coordinate point in the first quadrant. Take the area above the right of the corner point as the second quadrant, and take as the coordinates of the extended coordinate point in the second quadrant. Take the area below the right of the corner point as the third quadrant, and take as the coordinates of the extended coordinate point in the third quadrant. Take the area below the left of the corner point as the fourth quadrant, and take as the coordinates of the extended coordinate point in the fourth quadrant. As shown in Figure 5 , it is a schematic diagram after obtaining the four extended coordinate points of each corner point on the basis of Figure 4 .
[0089] S532. Obtain the gray values at the above four extended coordinate points. If the gray value is greater than the preset gray threshold, determine that the color of the grid where the coordinate point is located is white; otherwise, determine that the color of the grid where the coordinate point is located is black. The judgment formula is as follows:
[0090]
[0091]
[0092]
[0093]
[0094] Among them, gray[] represents obtaining the gray value of the coordinate point; W represents the gray threshold, and the value range of W is generally: 50 ≤ W ≤ 100.
[0095] S533. If the colors of the grids where the extended coordinate points in two adjacent quadrants are located are the same, determine that the corner point is a bad corner point. That is, when the extended coordinate point S g1 and when the extended coordinate point S g2 fall within grids of the same color, determine that the corner point is a bad corner point; that is, when the extended coordinate point S g2 and when the extended coordinate point S g3 fall within grids of the same color, determine that the corner point is a bad corner point; that is, when the extended coordinate point S g3 and when the extended coordinate point S g4 fall within grids of the same color, determine that the corner point is a bad corner point; that is, when the extended coordinate point S g4 and when the extended coordinate point S g1 fall within grids of the same color, determine that the corner point is a bad corner point. When the extended coordinate point S g1 and when the extended coordinate point S g3 fall within grids of the same color, the extended coordinate point S g2 and when the extended coordinate point S g4 fall within grids of the same color, and the extended coordinate point S g1 and when the extended coordinate point S g2 fall within grids of different colors, determine that the corner point is not a bad corner point. As Figure 7 shown, it is Figure 5 a schematic diagram after removing bad corner points. Figure 5 In the middle white grid, the two corner points are identified as bad corner points and thus removed because their four extended coordinate points all fall within white grids.
[0096] After removing the bad corner points through the above steps, for some bad corner points in special cases, they still cannot be removed. For example, the corner points on the edge of the cropped field-of-view block diagram cannot be removed by the above method. For these bad corner points, they can be further removed when calculating the side length and side length tolerance of the field-of-view block diagram through the following steps.
[0097] Please continue to refer Figure 6 , in step S5, the method of obtaining the side length Side_value i and side length tolerance Side_tolerance i of the grids in the field-of-view block diagram according to the image distortion principle includes the following sub-steps:
[0098] S540. Determine the corner point P i '
[0099] (corners_x pi ', corners_y pi ) that is closest to the center of its field of view among the remaining corner points of the field-of-view block diagram. The specific method is the same as that in step S510.
[0100] S550. Calculate the coordinates of the corner point Pn i ' that is closest to the corner point P i (corners_x pni ', corners_y pni '), and calculate the distance S i ' between the corner point Pn i ' and the corner point P i '. The calculation formula for the distance S i ' is as follows:
[0101]
[0102] S560. Determine the side length tolerance according to the distance S i ', and record the two corner points whose difference between the distance between the corner points and S i ' is less than the side length tolerance as an adjacent corner point pair. The side length tolerance is set according to the Pythagorean theorem and distortion correlation, that is, considering distortion, adjacent corner points cannot be greater than Therefore, the side length tolerance can be calculated using the following formula:
[0103]
[0104] where Side_tolerance i represents the side length tolerance of the i-th field-of-view block diagram. If the absolute value of the difference between the distance between two corner points and S i ' is less than the side length tolerance, it means that the two corner points are determined to be adjacent corner points and are recorded as an adjacent corner point pair.
[0105] S570. Divide the adjacent corner point pairs into H-direction (i.e., height direction) corner point pairs and V-direction (i.e., horizontal direction) corner point pairs according to the positional relationship between the two corner points in the adjacent corner point pair. For example, an adjacent corner point pair with the absolute value of the difference in the abscissas of the two corner points less than the absolute value of the difference in the ordinates can be recorded as an H-direction corner point pair, and an adjacent corner point pair with the absolute value of the difference in the abscissas of the two corner points greater than the absolute value of the difference in the ordinates can be recorded as a V-direction corner point pair. Suppose an adjacent corner point pair includes corner point A (corners_x A , corners_y A ) and corner point B (corners_x B , corners_y B ). When
[0106] |corners_x A - corners_x B | < |corners_y A - corners_y B |, it is recorded as an H-direction corner point pair; when |corners_x A - corners_x B | > |corners_y A - corners_y B |, it is recorded as a V-direction corner point pair.
[0107] S580. Respectively count the number S i '_left_cnt of the H-direction corner point pairs and the number S i '_ringt_cnt of the V-direction corner point pairs. When at least one of the values of S i '_left_cnt and S i '_ringt_cnt is less than the preset quantity threshold, it indicates that the corner point P i ' is a bad corner point. Delete the corner point P i ', and return to execute step S540 to re-determine the corner point P i '. Otherwise, it indicates that the corner point P i ' is not a bad corner point, and execute step S590. The quantity threshold can be determined according to actual requirements. When it is required to set one H-direction edge and one V-direction edge for each field-of-view block diagram, the quantity threshold can be set to "1"; when it is required to set two H-direction edges and two V-direction edges for each field-of-view block diagram, the quantity threshold can be set to "2".
[0108] S590. Take the distance S i ' at this time as the final side length Side_value i of the grid in the field-of-view block diagram., and obtain the side tolerance Side_tolerance of the field-of-view block diagram i .
[0109] S6. Count the edges in the H direction and V direction in each field-of-view block diagram, and obtain the positions of the H-direction edge closest to the field center and the V-direction edge closest to the field center in each field-of-view block diagram based on the side length and the side tolerance, so as to obtain the black and white hypotenuse edges required for SFR detection. This step may include the following sub-steps:
[0110] S610. Calculate the distances between two of the remaining corner points in each field-of-view block diagram respectively; when the absolute value of the difference between the distance between two corner points and the side length of the grid in the field-of-view block diagram is less than the side tolerance of the field-of-view block diagram, store the above two corner points as a pair of edge corner points.
[0111] S620. Divide the pair of edge corner points into a pair of H-direction edge corner points and a pair of V-direction edge corner points according to the positional relationship between the two corner points in the pair of edge corner points. For example, a pair of edge corner points with the absolute value of the difference in the abscissas of the two corner points less than the absolute value of the difference in the ordinates can be recorded as a pair of H-direction edge corner points, and a pair of edge corner points with the absolute value of the difference in the abscissas of the two corner points greater than the absolute value of the difference in the ordinates can be recorded as a pair of V-direction edge corner points.
[0112] S630. Calculate the midpoint coordinates of the two corner points in the pair of H-direction edge corner points as the coordinates of the center point of the H-direction edge, and calculate the midpoint coordinates of the two corner points in the pair of V-direction edge corner points as the coordinates of the center point of the V-direction edge. Suppose a pair of edge corner points includes corner point C (corners_x C ,corners_y C ) and corner point D (corners_x D ,corners_y D ), then the coordinates of the center point of the edge are and count the coordinate information of the center points of the H-direction edges and the coordinate information of the center points of the V-direction edges.
[0113] S640. Calculate the distances from the center points of each H-direction edge and the center points of each V-direction edge to the field center respectively.
[0114] S650. According to the principle of the nearest distance, find the center point of the H-direction knife edge with the minimum distance from the center of the field of view. Based on the corresponding H-direction knife-edge corner point pair, obtain the H-direction knife-edge position closest to the center of the field of view. Find the center of the V-direction knife edge with the minimum distance from the center of the field of view. Based on the corresponding V-direction knife-edge corner point pair, obtain the V-direction knife-edge position closest to the center of the field of view. Of course, when two H-direction knife edges and two V-direction knife edges are required in the subsequent process, the center point of the H-direction knife edge with the second smallest distance from the center of the field of view can be further found. Based on the corresponding H-direction knife-edge corner point pair, obtain the H-direction knife-edge position with the second smallest distance from the center of the field of view. Find the center of the V-direction knife edge with the second smallest distance from the center of the field of view. Based on the corresponding V-direction knife-edge corner point pair, obtain the V-direction knife-edge position with the second smallest distance from the center of each field of view. As Figure 8 shown, the white dots in the two white frames are the centers of the two H-direction knife edges with the closest distance to the center of the field of view, the white dots in the two gray frames are the centers of the two V-direction knife edges with the closest distance to the center of the field of view, and the remaining white dot is the center of the field of view.
[0115] As Figure 9 shown, a preferred embodiment of the knife-edge position acquisition system during the camera resolution test of the present invention includes a camera module, an image processing unit, an image cropping unit, a corner point recognition unit, a side length and tolerance calculation unit, and a knife-edge position recognition unit. The camera module is used to capture the original Raw image of the chart, that is, to execute step S1 in the embodiment of the above-mentioned knife-edge position acquisition method. The image processing unit is used to perform image processing on the original Raw image to obtain a grayscale image; that is, to execute step S2 in the embodiment of the above-mentioned knife-edge position acquisition method. The image cropping unit is used to crop the grayscale image into multiple field-of-view block diagrams; that is, to execute step S3 in the embodiment of the above-mentioned knife-edge position acquisition method. The corner point recognition unit is used to obtain the positions of the corner points in each field-of-view block diagram; that is, to execute step S4 in the embodiment of the above-mentioned knife-edge position acquisition method. The side length and tolerance calculation unit is used to eliminate the bad corner points in each field-of-view block diagram and calculate the side length and side length tolerance of the grids in each field-of-view block diagram; that is, to execute step S5 in the embodiment of the above-mentioned knife-edge position acquisition method. The knife-edge position recognition unit is used to count the H-direction and V-direction knife edges in each field-of-view block diagram and find the H-direction knife-edge position and V-direction knife-edge position closest to the center of the field of view in each field-of-view block diagram according to the side length and side length tolerance; that is, to execute step S6 in the embodiment of the above-mentioned knife-edge position acquisition method.
[0116] In this embodiment, the bad corner points are judged by the colors of the grids where the four extended coordinate points of the corner points are located, which can effectively solve the phenomenon of misjudging corner points caused by camera dirt and bad points, and effectively eliminate the bad corner points. By obtaining the side length information of each field-of-view grid according to the image distortion principle, the bad corner points in the middle area of the field-of-view block diagram can be further removed, and the influence of the edge corner points of the field-of-view block diagram can be effectively excluded, so as to avoid mis-grasping the edge of the blade, accurately and efficiently obtain the position of the blade closest to the center of each field of view, and improve the accuracy of subsequent camera resolution tests such as SFR detection.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the purpose and scope of the present technical solution, and they should all be covered by the scope of the claims of the present invention.
Claims
1. A method for obtaining the position of a knife edge during the resolution test of a camera, characterized in that, It includes the following steps: S1. Shoot the chart diagram through a camera to obtain the original data diagram obtained by shooting; S2. Process the original data diagram through image processing to obtain a grayscale diagram; S3. Crop the grayscale diagram into multiple field block diagrams; S4. Obtain the positions of the corner points in each field block diagram; S5. Eliminate the bad corner points in each field block diagram, and calculate the side length and side length tolerance of the grids in each field block diagram. The side length tolerance is set according to the Pythagorean theorem and distortion correlation. This step includes the following sub-steps: S510. Determine the corner point closest to the center of its field of view in the field of view block diagram P i of the coordinates; i indicating the serial number of the field of view block diagram; S520. Calculate the corner points separately P i and the distances to other corner points in the field-of-view block diagram, and find the corner point P i nearest to the corner point Pn i and calculate the coordinates of the corner point Pn i and the distance between the corner point P i ; S i ; S530. Determine whether the corner point is a bad corner point according to the color of the grid where the four extended coordinate points of each corner point are located, and eliminate the bad corner points; S540. Determine the corner point closest to the center of its field of view from the remaining corner points in the field of view block diagram. P i ' of the coordinates; S550, Calculate the off-corner point P i ' The nearest corner point Pn i ' of the coordinates, and calculate the corner point Pn i ' and the corner point P i ' the distance between S i ' ; S560. Determine the side length tolerance according to the distance, and record two corner points whose difference between the distance between the corner points and S i ' is less than the side length tolerance as an adjacent corner point pair; S i ' S570. Divide the adjacent corner point pairs into H-direction corner point pairs and V-direction corner point pairs according to the positional relationship between the two corner points in the adjacent corner point pairs; S580. Respectively count the number of corner point pairs in the H direction and the number of corner point pairs in the V direction. When the number of corner point pairs in the H direction or the number of corner point pairs in the V direction is less than the preset number threshold, delete the corner points P i ' , and return to execute step S540; Otherwise, execute step S590; S590. Take the distance at this time S i ' as the side length of the grid in the field-of-view block diagram, and obtain the side length tolerance of the field-of-view block diagram; S6. Count the knife edges in the H direction and V direction in each field block diagram, and find the positions of the H-direction knife edge closest to the field center and the V-direction knife edge position in each field block diagram according to the side length and side length tolerance.
2. The method for obtaining the edge position during the resolution test of the camera according to claim 1, characterized in that, The S3 step includes the following sub-steps: S310. Establish a plane rectangular coordinate system on the grayscale diagram; S320. Determine the length and width dimensions of each field block diagram and the coordinates of its field center in the plane rectangular coordinate system; S330. Crop the grayscale diagram according to the length and width dimensions of each field block diagram and the coordinates of its field center to obtain multiple field block diagrams.
3. The method for obtaining the edge position during the resolution test of the camera according to claim 2, wherein: In the step S520, when the distance S i is less than a predetermined distance threshold S , take S i =S ; the distance threshold S is determined according to the resolution of the image, and the distance threshold S is less than the side length of the grid.
4. The method for obtaining the edge position during the camera resolution test according to claim 2, characterized in that, In the S530 step, the method for determining whether the corner point is a bad corner point according to the color of the grid where the four extended coordinate points of the corner point are located includes the following steps: S531. With the corner point as the center point, divide four quadrants in sequence, and respectively determine the coordinates of an extended coordinate point in each quadrant with as the extension distance in the x axis direction and the y axis direction; where M represents an extension constant, 3 ≤ M ≤ 10; S532. Obtain the grayscale values at the above four extended coordinate points. If the grayscale value is greater than the preset grayscale threshold, it is determined that the color of the grid where the coordinate point is located is white; otherwise, it is determined that the color of the grid where the coordinate point is located is black; S533. If the colors of the grids where the extended coordinate points in two adjacent quadrants are located are the same, it is determined that the corner point is a bad corner point.
5. The method for obtaining the edge position during the camera resolution test according to claim 2, wherein In the S560 step, the calculation formula for the side length tolerance is: Among them, Side_tolerance i represents the i side length tolerance of the i th i field of view block diagram. It should be noted that in the translation, the specific meaning of the tags Side_tolerance , i , i etc. may need to be further determined according to the context of the patent content. They are likely specific identifiers or parameters in the patent system.
6. The method for obtaining the edge position during the camera resolution test according to any one of claims 2 to 5, characterized in that The S6 step includes the following sub-steps: S610. Calculate the distances between two of the remaining corner points in each field block diagram respectively; when the absolute value of the difference between the distance between two corner points and the side length of the grid in the field block diagram is less than the side length tolerance of the field block diagram, store the above two corner points as a pair of knife-edge corner points; S620. Divide the pair of knife-edge corner points into an H-direction pair of knife-edge corner points and a V-direction pair of knife-edge corner points according to the positional relationship between the two corner points in the pair of knife-edge corner points; S630. Calculate the midpoint coordinates of the two corner points in the H-direction pair of knife-edge corner points as the coordinates of the center point of the H-direction knife edge, and calculate the midpoint coordinates of the two corner points in the V-direction pair of knife-edge corner points as the coordinates of the center point of the V-direction knife edge; and count the coordinate information of the center points of the H-direction knife edges and the coordinate information of the center points of the V-direction knife edges; S640. Calculate the distances from each center point of the H-direction knife edge and the center point of the V-direction knife edge to the field center respectively; S650. Find the H-direction knife-edge center point and V-direction knife-edge center with the smallest distance from the center of the field of view. Based on the corresponding H-direction knife-edge corner point pairs and V-direction knife-edge corner point pairs, obtain the H-direction knife-edge position and V-direction knife-edge position closest to each field of view center.
7. The method for obtaining the edge position during the camera resolution test according to claim 2, characterized in that The method for determining the coordinates of the center of the field of view of each field of view block diagram includes the following steps: S321. Calculate the coordinates of the center point of the grayscale image as the coordinates of the center of the field of view of a field of view block diagram. S322. Take the center point of the grayscale image as the center of the circle, and use the first magnification of the diagonal length of the grayscale image as the diameter to draw a circle. Calculate the coordinates of the four intersection points obtained by the intersection of this circle and the two diagonals of the grayscale image, and use the coordinates of each intersection point as the coordinates of the center of the field of view of a field of view block diagram respectively; the first magnification is greater than 0.1 and less than 0.
5. S323. Take the center point of the grayscale image as the center of the circle, and use the second magnification of the diagonal length of the grayscale image as the diameter to draw a circle. Calculate the coordinates of the four intersection points obtained by the intersection of this circle and the horizontal center line and vertical center line of the grayscale image, and use the coordinates of each intersection point as the coordinates of the center of the field of view of a field of view block diagram respectively; the second magnification is greater than the first magnification and less than 0.
8. S324. Take the center point of the grayscale image as the center of the circle, and use the third magnification of the diagonal length of the grayscale image as the diameter to draw a circle. Calculate the coordinates of the four intersection points obtained by the intersection of this circle and the two diagonals of the grayscale image, and use the coordinates of each intersection point as the coordinates of the center of the field of view of a field of view block diagram respectively; the third magnification is greater than the second magnification and less than or equal to 0.
95.
8. The method for obtaining the knife-edge position during the camera resolution test according to claim 1, characterized in that: The chart diagram has grids with alternating black and white slanted and upright squares, and the inclination of the grids is 8° ± 1°.
9. A knife-edge position acquisition system during camera resolution testing, characterized in that: including a camera module for photographing the chart diagram to obtain an original data diagram; an image processing unit for performing image processing on the original data diagram to obtain a grayscale image; an image cropping unit for cropping the grayscale image into multiple field of view block diagrams; a corner point recognition unit for obtaining the positions of corner points in each field of view block diagram; a side length and tolerance calculation unit for eliminating bad corner points in each field of view block diagram and calculating the side length and side length tolerance of the grids in each field of view block diagram, where the side length tolerance is set according to the Pythagorean theorem and distortion correlation; and a knife-edge position recognition unit for counting the H-direction and V-direction knife-edges in each field of view block diagram and finding the H-direction knife-edge position and V-direction knife-edge position closest to the center of the field of view in each field of view block diagram according to the side length and side length tolerance; The method for eliminating bad corner points in each field of view block diagram and calculating the side length and side length tolerance of the grids in each field of view block diagram includes the following sub-steps: S510. Determine the coordinates of the corner point closest to the center of its field of view in the field of view block diagram P i ; i The serial number indicating the field of view block diagram S520. Calculate the corner points separately P i and the distances to other corner points in the field-of-view block diagram, and find the corner point P i closest to the corner point Pn i coordinates, and calculate the corner point Pn i and the corner point P i distance between S i ; S530. Determine whether a corner point is a bad corner point according to the color of the grid where the four extended coordinate points of each corner point are located, and eliminate the bad corner points; S540. Determine the corner point closest to the center of its field of view from the remaining corner points of the field of view block diagram P i ' of the coordinates; S550, Calculate the off-corner point P i ' The nearest corner point Pn i ' coordinates, and calculate the corner point Pn i ' and the corner point P i ' distance between S i ' ; S560. Determine the side length tolerance according to the distance, and record two corner points whose difference between the distance between the corner points and S i ' is less than the side length tolerance as an adjacent corner point pair; S i ' S570. Divide adjacent corner point pairs into H-direction corner point pairs and V-direction corner point pairs according to the positional relationship between the two corner points in the adjacent corner point pairs; S580. Count the number of corner point pairs in the H direction and the number of corner point pairs in the V direction respectively. When the number of corner point pairs in the H direction or the number of corner point pairs in the V direction is less than the preset number threshold, delete the corner points P i ' , and return to execute step S540; Otherwise, execute step S590; S590, at this time's distance S i ' as the side length of the grid in this field-of-view block diagram, and obtain the side length tolerance of this field-of-view block diagram.
Citation Information
Patent Citations
Angular point position acquisition method and device
CN107231553A
Multi-terminal SFR test method based on optical variable camera and test device thereof
CN115623194A