Image quality evaluation method and system during focusing process of linear array camera
By adopting local and global image quality evaluation methods during the focusing process of the line array camera, and using the grayscale and gradient curve scores of the target image, the problem of low focus adjustment accuracy is solved and the image quality and adjustment efficiency are improved.
Patent Information
- Application Number
- CN202210345986.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2042-03-31
AI Technical Summary
During the focusing process of a line array camera, it is difficult to accurately judge the image sharpness with the existing technology, resulting in low focus adjustment accuracy and affecting the shooting quality.
Using image quality evaluation methods and systems, through local and global evaluation steps, the grayscale curve and gradient curve of the target image are used for clarity scoring, and local and global clarity evaluation scores are provided to help debugging personnel adjust the focus.
It improves the accuracy and efficiency of focus adjustment of line array cameras, improves image quality, reduces the impact of noise, and enhances the accuracy and stability of evaluation.
Smart Images

Figure CN114707529B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image quality evaluation method and system during the focusing process of a linear array camera. Background Art
[0002] With the large-scale popularization of machine vision, people have higher and higher requirements for the speed and accuracy of industrial assembly lines. In practical applications, the linear array scanning system is increasingly recognized by users for its unique advantages. The most critical component of the visual part of the linear array scanning system is the linear array camera. As the name suggests, the linear array camera is in the shape of a "line". It uses a linear array image sensor. The width of the linear array camera is usually only a few pixels. For example, the commonly used line width is 1, 2, 4 or 8 pixels, but the length is several K, such as the commonly used 4K, 8K and 16K. The camera with multiple pixel widths is usually a TDI (Time Delay Integration) camera. Each time the linear array camera takes a picture, it obtains a linear image. In the case of relative motion between the object to be measured and the linear array camera, the linear array camera is used to collect images at high speed. After collecting a line each time, the object just moves to the next pixel length. The linear array camera continues to collect the next line. After a period of time, the lines are pieced together into a two-dimensional object image.
[0003] With the deep integration of image processing technology and automation technology, the application of line scan cameras is becoming more and more extensive in the inspection of printing, new energy, steel plates, wires, paper, etc. The line scan camera is placed above the object to be inspected, a linear light source is placed at a suitable installation position, and the object to be inspected is placed on the line scan motion platform, which drives it to move at a uniform speed under the line scan camera, and the line scan camera is triggered to capture images through a data acquisition card or IO signal.
[0004] Usually, line scan cameras are installed on large-scale testing and manufacturing equipment. The display device for observing and analyzing images is far away from the line scan camera being focused. Therefore, it is difficult to debug the line scan camera before shooting. It is necessary to adjust the focal length of the camera lens, the brightness of the light source, the incident direction of the light source, the movement speed of the conveyor belt, etc. In the process of adjusting the focal length, since the line scan camera only captures one or a few lines of images at a time, it is difficult for the human eye to judge the quality of the image, and it is impossible to directly adjust the focal length of the line scan camera lens based on the quality of the image; even if the object is moved to scan and capture a complete image, the image clarity can only be judged based on human subjective experience, with limited accuracy, which affects the accuracy of the focal length adjustment of the line scan camera, and ultimately affects the shooting quality of the line scan camera. Summary of the invention
[0005] The present invention provides an image quality evaluation method and system during the focusing process of a linear array camera, aiming to automatically evaluate the clarity of an image captured during the focusing process of the linear array camera for reference by debugging personnel to select the best focal length.
[0006] According to the first aspect, an embodiment provides an image quality evaluation method in a focusing process of a line array camera, which is used to evaluate the clarity of an image, and the image quality evaluation method includes a local evaluation step and a global evaluation step;
[0007] The local evaluation step comprises:
[0008] Acquire a first strip target image, wherein the first strip target image is obtained by a linear array camera taking a single shot of a stationary strip target, wherein the strip target has alternating black and white stripes;
[0009] Calculate the grayscale average value f of each column of pixels in the first strip target image i , and get the grayscale curve sequence {f i}(i=1,2,…,n), where the subscript i represents the i-th column and n represents the number of columns;
[0010] For the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i '};
[0011] Filter out the gradient value f that meets the preset conditions i ′, calculate the average value of these gradient values as the local clarity evaluation score;
[0012] The global evaluation step comprises:
[0013] Acquire a second strip target image, where the second strip target image is obtained by scanning and imaging the moving strip target by a preset number of lines using a linear array camera;
[0014] Using the polar coordinate information (ρ, θ) of the edge point in the second strip target image to calculate the offset angle α, the second strip target image is rotated by the angle α, so that the stripes in the second strip target image are perpendicular to the lower boundary of the image, where ρ is the distance between the edge point and the image origin, and θ is the angle between the line connecting the edge point and the image origin and the image X-axis;
[0015] Calculate the grayscale average value f of each column of pixels in the second strip target image after rotation i , and get the grayscale curve sequence {f i}(i=1,2,…,n);
[0016] For the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i '};
[0017] Filter out the gradient value f that meets the preset conditions i ′, and calculate the average of these gradient values as the global clarity evaluation score.
[0018] In one embodiment, the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i '},include:
[0019] The smoothing range N is preset, and the smoothing intensity coefficient σ is calculated according to the following formula:
[0020]
[0021] The gradient value f is calculated according to the following formula i ′, thereby obtaining the gray gradient curve sequence {f i ′}:
[0022]
[0023] in Indicates rounding down.
[0024] In one embodiment, the gradient value f that meets the preset conditions i ′ refers to the gradient value f that satisfies the following conditions at the same time i ′:
[0025] f i ′>f′ i-1 、f i ′>f′ i+1 、|f′|>t,
[0026] Where t is the preset threshold.
[0027] In one embodiment, the step of calculating the offset angle α by using the polar coordinate information (ρ, θ) of the edge points in the second strip target image includes:
[0028] Acquire a region of interest in the second bar target image set by a user, and acquire polar coordinate information (ρ, θ) of edge points in the region of interest;
[0029] The obtained distance ρ and angle θ are discretized to obtain the index coordinates corresponding to the polar coordinate information (ρ, θ), and the index coordinates are processed by voting counting to obtain the polar coordinate information (ρ m ,θ m ),but
[0030] In one embodiment, the step of calculating the offset angle α by using the polar coordinate information (ρ, θ) of the edge points in the second strip target image includes:
[0031] Obtaining polar coordinate information (ρ, θ) of edge points in the second strip target image;
[0032] The obtained distance ρ and angle θ are discretized to obtain the index coordinates corresponding to the polar coordinate information (ρ, θ), and the index coordinates are processed by voting counting to screen out the index coordinates whose voting values are greater than the preset voting value threshold, and the average value of the polar coordinate information corresponding to these index coordinates is calculated (ρ a ,θ a ),but
[0033] In one embodiment, the local evaluation step also includes: plotting the local clarity evaluation scores at each moment in the focusing process into a curve and sending it to a display device, so that the display device displays it for debugging personnel to view; the global evaluation step also includes: plotting the global clarity evaluation scores at each moment in the focusing process into a curve and sending it to a display device, so that the display device displays it for debugging personnel to view.
[0034] In one embodiment, the global evaluation step also includes: after obtaining the image rotation angle α, calculating the corresponding image coordinates (x0, y0) according to the polar coordinate information (ρ, θ), where x0 = ρcosθ, y0 = ρsinθ, and determining a straight line based on two points (x0-rsinα, y0+rcosα) and (x0+rsinα, y0-rcosα), and sending it to a display device for display, where r is a preset display radius.
[0035] In one embodiment, the image quality evaluation method further includes a speed adjustment step, and the speed adjustment step includes:
[0036] Acquire a circular target image, wherein the circular target image is obtained by completely scanning and imaging the moving circular target with a linear array camera, and the circular target has a circular pattern and / or a circular ring pattern;
[0037] Obtain a circle or ellipse in the circular target image, and obtain the radius R of the circle or ellipse in the X direction x and the radius R in the Y direction y , according to the constraint R x =R y Adjust the movement speed of the line scanning motion platform.
[0038] According to the second aspect, an embodiment provides an image quality evaluation system in a focusing process of a linear array camera, for evaluating the clarity of an image, characterized in that it includes a local evaluation module and a global evaluation module;
[0039] The local evaluation module comprises:
[0040] A first target image acquisition submodule, used for acquiring a first strip target image, wherein the first strip target image is obtained by a linear array camera taking a single shot of a stationary strip target, wherein the strip target has alternating black and white stripes;
[0041] The local grayscale curve acquisition submodule is used to calculate the grayscale average value f of each column of pixels in the first strip target image. i , and get the grayscale curve sequence {f i}(i=1,2,…,n), where the subscript i represents the i-th column and n represents the number of columns;
[0042] The local denoising submodule is used to denoise the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i '};
[0043] The local score calculation submodule is used to filter out the gradient value f that meets the preset conditions. i ′, calculate the average value of these gradient values as the local clarity evaluation score;
[0044] The global evaluation module includes:
[0045] A second target image acquisition submodule is used to acquire a second strip target image, where the second strip target image is obtained by scanning and imaging the moving strip target by a linear array camera for a preset number of lines;
[0046] an image rotation submodule, configured to calculate an offset angle α using the polar coordinate information (ρ, θ) of the edge point in the second strip target image, and rotate the second strip target image by the angle α so that the stripes in the second strip target image are perpendicular to the lower boundary of the image, wherein ρ is the distance between the edge point and the image origin, and θ is the angle between the line connecting the edge point and the image origin and the image X-axis;
[0047] The global grayscale curve acquisition submodule is used to calculate the grayscale average value f of each column of pixels in the second strip target image after rotation. i , and get the grayscale curve sequence {f i}(i=1,2,…,n);
[0048] The global denoising submodule is used to denoise the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i '};
[0049] The global score calculation submodule is used to filter out the gradient values f that meet the preset conditions. i ′, and calculate the average of these gradient values as the global clarity evaluation score.
[0050] According to the image quality evaluation method and system during the focusing process of the line array camera in the above-mentioned embodiment, image quality evaluation is performed at two scales through images captured by the line array camera when the target is stationary and when it is moving. Local quality evaluation is performed using images when the target is stationary, and global quality evaluation is performed using relatively complete images captured when the target is moving. The clarity of the image captured by the line array camera can be evaluated from both local and global aspects. The debugging personnel can first make a rough adjustment according to the local clarity evaluation score to adjust the focal length to an approximate position, and then make a fine adjustment according to the global clarity evaluation score, which is conducive to improving the accuracy of the focus adjustment of the line array camera, improving the quality of the image captured by the line array camera, and ensuring the imaging effect of the image; at the same time, since denoising is performed during the processing, the influence of noise can be reduced, and the accuracy and stability of the image quality evaluation can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 is a schematic diagram of a strip target in an embodiment;
[0052] Figure 2 A flowchart of a local evaluation step in an embodiment;
[0053] Figure 3 is a schematic diagram of a grayscale curve obtained in an embodiment;
[0054] Figure 4 is a schematic diagram of a grayscale gradient curve obtained in an embodiment;
[0055] Figure 5 A schematic diagram showing a grayscale curve and a grayscale gradient curve placed in the same figure in an embodiment;
[0056] Figure 6 is a flow chart of a global evaluation step in an embodiment;
[0057] Figure 7 It is a schematic diagram of the target's moving direction during motion shooting;
[0058] Figure 8 is a second strip target image captured in one embodiment;
[0059] Fig. 9 is a schematic diagram of a circular target in one embodiment;
[0060] Fig.10 A flow chart of a speed adjustment step in one embodiment;
[0061] Fig.11 is a structural schematic diagram of an image quality evaluation system during a focusing process of a line array camera in an embodiment;
[0062] Fig.12 FIG. 4 is a schematic diagram of the structure of an image quality evaluation system during the focusing process of a line array camera in another embodiment. DETAILED DESCRIPTION
[0063] The present invention is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are for making the present application better understood. However, those skilled in the art can easily recognize that some features can be omitted in different situations, or can be replaced by other elements, materials, methods. In some cases, some operations related to the present application are not shown or described in the specification, this is to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations according to the description in the specification and the general technical knowledge in the art.
[0064] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0065] The serial numbers of the components in this document, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0066] At present, the focus adjustment of line array cameras in many large-scale equipment is completed by two or more people. One person is responsible for adjusting and locking the focus of the camera lens, and the other person is responsible for judging the image quality of the camera. The image quality is informed to the lens focus adjustment personnel so that they can further adjust the focus to improve the image shooting quality. The current adjustment method has low camera focus accuracy and cumbersome equipment calibration operations. For image quality, image clarity is an important indicator to measure image quality. Since the camera generally works in a mode without a reference image, focus control is required during shooting. If the focus is not accurate, the image will become blurry and unclear. When the camera focuses, the working distance (WD) between the camera lens and the object being photographed is adjusted according to some clarity judgment criteria to make the image clear. Generally, there is an adjustment process when focusing. During the focusing process, the distance between the lens and the object being photographed changes from far to near, and then from near to far. The image also changes from blurry to clear and then to blurry. The clarity peak can be determined and finally the image reaches the clearest position. In this process, the measurement of image clarity is very important.
[0067] This application provides two clarity evaluation indicators for line array cameras, namely, local clarity evaluation indicators and global clarity evaluation indicators. The evaluation of local clarity evaluation indicators is completed under the condition of static shooting. A specific auxiliary focus adjustment target is placed under the line array camera. The target is static and the line array camera takes a single shot to obtain an image. The grayscale and gradient projection curves of the image are obtained, and the gradient amplitude is analyzed from them. The local clarity evaluation score is given according to the analysis results.
[0068] The evaluation of the global clarity evaluation index is completed under the condition of dynamic shooting. The auxiliary focus adjustment target is placed under the linear array camera for uniform motion. The linear array camera is triggered by an external IO signal for continuous shooting. After reaching the preset number of lines, an image is obtained. The direction of the target part in the image is corrected to eliminate the influence caused by the tilt of the auxiliary focus adjustment target. Then the grayscale and gradient analysis are also performed, and the global clarity evaluation score is given according to the analysis results. The debugging personnel can adjust the focal length of the linear array camera to an approximate position according to the local clarity evaluation score, and then fine-tune it according to the global clarity evaluation score, and finally adjust it to an optimal focal length, which helps to improve the accuracy and efficiency of the focal length adjustment of the linear array camera.
[0069] The setting of the auxiliary focus adjustment target is relatively important. Since an important criterion for judging clarity is the sharpness of the edge, this application mainly adopts, for example Figure 1The bar target shown has black and white stripes, forming a clear edge, which is suitable for evaluating image clarity. The following is an introduction to the image quality evaluation method during the focusing process of the linear array camera of the present application, which includes a local evaluation step and a global evaluation step. Please refer to Figure 2 In one embodiment, the local evaluation step includes steps 110 to 140, which are described in detail below.
[0070] Step 110: Acquire the first strip target image. As mentioned above, in the local definition evaluation process, the strip target is placed statically under the linear array camera for a single shot to obtain the first strip target image, which is an image with only one or several rows of pixels. When placing the strip target, it is necessary to make the stripes in the strip target perpendicular to the length direction of the linear array arrangement as much as possible.
[0071] Step 120: Calculate the grayscale average value f of each column of pixels in the first strip target image i , and get the grayscale curve sequence {f i}(i=1,2,…,n), where the subscript i represents the i-th column and n represents the number of columns. Specifically, the grayscale average value f of each column i It can be calculated according to the following formula:
[0072]
[0073] The subscript j indicates the jth row, and m is the line width of the linear array camera. i The grayscale curve obtained is as follows Figure 3 shown.
[0074] Step 130: For the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i ′}. Smoothing filtering can be used for denoising. The user sets the smoothing range N in advance, and the smoothing intensity coefficient σ can be calculated according to the following formula:
[0075]
[0076] in Indicates rounding down. Then the filter kernel can be set to
[0077]
[0078] Therefore, the gradient value obtained after denoising using the above filter kernel can be expressed as:
[0079]
[0080] in Thus, we can get the gray gradient curve sequence {f i ′}. The gray gradient curve sequence {f i The gray gradient curve obtained is as follows Figure 4 As shown, the grayscale curve and grayscale gradient curve are placed in the same figure as shown in Figure 5 As shown, the upper part is the grayscale curve and the lower part is the grayscale gradient curve.
[0081] Step 140: Filter out the gradient value f that meets the preset conditions i ′, calculate the average value of these gradient values as the local clarity evaluation score. According to the preset conditions, the gradient value f i ', the data that can better reflect the image clarity is selected as the basis for calculating the local clarity evaluation score. In one embodiment, the gradient value f that satisfies the following three conditions at the same time can be obtained: i ' to calculate:
[0082] f i ′>f′ i-1 、f i ′>f′ i+1 、|f′|>t,
[0083] Where t is the preset threshold.
[0084] During the focusing process, a local clarity evaluation score can be obtained each time the focal length is adjusted. For the convenience of the debugging personnel, the local clarity evaluation scores at each moment in the focusing process can be plotted into a curve and sent to the display device, so that the display device can display it for the debugging personnel to view, thereby ensuring the traceability of the adjustment process. By viewing the local clarity evaluation score curve, the debugging personnel can easily find the maximum value of the curve, which is the optimal focus position.
[0085] Since the target image obtained by static shooting only has a few lines of data, the calculation of the local clarity evaluation score only completes the processing of a few lines of data. The debugger can complete the coarse adjustment of the focal length based on the local clarity evaluation score. However, in order to make the line array camera have better shooting quality, it is necessary to use the complete image for analysis and processing to improve the accuracy of focus adjustment. In the global evaluation step of this application, the clarity is evaluated based on the complete image taken by the line array camera. Please refer to Figure 6 In one embodiment, the global evaluation step includes steps 210 to 250, which are described in detail below.
[0086] Step 210: Acquire the second bar target image. As mentioned above, in the process of global clarity evaluation, it is necessary to dynamically capture the target image. The bar target is placed on a line scanning motion platform that carries the object to be photographed. The line scanning motion platform drives the bar target to move at a constant speed. The relationship between the movement direction and the linear array camera is as follows: Figure 7 As shown, the linear array camera is triggered by an external IO signal to scan and image a preset number of lines of the strip target to obtain a second strip target image, which is a relatively complete image of the strip target.
[0087] Step 220: Directionally correct the second target strip image. Use the polar coordinate information (ρ, θ) of the edge point in the second target strip image to calculate the offset angle α, and rotate the second target strip image by the angle α so that the stripes in the second target strip image are perpendicular to the lower boundary of the image, where ρ is the distance between the edge point and the image origin, and θ is the angle between the line connecting the edge point and the image origin and the image X-axis. Since the target may be skewed during placement, the image obtained at this time is as follows: Figure 8 As shown, this will affect the analysis results, so directional correction is needed.
[0088] In the embodiments of the present application, two methods for calculating the offset angle α are provided. In one embodiment, the second bar target image can be displayed to the user through the human-computer interaction device, and the user selects the region of interest on the second bar target image, preferably a straight edge line in the image. In fact, the offset angle α is equivalent to the deflection angle of the straight edge line. After obtaining the region of interest set by the user, the polar coordinate information (ρ, θ) of the edge point in the region of interest is obtained. The edge point is as follows: Figure 8 As shown by the black dots in the figure, it can be obtained by edge detection. The obtained distance ρ and angle θ are discretized to obtain the index coordinates corresponding to the polar coordinate information (ρ, θ), and the index coordinates are voted and counted to obtain the polar coordinate information (ρ) corresponding to the index coordinate with the largest voting value. m ,θ m ). It can be understood that after discretization, the distance ρ and angle θ are converted into discrete values such as 1, 2, 3... etc. Each discrete value can have a corresponding index. If the index starts from 0, then the index of 1 is 0, the index of 2 is 1..., and the index coordinates corresponding to each polar coordinate information can be obtained. The index coordinates are voted and counted. Assuming that the index coordinate with the largest voting value is (0,0), the corresponding polar coordinate information is (1,1). In the voting counting process, the index coordinates are counted. For example, for the index coordinate (0,0), every time an index coordinate (0,0) appears, its voting value is increased by 1. The final voting value is equivalent to the number of times or quantities that the index coordinate appears. Finally, using (ρ m ,θ m ) Calculate the offset angle
[0089] In another embodiment, the edge points may not be obtained through the region of interest set by the user, and the polar coordinate information (ρ, θ) of all edge points in the second strip target image may be directly obtained. Then, the obtained distance ρ and angle θ are discretized to obtain the index coordinates corresponding to the polar coordinate information (ρ, θ). The index coordinates are subjected to voting counting processing, and the index coordinates whose voting values are greater than a preset voting value threshold are screened out. The average value (ρ a ,θ a ), then the offset angle
[0090] The edge straight line in the second bar target image can be displayed using polar coordinate information (ρ, θ) and offset angle α. The corresponding image coordinates (x0, y0) can be calculated based on the polar coordinate information (ρ, θ), where x0 = ρcosθ, y0 = ρsinθ. The straight line can be represented by two points. Here, a straight line can be determined based on the two points (x0-rsinα, y0+rcosα) and (x0+rsinα, y0-rcosα). This straight line is used to represent the edge straight line and is sent to the display device for display, which is convenient for debugging personnel to view. Among them, r is the preset display radius, which controls the length of the line segment displayed on the display device. The user can determine r according to the length of the line segment to be displayed.
[0091] Step 230: Calculate the grayscale average value f of each column of pixels in the rotated second strip target image i , and get the grayscale curve sequence {f i}(i=1,2,…,n). Similarly, the grayscale mean value f of each column i It can be calculated according to the following formula:
[0092]
[0093] Step 240: For the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i Here, the same method as step 130 can be used for denoising. The user pre-sets the smoothing range N, and the smoothing intensity coefficient σ can be calculated according to the following formula:
[0094]
[0095] in Indicates rounding down. Then the filter kernel can be set to
[0096]
[0097] Therefore, the gradient value obtained after denoising using the above filter kernel can be expressed as:
[0098]
[0099] in Thus, we can get the gray gradient curve sequence {f i ′}.
[0100] Step 250: Filter out the gradient value f that meets the preset conditions i ', and calculate the average value of these gradient values as the global clarity evaluation score. In one embodiment, the gradient value f that meets the preset conditions i ′ can be a gradient value f that satisfies the following three conditions at the same time i ′:
[0101] f i ′>f′ i-1 、f i ′>f′ i+1 、|f′|>t,
[0102] Where t is the preset threshold.
[0103] Similar to the local clarity analysis process, when performing global clarity analysis, a global clarity evaluation score can be obtained each time the focus is adjusted. The global clarity evaluation scores at each moment in the focusing process can be plotted into a curve and sent to the display device, so that the display device can display it for the debugger to view, ensuring the traceability of the adjustment process. By viewing the global clarity evaluation score curve, the debugger can easily find the maximum value of the curve, which is the optimal focus position. The debugger can further fine-tune the focus according to the global clarity evaluation score to ensure the quality of image capture.
[0104] Under the condition of dynamic shooting, the movement speed of the line scanning motion platform can also be adjusted. The movement speed can be adjusted by using a circular target with a circular pattern and / or a circular ring pattern, such as Fig. 9 The method of the present application also includes a speed adjustment step to achieve speed adjustment of the line scanning motion platform, please refer to Fig.10 In one embodiment, the step includes steps 310 to 320.
[0105] Step 310: Acquire a circular target image. Similar to the process of capturing the second strip target image, place the circular target on a line scanning motion platform, which drives the circular target to move at a constant speed, and the linear array camera completely scans and images the moving circular target to obtain a circular target image.
[0106] Step 320: Obtain a circle or ellipse in the circular target image, and obtain the radius R of the circle or ellipse in the X direction. x and the radius R in the Y direction y , according to the constraint R x =R y Adjust the speed of the line scanning motion platform. When the speed of the line scanning motion platform is too fast or too slow, the circle in the circular target will be stretched or compressed on the image and become an ellipse. When the speed of the line scanning motion platform is appropriate, a circle should be obtained from the circular target image. Therefore, according to the constraint condition R x =R y Adjust the movement speed of the line scanning motion platform.
[0107] Based on the above image quality evaluation method, this application also provides an image quality evaluation system during the focusing process of a linear array camera, please refer to Fig.11 In one embodiment, the system includes a local evaluation module 1 and a global evaluation module 2, which are described below respectively.
[0108] like Fig.11 As shown, the local evaluation module 1 includes a first target image acquisition submodule 11 , a local grayscale curve acquisition submodule 12 , a local denoising submodule 13 and a local score calculation submodule 14 .
[0109] The first target image acquisition submodule 11 is used to acquire a first strip-shaped target image. The process of capturing the first strip-shaped target image may refer to step 110 above.
[0110] The local grayscale curve acquisition submodule 12 is used to calculate the grayscale average value f of each column of pixels in the first strip target image. i , and get the grayscale curve sequence {f i}(i=1,2,…,n). Specifically, the grayscale average value f of each column i It can be calculated according to the following formula:
[0111]
[0112] The local denoising submodule 13 is used to denoise the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i ′}. Smoothing filtering can be used for denoising. The user sets the smoothing range N in advance, and the smoothing intensity coefficient σ can be calculated according to the following formula:
[0113]
[0114] in Indicates rounding down. Then the filter kernel can be set to
[0115]
[0116] Therefore, the gradient value obtained after denoising using the above filter kernel can be expressed as:
[0117]
[0118] in Thus, we can get the gray gradient curve sequence {f i ′}.
[0119] The local score calculation submodule 14 is used to select the gradient value f that meets the preset conditions. i ', and calculate the average value of these gradient values as the local clarity evaluation score. In one embodiment, the gradient value f that meets the preset conditions i ′ can be a gradient value f that satisfies the following three conditions at the same time i ′:
[0120] f i ′>f′ i-1 、f i ′>f′ i+1 、|f′|>t,
[0121] Where t is the preset threshold.
[0122] During the focusing process, a local clarity evaluation score can be obtained each time the focal length is adjusted. In order to facilitate the debugging personnel to view, the local score calculation submodule 14 can plot the local clarity evaluation scores at each moment in the focusing process into a curve and send it to the display device, so that the display device can display it for the debugging personnel to view, thereby ensuring the traceability of the adjustment process. By viewing the local clarity evaluation score curve, the debugging personnel can easily find the maximum value of the curve, which is the optimal focus position.
[0123] The global evaluation module 2 is described below. Fig.11 As shown, the global evaluation module 2 includes a second target image acquisition submodule 21 , an image rotation submodule 22 , a global grayscale curve acquisition submodule 23 , a global denoising submodule 24 and a global score calculation submodule 25 .
[0124] The second target image acquisition submodule 21 is used to acquire a second strip-shaped target image. The process of capturing the second strip-shaped target image may refer to step 210 above.
[0125] The image rotation submodule 22 is used to calculate the offset angle α using the polar coordinate information (ρ, θ) of the edge points in the second strip target image, and rotate the second strip target image by the angle α so that the stripes in the second strip target image are perpendicular to the lower boundary of the image.
[0126] The image rotation submodule 22 can calculate the offset angle α in two ways. In one embodiment, the second bar target image can be displayed to the user through the human-computer interaction device, and the user selects the region of interest on the second bar target image, preferably a straight edge line in the image. In fact, the offset angle α is equivalent to the deflection angle of the straight edge line. The image rotation submodule 22 obtains the region of interest set by the user, and then obtains the polar coordinate information (ρ, θ) of the edge point in the region of interest. The edge point is as follows: Figure 8 As shown by the black dots in the figure, it can be obtained by edge detection. Then, the image rotation submodule 22 discretizes the obtained distance ρ and angle θ to obtain the index coordinates corresponding to the polar coordinate information (ρ, θ), performs voting counting processing on the index coordinates, and obtains the polar coordinate information (ρ) corresponding to the index coordinate with the largest voting value. m ,θ m ), and finally use (ρ m ,θ m ) Calculate the offset angle
[0127] In another embodiment, the image rotation submodule 22 may not obtain edge points through the region of interest set by the user, but directly obtain the polar coordinate information (ρ, θ) of all edge points in the second strip target image, and then discretize the obtained distance ρ and angle θ to obtain the index coordinates corresponding to the polar coordinate information (ρ, θ), perform voting counting processing on the index coordinates, screen out the index coordinates whose voting values are greater than the preset voting value threshold, and calculate the average value (ρ) of the polar coordinate information corresponding to these index coordinates. a ,θ a ), calculate the offset angle
[0128] The edge straight line in the second bar target image can be displayed using polar coordinate information (ρ, θ) and offset angle α. Fig.12 In one embodiment, the global evaluation module 2 may further include an edge line acquisition submodule 26, which is used to calculate the corresponding image coordinates (x0, y0) according to the polar coordinate information (ρ, θ), wherein x0=ρcosθ, y0=ρsinθ, and then determine a straight line according to the two points (x0-rsinα, y0+rcosα), (x0+rsinα, y0-rcosα), and use the straight line to represent the edge line, which is sent to the display device for display, so as to facilitate the debugging personnel to view, wherein r is a preset display radius, which controls the length of the line segment displayed on the display device, and the user can determine r according to the length of the line segment to be displayed.
[0129] The global grayscale curve acquisition submodule 23 is used to calculate the grayscale average value f of each column of pixels in the rotated second strip target image. i , and get the grayscale curve sequence {f i}(i=1,2,…,n). Similarly, the grayscale mean value f of each column i It can be calculated according to the following formula:
[0130]
[0131] The global denoising submodule 24 is used to denoise the grayscale curve sequence {f i} to perform denoising and obtain the grayscale gradient curve sequence {f i Here, the same method as the local denoising submodule 13 can be used for denoising. The user pre-sets the smoothing range N, and the smoothing intensity coefficient σ can be calculated according to the following formula:
[0132]
[0133] in Indicates rounding down. Then the filter kernel can be set to
[0134]
[0135] Therefore, the gradient value obtained after denoising using the above filter kernel can be expressed as:
[0136]
[0137] in Thus, we can get the gray gradient curve sequence {f i ′}.
[0138] The global score calculation submodule 25 is used to filter out the gradient value f that meets the preset conditions. i ', and calculate the average value of these gradient values as the global clarity evaluation score. In one embodiment, the gradient value f that meets the preset conditions i ′ can be a gradient value f that satisfies the following three conditions at the same time i ′:
[0139] f i ′>f′ i-1 、f i ′>f′ i+1 、|f|′>t,
[0140] Where t is the preset threshold.
[0141] Similar to the local clarity analysis process, when performing global clarity analysis, a global clarity evaluation score can be obtained each time the focal length is adjusted. The global score calculation submodule 25 can plot the global clarity evaluation scores at each moment in the focusing process into a curve and send it to the display device, so that the display device can display it for the debugging personnel to view, thereby ensuring the traceability of the adjustment process. The debugging personnel can easily find the maximum value of the curve by viewing the global clarity evaluation score curve, which is the optimal focus position. The debugging personnel can further fine-tune the focal length according to the global clarity evaluation score to ensure the quality of image capture.
[0142] Please refer to Fig.12 In one embodiment of the present application, the image quality evaluation system may further include a speed adjustment module 3, which is used to adjust the movement speed of the line scanning motion platform. The speed adjustment module 3 may include a third target image acquisition submodule 31 and an adjustment submodule 32. The third target image acquisition submodule 31 is used to acquire a circular target image. The process of capturing the circular target image may refer to step 310 above. The adjustment submodule 32 is used to acquire a circle or ellipse in the circular target image and acquire the radius R of the circle or ellipse in the X direction. x and the radius R in the Y direction y , according to the constraint R x =R y Adjust the movement speed of the line scanning motion platform.
[0143] According to the image quality evaluation method and system in the focusing process of the line array camera in the above-mentioned embodiment, the image quality evaluation of two scales is performed by using the images captured by the line array camera when the target is stationary and moving, respectively. The local quality evaluation is performed using the image when the target is stationary, and the global quality evaluation is performed using the relatively complete image captured when the target is moving. The clarity of the image captured by the line array camera can be evaluated from both local and global aspects. The debugging personnel can first make a rough adjustment according to the local clarity evaluation score, adjust the focal length to an approximate position, and then make a fine adjustment according to the global clarity evaluation score, which is conducive to improving the accuracy of the focus adjustment of the line array camera, improving the quality of the image captured by the line array camera, ensuring the imaging effect of the image, and also reducing some cumbersome operations, and improving the efficiency of the focus adjustment of the line array camera. Since denoising is performed during the processing, the influence of noise can be reduced, and the accuracy and stability of the image quality evaluation can be improved. In some embodiments, the clarity evaluation score can be plotted as a curve for display, which is convenient for the debugging personnel to view and also ensures the traceability of the adjustment process. In some embodiments, the movement speed of the line scanning motion platform can also be adjusted to improve the accuracy of the image captured by the line array camera.
[0144] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above-mentioned embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above-mentioned functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above-mentioned functions can be implemented. In addition, when all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and can be downloaded or copied and saved in the memory of the local device, or the system of the local device is updated, and when the program in the memory is executed by the processor, all or part of the functions in the above-mentioned embodiments can be implemented.
[0145] The above specific examples are used to illustrate the present invention, which is only used to help understand the present invention and is not intended to limit the present invention. For those skilled in the art, according to the concept of the present invention, some simple deductions, modifications or substitutions can be made.
Claims
1. A method for evaluating image quality during focusing of a linear array camera, used to evaluate the clarity of an image, characterized in that: The image quality evaluation method includes a local evaluation step and a global evaluation step; The local evaluation step comprises: Acquire a first strip target image, wherein the first strip target image is obtained by a linear array camera taking a single shot of a stationary strip target, wherein the strip target has alternating black and white stripes; Calculate the grayscale average value f of each column of pixels in the first strip target image i , and get the grayscale curve sequence {f i }(i=1,2,…,n), where the subscript i represents the i-th column and n represents the number of columns; For the grayscale curve sequence {f i } to perform denoising and obtain the grayscale gradient curve sequence {f i '}; Filter out the gradient value f that meets the preset conditions i ′, calculate the average value of these gradient values as the local clarity evaluation score; The global evaluation step comprises: Acquire a second strip target image, where the second strip target image is obtained by scanning and imaging the moving strip target by a preset number of lines using a linear array camera; Using the polar coordinate information (ρ, θ) of the edge point in the second strip target image to calculate the offset angle α, the second strip target image is rotated by the angle α, so that the stripes in the second strip target image are perpendicular to the lower boundary of the image, where ρ is the distance between the edge point and the image origin, and θ is the angle between the line connecting the edge point and the image origin and the image X-axis; Calculate the grayscale average value f of each column of pixels in the second strip target image after rotation i , and get the grayscale curve sequence {f i }(i=1,2,…,n); For the grayscale curve sequence {f i } to perform denoising and obtain the grayscale gradient curve sequence {f i '}; Filter out the gradient value f that meets the preset conditions i ′, and calculate the average of these gradient values as the global clarity evaluation score.
2. The image quality evaluation method according to claim 1, characterized in that: The grayscale curve sequence {f i } to perform denoising and obtain the grayscale gradient curve sequence {f i '},include: The smoothing range N is preset, and the smoothing intensity coefficient σ is calculated according to the following formula: The gradient value f is calculated according to the following formula i ′, thereby obtaining the gray gradient curve sequence {f i ′}: in Indicates rounding down.
3. The image quality evaluation method according to claim 1, wherein: The gradient value f that meets the preset conditions i ′ refers to the gradient value f that satisfies the following conditions at the same time i ′: f i ′>f′ i-1 、f i ′>f′ i+1 、|f′|>t, Where t is the preset threshold.
4. The image quality evaluation method according to claim 1, wherein: The step of calculating the offset angle α by using the polar coordinate information (ρ, θ) of the edge point in the second strip target image includes: Acquire a region of interest in the second bar target image set by a user, and acquire polar coordinate information (ρ, θ) of edge points in the region of interest; The obtained distance ρ and angle θ are discretized to obtain the index coordinates corresponding to the polar coordinate information (ρ, θ), and the index coordinates are processed by voting counting to obtain the polar coordinate information (ρ m ,θ m ),but 5. The image quality evaluation method according to claim 1, wherein: The step of calculating the offset angle α by using the polar coordinate information (ρ, θ) of the edge point in the second strip target image includes: Obtaining polar coordinate information (ρ, θ) of edge points in the second strip target image; The obtained distance ρ and angle θ are discretized to obtain the index coordinates corresponding to the polar coordinate information (ρ, θ), and the index coordinates are processed by voting counting to screen out the index coordinates whose voting values are greater than the preset voting value threshold, and the average value of the polar coordinate information corresponding to these index coordinates is calculated (ρ a ,θ a ),but 6. The image quality evaluation method according to claim 1, wherein: The local evaluation step also includes: plotting the local clarity evaluation scores at each moment in the focusing process into a curve and sending it to a display device, so that the display device displays it for debugging personnel to view; the global evaluation step also includes: plotting the global clarity evaluation scores at each moment in the focusing process into a curve and sending it to a display device, so that the display device displays it for debugging personnel to view.
7. The image quality evaluation method according to claim 1, wherein: The global evaluation step also includes: after obtaining the image rotation angle α, calculating the corresponding image coordinates (x0, y0) according to the polar coordinate information (ρ, θ), where x0=ρcosθ, y0=ρsinθ, and determining a straight line based on two points (x0-rsinα, y0+rcosα) and (x0+rsinα, y0-rcosα), and sending it to the display device for display, where r is the preset display radius.
8. The image quality evaluation method according to any one of claims 1 to 7, characterized in that: The method further comprises a speed adjustment step, wherein the speed adjustment step comprises: Acquire a circular target image, wherein the circular target image is obtained by completely scanning and imaging the moving circular target with a linear array camera, and the circular target has a circular pattern and / or a circular ring pattern; Obtain a circle or ellipse in the circular target image, and obtain the radius R of the circle or ellipse in the X direction x and the radius R in the Y direction y , according to the constraint R x =R y Adjust the movement speed of the line scanning motion platform.
9. An image quality evaluation system for a linear array camera during focusing, used to evaluate the clarity of an image, characterized in that: Includes local evaluation module and global evaluation module; The local evaluation module comprises: A first target image acquisition submodule, used for acquiring a first strip target image, wherein the first strip target image is obtained by a linear array camera taking a single shot of a stationary strip target, wherein the strip target has alternating black and white stripes; The local grayscale curve acquisition submodule is used to calculate the grayscale average value f of each column of pixels in the first strip target image. i , and get the grayscale curve sequence {f i }(i=1,2,…,n), where the subscript i represents the i-th column and n represents the number of columns; The local denoising submodule is used to denoise the grayscale curve sequence {f i } to perform denoising and obtain the grayscale gradient curve sequence {f i '}; The local score calculation submodule is used to filter out the gradient value f that meets the preset conditions. i ′, calculate the average value of these gradient values as the local clarity evaluation score; The global evaluation module includes: A second target image acquisition submodule is used to acquire a second strip target image, where the second strip target image is obtained by scanning and imaging the moving strip target by a linear array camera for a preset number of lines; an image rotation submodule, configured to calculate an offset angle α using the polar coordinate information (ρ, θ) of the edge point in the second strip target image, and rotate the second strip target image by the angle α so that the stripes in the second strip target image are perpendicular to the lower boundary of the image, wherein ρ is the distance between the edge point and the image origin, and θ is the angle between the line connecting the edge point and the image origin and the image X-axis; The global grayscale curve acquisition submodule is used to calculate the grayscale average value f of each column of pixels in the second strip target image after rotation. i , and get the grayscale curve sequence {f i }(i=1,2,…,n); The global denoising submodule is used to denoise the grayscale curve sequence {f i } to perform denoising and obtain the grayscale gradient curve sequence {f i '}; The global score calculation submodule is used to filter out the gradient values f that meet the preset conditions. i ′, and calculate the average of these gradient values as the global clarity evaluation score.
10. A computer-readable storage medium, characterized in that: The medium stores a program, which can be executed by a processor to implement the image quality assessment method according to any one of claims 1 to 8.
