A method for measuring camera definition SFR based on LabVIEW
Through the camera definition SFR measurement method based on LabVIEW, the image is automatically recognized and processed, and the modulation transfer function is calculated, which solves the problems of low efficiency and poor compatibility in the existing technology, and achieves more efficient and flexible camera definition measurement.
Patent Information
- Application Number
- CN202011343119.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-26
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2040-11-26
AI Technical Summary
Existing camera clarity measurement methods are inefficient, time-consuming, compatibility and flexibility, especially in terms of ROI selection and device integration.
The camera definition SFR measurement method based on LabVIEW is used to automatically obtain the ROI image by identifying the edge area in the image to be measured, and use the preset algorithm to calculate the image offset and modulation transfer function to generate a measurement report.
It improves the efficiency and accuracy of camera sharpness measurement and enhances the compatibility and flexibility of the algorithm, making it easier to integrate into automated test systems.
Smart Images

Figure CN112381814B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a method for measuring the definition SFR of a camera based on LabVIEW. Background Art
[0002] With the continuous development of automotive electronic technology and the gradual development and application of ADAS intelligent driving, more and more sensors are used in automobiles. The main sensors include ultrasonic radar, millimeter wave radar, camera, etc. As the main sensor, the imaging clarity of camera is one of the most important indicators.
[0003] With the continuous development of technology, the method of measuring camera clarity has been improved to: detecting clarity by testing MTF (Modulation Transfer Function) through test equipment. Among them, the device for measuring MTF first needs a light source, which is imaged by the camera, and then a suitable image acquisition card is selected to capture the image, and the image is transmitted to the computer to analyze the light intensity distribution with special software, and finally the MTF is calculated by Fourier transform.
[0004] To measure the clarity of a camera, ISO12233-2014 defines a static picture clarity measurement method SFR (Slant Frequency Response), which is a commonly used method for measuring camera clarity. However, the existing SFR measurement method has the following problems:
[0005] (1) ROI selection: Common development tools such as Imatest, Quick MTF, and SFRmat require manual selection one by one, which takes a long time.
[0006] (2) It requires at least two times to obtain the bevel and offset, which is inefficient;
[0007] (3) Common development tools are not easy to integrate with equipment. Standard program files used in the industry, such as Imatest, Quick MTF, SFRmat, etc., have been packaged into DLL or EXE and cannot be integrated with automated equipment, which means they are not conducive to integration into automated test systems. Summary of the invention
[0008] The invention provides a method for measuring the definition SFR of a camera based on LabVIEW, which solves the technical problems of low efficiency, long time consumption, poor compatibility and poor flexibility of the existing method for measuring the definition of a camera.
[0009] In order to solve the above technical problems, the present invention provides a method for measuring the definition SFR of a camera based on LabVIEW, comprising the steps of:
[0010] S1. Identify the image to be tested according to the preset rules and obtain the corresponding pre-selected image;
[0011] S2, calculating the edge contrast of the pre-selected image, and determining whether the pre-selected image is a ROI image according to the edge contrast;
[0012] S3, calculating the image offset of the ROI image according to a preset algorithm, and correcting the ROI image according to the image offset;
[0013] S4. Calculate a corresponding modulation transfer function according to the corrected ROI image, and output a corresponding measurement report according to the modulation transfer function.
[0014] This basic solution sets preset rules. When the image to be tested is acquired, all pre-selected images can be automatically found from the image to be tested. Then, the edge contrast of the pre-selected image is calculated. According to the digital data of the edge contrast, it can be quickly determined whether the pre-selected image is a ROI image, thereby automatically screening out the ROI image in the image to be tested. It is also based on LabVIEW graphical programming, and can be secondary developed and integrated for use according to different devices, thereby improving the compatibility and flexibility of the algorithm.
[0015] In a further embodiment, step S1 comprises:
[0016] S11, reading the image to be tested, and identifying all edge areas in the image to be tested;
[0017] S12, obtaining the image coordinate positions of all the edge areas, and selecting the corresponding pre-selected image according to the image coordinate positions and a preset selection box.
[0018] This solution uses image recognition technology to pre-perform image recognition on the image to be tested with the edge area as the target area. After determining the existence of the edge area, the corresponding image coordinate position is further obtained and stored in a text file. When obtaining the pre-selected image, the text file can be directly called to capture it from the image to be tested, thereby greatly improving the algorithm execution efficiency.
[0019] In a further embodiment, step S2 comprises:
[0020] S21, performing image processing on the pre-selected image to obtain a corresponding grayscale image;
[0021] S22, respectively calculating the sum of the first pixels on one side and the sum of the second pixels on the other side of the grayscale image;
[0022] S23, comparing the first pixel and the second pixel, if the contrast between the two is greater than a preset threshold, determining that the pre-selected image is a ROI image, otherwise ending the current measurement of the pre-selected image.
[0023] This solution divides the grayscale image into two halves (one side and the other side of the grayscale image), and obtains the corresponding pixel sums respectively to obtain the first pixel sum and the second pixel sum. By performing numerical comparison, it can be determined whether there is an edge line bevel in this pre-selected image, that is, whether it is a ROI image; and a certain preset threshold is reserved to be compatible with erroneous pixel points in the image, thereby improving the fault tolerance rate of ROI image judgment.
[0024] In a further embodiment, step S3 comprises:
[0025] S31, calculating the windowing function of the ROI image according to the grayscale image;
[0026] S32, performing a convolution operation on the windowing function to obtain the center point coordinates of each row of pixels in the ROI image;
[0027] S33, substituting all the center point coordinates into a preset algorithm to obtain the slope and intercept of the hypotenuse of the edge line in the ROI image;
[0028] S34: Correct the ROI image according to the slope and the intercept.
[0029] This solution uses convolution operation to specifically obtain the center point coordinates of each row of pixels in the ROI image, and substitutes all the center point coordinates based on the preset algorithm to obtain the slope and intercept of the hypotenuse of the edge line in the ROI image, which can further improve the accuracy of the algorithm.
[0030] In a further embodiment, step S34 includes:
[0031] S34a, calculating the inclination angle of the hypotenuse of the edge line according to the slope;
[0032] S34b, rotating the coordinate axis of the ROI image according to the tilt angle.
[0033] This solution uses the slope calculated from the center point coordinates as the basic data to calculate the inclination angle of the hypotenuse of the edge line. According to the consistency relationship between the hypotenuse of the edge line and the ROI image, the ROI image can be corrected directly using the inclination angle as the coordinate axis to adjust the amplitude. From line to surface, the algorithm is simple and the image correction efficiency is high.
[0034] In a further embodiment, step S4 comprises:
[0035] S41, calculating the edge spread function of the modified ROI image;
[0036] S42, deriving the edge spread function to calculate a corresponding line spread function;
[0037] S43, performing Fourier transform algorithm processing on the line spread function to obtain a modulation transfer function.
[0038] S44, determining the imaging clarity of the camera corresponding to the image to be measured according to the modulation transfer function, and outputting a corresponding measurement report.
[0039] In a further embodiment, the step S44 includes:
[0040] S44a, selecting a plurality of important parameter values from the modulation transfer function;
[0041] S44b, comparing the important parameter value with a preset standard table, integrating the comparison result and the important parameter value, and obtaining a measurement report corresponding to the camera imaging clarity of the image to be measured.
[0042] In a further embodiment, the important parameter values include MTF50 value, MTF50P value, and MTF30 value;
[0043] The preset standard table at least includes industry classification levels of imaging clarity and corresponding value ranges.
[0044] This solution gradually calculates the edge spread function, line spread function, and modulation transfer function based on the edge line hypotenuse in the corrected ROI image, and describes the image contrast from another perspective by means of spatial resolution, so that the modulation transfer function is used as a judgment standard for the imaging clarity of the camera corresponding to the image to be tested;
[0045] Directly set the preset standard table to divide the clear imaging clarity industry classification levels and one-to-one corresponding value ranges. After extracting multiple important parameter values (MTF50 value, MTF50P value, MTF30 value) from the modulation transfer function according to industry rules, and comparing them with the preset standard table, it can intuitively reflect the corresponding camera's imaging clarity level and quickly obtain measurement results.
[0046] In a further embodiment, the preset algorithm is the least squares method.
[0047] This solution uses the least square method to calculate the slope and intercept of the hypotenuse of the edge line in the ROI image, which can simplify the calculation steps and improve the calculation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1It is a workflow diagram of a method for measuring camera definition SFR based on LabVIEW provided by an embodiment of the present invention;
[0049] Figure 2 is a schematic diagram of a frame selection of a pre-selected image provided by an embodiment of the present invention;
[0050] Figure 3 is a schematic diagram of calculating edge contrast provided by an embodiment of the present invention;
[0051] Figure 4 is a schematic diagram of the curve distribution of the edge spread function provided by an embodiment of the present invention;
[0052] Figure 5 is a schematic diagram of the curve distribution of the line spread function provided by an embodiment of the present invention;
[0053] Figure 6 It is a schematic diagram of the curve distribution of the modulation transfer function provided by the embodiment of the present invention.
[0054] Figure 7 It is a schematic diagram of measurement results of the prior art provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The following specifically illustrates the implementation mode of the present invention in conjunction with the accompanying drawings. The embodiments are provided for illustrative purposes only and cannot be understood as limiting the present invention. The accompanying drawings are provided for reference and illustration only and do not constitute a limitation on the scope of patent protection of the present invention, because many changes can be made to the present invention without departing from the spirit and scope of the present invention.
[0056] The embodiment of the present invention provides a method for measuring the camera definition SFR based on LabVIEW, such as Figure 1 As shown, in this embodiment, steps S1 to S4 are included:
[0057] S1. Identify the image to be tested according to the preset rules and obtain the corresponding pre-selected image. Figure 2 , including steps S11 to S12:
[0058] S11, reading the image to be tested, and identifying all edge areas in the image to be tested;
[0059] S12, obtaining the image coordinate positions of all edge areas, and selecting corresponding pre-selected images according to the image coordinate positions and a preset selection box.
[0060] The preset selection box is Figure 2 The dotted box in the figure is a selection box of fixed size, such as a square or rectangular selection box. The specific shape and size can be set according to user needs.
[0061] This embodiment uses image recognition technology to pre-perform image recognition on the image to be tested with the edge area as the target area. After determining the existence of the edge area, the corresponding image coordinate position is further obtained and stored in a text file. When obtaining the pre-selected image, the text file can be directly called to capture it from the image to be tested, thereby greatly improving the algorithm execution efficiency.
[0062] S2. Calculate the edge contrast of the pre-selected image, and determine whether the pre-selected image is a ROI image according to the edge contrast, see Figure 3 , including steps S21 to S23:
[0063] S21, performing image processing on the pre-selected image to obtain a corresponding grayscale image;
[0064] S22, respectively calculating the first pixel sum on one side and the second pixel sum on the other side of the grayscale image.
[0065] Specifically, when the framed grayscale image includes 10 columns / rows of pixels, the sum of the first five columns of pixels on the left / top side can be obtained as the first pixel sum, and the sum of the last five columns of pixels on the right / bottom side can be obtained as the second pixel sum.
[0066] S23, comparing the first pixel and the second pixel, if the contrast between the two is greater than a preset threshold, determining that the pre-selected image is a ROI image, otherwise ending the measurement of the current pre-selected image.
[0067] like Figure 3 In this embodiment, the preset threshold is set to 100, where the sum of the first pixel (the sum of the first five columns of pixels on the left, Figure 3 tleft) is 19967, the second pixel sum (the sum of the pixels in the last 5 columns on the right, Figure 3 The tright) in is 38933. By comparison, it can be seen that the pixel difference between the first pixel sum and the second pixel sum is much larger than 100. Therefore, the contrast between the two is obvious, and the pre-selected image is determined to be the ROI image.
[0068] This embodiment divides the grayscale image into two halves (one side of the grayscale image and the other side), and obtains the corresponding pixel sums respectively to obtain the first pixel sum and the second pixel sum. By performing numerical comparison, it can be determined whether there is an edge line bevel in this pre-selected image, that is, whether it is a ROI image; and a certain preset threshold is reserved to be compatible with erroneous pixel points in the image, thereby improving the fault tolerance rate of ROI image judgment.
[0069] In this embodiment, the division of the grayscale image includes upper and lower division and left and right division.
[0070] S3, calculating the image offset of the ROI image according to a preset algorithm, and correcting the ROI image according to the image offset, including steps S31 to S34:
[0071] S31, calculating the windowing function of the ROI image according to the grayscale image;
[0072] S32, performing convolution operation on the windowing function to obtain the center point coordinates of each row of pixels in the ROI image;
[0073] S33, substituting the coordinates of all the center points into a preset algorithm to obtain the slope and intercept of the hypotenuse of the edge line in the ROI image;
[0074] In this embodiment, the preset algorithm is the least squares method.
[0075] S34, correcting the ROI image according to the slope and the intercept, including steps S34a-S34b:
[0076] S34a, calculating the inclination angle of the hypotenuse of the edge line according to the slope;
[0077] S34b, rotating the coordinate axis of the ROI image according to the tilt angle.
[0078] This embodiment uses convolution operation to specifically obtain the center point coordinates of each row of pixels in the ROI image, and substitutes all the center point coordinates based on the preset algorithm to obtain the slope and intercept of the hypotenuse of the edge line in the ROI image, which can further improve the accuracy of the algorithm.
[0079] The slope calculated by the center point coordinates is used as the basic data to calculate the inclination angle of the edge line bevel. According to the consistency relationship between the edge line bevel and the ROI image, the ROI image can be directly corrected by adjusting the amplitude using the inclination angle as the coordinate axis. From line to surface, the algorithm is simple and the image correction efficiency is high.
[0080] This embodiment uses the least square method to calculate the slope and intercept of the hypotenuse of the edge line in the ROI image, which can simplify the calculation steps and improve the calculation efficiency.
[0081] S4. Calculate the corresponding modulation transfer function according to the corrected ROI image, and output the corresponding measurement report according to the modulation transfer function. Figures 4 to 6 , including S41~S44:
[0082] S41, calculating the edge spread function of the modified ROI image;
[0083] S42, deriving the edge spread function to calculate the corresponding line spread function;
[0084] S43, performing Fourier transform algorithm processing on the line spread function to obtain a modulation transfer function.
[0085] S44, determining the imaging clarity of the camera corresponding to the image to be measured according to the modulation transfer function, and outputting a corresponding measurement report, including steps S44a-S44b:
[0086] S44a, extracting a plurality of important parameter values from the modulation transfer function;
[0087] In this embodiment, the important parameter values include but are not limited to one or more of MTF50 value, MTF50P value, and MTF30 value.
[0088] S44b, comparing the important parameter values with the preset standard table, integrating the comparison results and the important parameter values, and obtaining a measurement report of the camera imaging clarity corresponding to the image to be tested.
[0089] In this embodiment, the preset standard table at least includes industry classification levels of imaging clarity and corresponding value ranges.
[0090] This embodiment gradually calculates the edge spread function, line spread function, and modulation transfer function based on the edge line hypotenuse in the corrected ROI image, and describes the image contrast from another perspective by means of spatial resolution, so that the modulation transfer function is used as a judgment standard for the imaging clarity of the camera corresponding to the image to be tested;
[0091] Directly set the preset standard table to divide the clear imaging clarity industry classification levels and one-to-one corresponding value ranges. After extracting multiple important parameter values (MTF50 value, MTF50P value, MTF30 value) from the modulation transfer function according to industry rules, and comparing them with the preset standard table, it can intuitively reflect the corresponding camera's imaging clarity level and quickly obtain measurement results.
[0092] See also Figure 4 , Figure 6 , Figure 7 ,in Figure 7 The standard software Imatest tests the same image to be tested, and the curve diagram of the line spread function and modulation transfer function obtained is shown in the figure. Figure 4 , Figure 6 and Figure 7 By comparison, the curves of the line spread function and the modulation transfer function are basically overlapped, that is, the camera definition SFR measurement method based on LabVIEW provided in this embodiment can achieve the same technical effect as the standard software Imatest, and can perform a high-precision measurement of the camera definition by analyzing the image to be tested. However, the camera definition SFR measurement method provided in this embodiment is based on LabVIEW software, which can be integrated into the test equipment for secondary development and utilization, and is more in line with the user's use needs.
[0093] The embodiment of the present invention sets preset rules, and when the image to be tested is acquired, all pre-selected images can be automatically found from the image to be tested; then the edge contrast of the pre-selected image is calculated, and whether the pre-selected image is an ROI image can be quickly determined based on the digitized data of the edge contrast, thereby automatically screening out the ROI image in the image to be tested; it is also based on LabVIEW graphical programming, and can be secondary developed and integrated for use according to different devices, thereby improving the compatibility and flexibility of the algorithm.
[0094] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A method for measuring camera definition SFR based on LabVIEW, characterized in that: Includes steps: S1. Identify the image to be tested according to the preset rules and obtain the corresponding pre-selected image; S2, calculating the edge contrast of the pre-selected image, and determining whether the pre-selected image is a ROI image according to the edge contrast; S3, calculating the image offset of the ROI image according to a preset algorithm, and correcting the ROI image according to the image offset; S4, calculating a corresponding modulation transfer function according to the corrected ROI image, and outputting a corresponding measurement report according to the modulation transfer function; The step S2 comprises: S21, performing image processing on the pre-selected image to obtain a corresponding grayscale image; S22, respectively calculating the sum of the first pixels on one side and the sum of the second pixels on the other side of the grayscale image; S23, comparing the first pixel and the second pixel, if the contrast between the two is greater than a preset threshold, determining that the pre-selected image is a ROI image, otherwise ending the current measurement of the pre-selected image.
2. A method for measuring the camera definition SFR based on LabVIEW as claimed in claim 1, characterized in that: The step S1 comprises: S11, reading the image to be tested, and identifying all edge areas in the image to be tested; S12, obtaining the image coordinate positions of all the edge areas, and selecting the corresponding pre-selected image according to the image coordinate positions and a preset selection box.
3. A method for measuring the camera definition SFR based on LabVIEW as claimed in claim 1, characterized in that: The step S3 comprises: S31, calculating the windowing function of the ROI image according to the grayscale image; S32, performing a convolution operation on the windowing function to obtain the center point coordinates of each row of pixels in the ROI image; S33, substituting all the center point coordinates into a preset algorithm to obtain the slope and intercept of the hypotenuse of the edge line in the ROI image; S34: Correct the ROI image according to the slope.
4. A method for measuring the camera definition SFR based on LabVIEW as claimed in claim 3, characterized in that: The step S34 comprises: S34a, calculating the inclination angle of the hypotenuse of the edge line according to the slope; S34b, rotating the coordinate axis of the ROI image according to the tilt angle.
5. The method for measuring the camera definition SFR based on LabVIEW as claimed in claim 1, characterized in that: The step S4 comprises: S41, calculating the edge spread function of the modified ROI image; S42, deriving the edge spread function to calculate a corresponding line spread function; S43, performing Fourier transform algorithm processing on the line spread function to obtain a modulation transfer function; S44, determining the imaging clarity of the camera corresponding to the image to be measured according to the modulation transfer function, and outputting a corresponding measurement report.
6. A method for measuring the camera definition SFR based on LabVIEW as claimed in claim 5, characterized in that: The step S44 comprises: S44a, selecting a plurality of important parameter values from the modulation transfer function; S44b, comparing the important parameter value with a preset standard table, integrating the comparison result and the important parameter value, and obtaining a measurement report corresponding to the camera imaging clarity of the image to be measured.
7. The method for measuring the camera definition SFR based on LabVIEW as claimed in claim 6, characterized in that: The important parameter values include MTF50 value, MTF50P value, and MTF30 value; The preset standard table at least includes industry classification levels of imaging clarity and corresponding value ranges.
8. The method for measuring the camera definition SFR based on LabVIEW as claimed in claim 1, characterized in that: The preset algorithm is the least squares method.
Citation Information
Patent Citations
SFR test equipment and test method thereof
CN107645657A