SFR card identification method and device, electronic equipment and storage medium
By employing principal component analysis and adaptive adjustment of scale parameter thresholds, the problem of SFR card recognition under the influence of light intensity, color difference, and distortion was solved, enabling accurate recognition and evaluation under different conditions and improving recognition efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-12
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, factors such as light intensity, color difference, and distortion affect the accuracy of SFR card recognition results, making it difficult to accurately identify the position of SFR cards and calculate modulation transfer functions under different conditions.
Principal component analysis is used to identify flat and textured regions in the map image, generate a mask image, and identify the central square by adaptively adjusting the scale parameter threshold. The modulation transfer function is then calculated, and noise reduction and smoothing are performed to finally obtain an accurate spatial frequency response map.
Even in the presence of color difference, distortion, and occlusion, it can accurately identify the location of SFR charts, provide accurate evaluation results, improve work efficiency, and reduce costs.
Smart Images

Figure CN115965776B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer technology, and specifically relates to a method, apparatus, electronic device and storage medium for recognizing SFR chart cards. Background Technology
[0002] With the advancement of science and technology, image imaging systems are widely used in various products, such as automobiles and video surveillance equipment. The imaging capability of an imaging system directly affects the user experience and the product's ability to be promoted.
[0003] The SFR (Spatial Frequency Response) chart is a standard chart used in the field of image quality assessment. This chart consists of a 5 x 7 pattern matrix, top borders, grayscale blocks, and a color chart. The SFR chart can be applied to automotive camera debugging, camera resolution testing, distortion testing, fisheye lens testing, and camera imaging testing.
[0004] In existing technologies, factors such as light intensity, color difference, and distortion can all affect the accuracy of SFR chart recognition results. Summary of the Invention
[0005] To at least address the aforementioned technical problems, the present invention provides a method, apparatus, electronic device, and storage medium for identifying SFR chart cards.
[0006] According to a first aspect of the present invention, a method for identifying SFR charts is provided, comprising:
[0007] Acquire spatial frequency response graph images;
[0008] The first scale parameter threshold is used to identify flat areas and textured areas in the image card to obtain a first mask image;
[0009] Perform center square recognition on the first mask image;
[0010] In the event that the central square recognition fails, the first scale parameter threshold is adjusted according to a preset method to generate a second scale parameter threshold.
[0011] Based on the second scale parameter threshold, flat areas and textured areas are identified, and a second mask image is generated;
[0012] Perform center square recognition on the second mask image;
[0013] If the central square is successfully identified, the modulation transfer function is calculated, and the obtained modulation transfer function calculation result is subjected to noise reduction and smoothing to obtain the final spatial frequency response chart.
[0014] Furthermore, the step of using a first scale parameter threshold to identify flat and textured regions in the image card to obtain a first mask image includes:
[0015] Principal component analysis was used to identify flat and textured regions in the image.
[0016] Adjust the image to a preset size, calculate the derivative of the two-dimensional coordinate values of the image, scan the entire image using small blocks of preset pixels, record the gradient values of each small block in the x and y directions, perform singular value decomposition, reduce the original preset pixel matrix to the target pixel, and use the trace of the obtained matrix as the texture intensity value of the current small block.
[0017] After obtaining the texture intensity values of all small blocks, data normalization is performed, and the normalization result is judged. If the texture intensity value in the normalization result is less than or equal to the first scale parameter threshold, it is determined to be a flat area; if the texture intensity value in the normalization result is greater than the first scale parameter threshold, it is determined to be a textured area. The first mask image is generated based on the flat area and the textured area.
[0018] Furthermore, the process of identifying the center square of the mask image includes:
[0019] The first mask image is preprocessed by image erosion and dilation to remove burrs, and all square contours in the first mask image are identified to obtain the coordinates of the center square.
[0020] Furthermore, the step of performing image erosion and dilation preprocessing on the first mask image to remove burrs includes,
[0021] All pixels of the first mask image are scanned using a pre-set structuring element. The structuring element is then ANDed with each corresponding point in the binary image covered by the structuring element. The pixel value of the point is set according to the result of the operation to obtain the eroded image.
[0022] The structuring element is used to scan each pixel of the binary image, and an "OR" operation is performed between the structuring element and each corresponding point in the binary image it covers. The pixel value of the point is set according to the operation result to obtain the dilated image.
[0023] For the image obtained after dilation, all branches and burrs are considered as branches of different lengths. If the branch length is less than a predetermined length, it is determined to be a burr and the burr is removed.
[0024] Furthermore, the step of identifying all square outlines in the first mask image and obtaining the coordinates of the central square includes:
[0025] The first mask image is subjected to Gaussian blur processing, smoothing and noise reduction, edge sharpening, and potential contour detection. Since the detected potential contours are approximately polygons, the detected quadrilaterals are filtered to remove squares that do not meet the preset filtering conditions, and the squares located near the center of the image and their coordinates are obtained.
[0026] Furthermore, the Gaussian blurring process on the first mask image includes:
[0027] For each pixel, the average value of its surrounding pixels is taken. For the center point, the average value of its surrounding pixels is taken. The center point is taken as the origin. Other points are assigned weights according to their positions on the normal curve to obtain a weighted average value. A two-dimensional Gaussian function is derived from the one-dimensional Gaussian function. The weight of each point is calculated based on the one-dimensional Gaussian function. The gray value of each pixel is multiplied by its own weight and the result is added to obtain the Gaussian blur value of the center point. The same operation is performed on each pixel to finally obtain the Gaussian blurred image.
[0028] Furthermore, the detection of potential contours includes: scanning the binary image of the Gaussian blurred image using a raster, obtaining pixels that meet the initial point conditions for boundary tracking, generating and recording boundary sequence numbers, obtaining the parent boundary based on the boundary sequence numbers, tracking the entire boundary, and then restarting the raster scan until the entire image is scanned, thereby obtaining the potential contours of the image.
[0029] Furthermore, in the case where the central square recognition fails, adjusting the first scale parameter threshold according to a preset method to generate a second scale parameter threshold includes:
[0030] In the case where the central square recognition fails, the sigma value of the texture area is calculated based on the recognized texture area mask. The sigma value of the texture area is then subtracted from the average sigma value of the image, and the result is used as the second scale parameter threshold.
[0031] Furthermore, the step of identifying flat and textured regions based on the second scale parameter threshold and generating a second mask image includes:
[0032] Principal component analysis is used to reduce the pixel dimension of the image card, and the normalization result of the obtained texture intensity value data is judged. If the texture intensity value in the normalization result is less than or equal to the second scale parameter threshold, it is determined to be a flat region; if the texture intensity value in the normalization result is greater than the second scale parameter threshold, it is determined to be a textured region. A second mask image is generated based on the flat region and the textured region.
[0033] Furthermore, in the case where the central square is successfully identified, the modulation transfer function is used to calculate the modulation index, including:
[0034] If the central square is successfully identified, the maximum and minimum brightness points are obtained. The maximum and minimum brightness points are subtracted to obtain the first result. The maximum and minimum brightness points are added to obtain the second result. The first and second results are divided to obtain the modulation transfer function.
[0035] According to a second aspect of the present invention, an apparatus for identifying SFR chart cards is provided, comprising:
[0036] The image acquisition module is used to acquire images from the spatial frequency response chart.
[0037] The first mask module is used to identify flat areas and textured areas in the image card using a first scale parameter threshold, thereby obtaining a first mask image;
[0038] The first recognition module is used to perform central square recognition on the first mask image;
[0039] The adjustment module is used to adjust the first scale parameter threshold according to a preset method to generate a second scale parameter threshold when the central square recognition fails.
[0040] The second mask module is used to identify flat areas and textured areas according to the second scale parameter threshold, and generate a second mask image;
[0041] The second recognition module is used to perform central square recognition on the second mask image;
[0042] The modulation transfer module is used to calculate the modulation transfer function when the central square is successfully identified, and to perform noise reduction and smoothing on the obtained modulation transfer function calculation result to obtain the final spatial frequency response chart.
[0043] Furthermore, the first mask module is used to identify flat areas and textured areas in the image card using principal component analysis.
[0044] It is also used to adjust the image of the card to a preset size, calculate the derivative of the two-dimensional coordinate values of the image of the card, scan the entire image of the card with small blocks of preset pixels, record the gradient values of each small block in the x and y directions, and perform singular value decomposition to reduce the matrix of the original preset pixels to the target pixel, and use the trace of the obtained matrix as the texture intensity value of the current small block.
[0045] The first mask module is further configured to perform data normalization processing after obtaining the texture intensity values of all small blocks, and to judge the obtained data normalization processing result. If the texture intensity value in the data normalization processing result is less than or equal to the first scale parameter threshold, it is determined to be a flat area; if the texture intensity value in the data normalization processing result is greater than the first scale parameter threshold, it is determined to be a textured area, and a first mask image is generated based on the flat area and the textured area.
[0046] The first recognition module includes a processing submodule and a recognition submodule, wherein the processing submodule is used to perform image erosion and dilation preprocessing on the first mask image to remove burrs;
[0047] The recognition submodule is used to identify all square outlines in the first mask image and obtain the coordinates of the center square.
[0048] Furthermore, the processing submodule is used to scan all pixels of the first mask image using a pre-set structuring element, perform an AND operation between the structuring element and each corresponding point in the binary image covered by the structuring element, set the pixel value of the point according to the operation result, and obtain the eroded image.
[0049] The processing submodule is also used to scan each pixel of the binary image with the structuring element, perform an "OR" operation between the structuring element and each corresponding point in the binary image it covers, and set the pixel value of the point according to the operation result to obtain the dilated image.
[0050] The processing submodule is further configured to treat all branches and burrs in the expanded image as branches of different lengths, and to determine that a branch is a burr if its length is less than a predetermined length, and to remove the burr.
[0051] Furthermore, the recognition submodule is used to perform Gaussian blur processing on the first mask image, smooth and reduce noise, sharpen edges, detect potential contours, filter the detected quadrilaterals based on the fact that the detected potential contours are approximately polygons, remove squares that do not meet the preset screening conditions, and obtain the squares located near the center of the image and their coordinates.
[0052] Furthermore, the recognition submodule includes a Gaussian blur processing unit, which is used to take the average value of the surrounding pixels for each pixel, take the average value of the surrounding points for the middle point, take the center point as the origin, assign weights to other points according to their positions on the normal curve, obtain a weighted average value, derive a two-dimensional Gaussian function based on the one-dimensional Gaussian function, calculate the weight of each point based on the one-dimensional Gaussian function, multiply the gray value of each pixel by its own weight and add the result to obtain the Gaussian blur value of the center point, perform the same operation on each pixel, and finally obtain the Gaussian blurred image.
[0053] Furthermore, the recognition submodule includes a contour analysis unit, which is used to scan the binary image of the Gaussian blurred image using a raster, obtain the pixel points that meet the initial point conditions for boundary tracking, generate and record the boundary sequence number, obtain the parent boundary based on the boundary sequence number, track the entire boundary, and the raster restarts scanning until the entire image is scanned, thereby obtaining the potential contour of the image.
[0054] Furthermore, the adjustment module is used to calculate the sigma value of the texture region based on the identified texture region mask when the central square recognition fails, and to subtract the sigma value of the texture region from the average sigma value of the image, and use the calculated result as the second scale parameter threshold.
[0055] Furthermore, the second mask module is used to perform pixel dimensionality reduction processing on the image card using principal component analysis, and to judge the normalization result of the obtained texture intensity value data. If the texture intensity value in the data normalization result is less than or equal to the threshold of the second scale parameter, it is determined to be a flat area.
[0056] The second mask module is further configured to determine a texture region when the texture intensity value in the data normalization processing result is greater than the threshold of the second scale parameter, and generate a mask image based on the flat region and the texture region.
[0057] Furthermore, the modulation transfer module is used to obtain the maximum brightness point and the minimum brightness point when the central square is successfully identified, subtract the maximum brightness from the minimum brightness to obtain a first calculation result, add the maximum brightness from the minimum brightness to obtain a second calculation result, and divide the first calculation result and the second calculation result to obtain the calculation result as the modulation transfer function.
[0058] According to a third aspect of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor.
[0059] When the processor executes the program, it implements the steps of the method according to any one of the first aspects of the present invention.
[0060] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium stores a program, which, when executed, can implement the method described in any one of the first aspects of the present invention.
[0061] The beneficial effects of this invention are as follows: By employing principal component analysis to identify textured and flat regions in the image, a mask image is obtained. Furthermore, the scale parameter threshold can be adaptively adjusted, enabling the invention to accurately identify the color card position and calculate the modulation transfer function even in cases of color difference, distortion, or occlusion, providing users with precise evaluation results. The technical solution of this invention is simple to implement, easy to operate, and suitable for batch and automated production, greatly improving work efficiency and saving operating costs. Attached Figure Description
[0062] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein,
[0063] Figure 1 A flowchart of a method for identifying SFR charts provided by this invention;
[0064] Figure 2 A schematic diagram of a card image provided by the present invention;
[0065] Figure 3 A schematic diagram of a mask image provided by the present invention;
[0066] Figure 4 A data flow diagram of a method for identifying SFR charts provided by this invention;
[0067] Figure 5 This is a schematic diagram of the structure of an SFR card identification device provided by the present invention;
[0068] Figure 6 This is a schematic diagram of an electronic device structure provided by the present invention. Detailed Implementation
[0069] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0070] To more clearly illustrate the present invention, the following description, in conjunction with preferred embodiments and accompanying drawings, further explains the invention. Similar components in the drawings are indicated by the same reference numerals. Those skilled in the art should understand that the specific description below is illustrative rather than restrictive and should not be construed as limiting the scope of protection of the present invention.
[0071] In a first aspect of the invention, a method for identifying SFR charts is provided, such as... Figure 1 As shown, it includes:
[0072] Step 101: Acquire spatial frequency response graph images;
[0073] In this invention, an imaging system is used to capture images of the SFR (spatial frequency response) chart and the captured image data is saved. The acquired chart images are as follows: Figure 2 As shown.
[0074] Step 102: Use the first scale parameter threshold to identify flat areas and textured areas in the image to obtain the first mask image;
[0075] In this invention, the PCA (Principal Component Analysis) method is used to reduce the dimensionality of the image card and identify the flat and textured regions in the image card to obtain a mask image of the image card, namely the first mask image.
[0076] Furthermore, adjust the image to a preset size; specifically, adjust the image size to 1080p. Calculate the derivatives of the two-dimensional coordinates of the image, specifically the derivatives of the x-coordinates and y-coordinates.
[0077] The entire image card is scanned using small blocks of preset pixels. The preset pixels can be 8. 8, specifically, 8 pixels can be used. The image of the card is acquired by scanning 8-pixel blocks, and the gradient values of each block in the x and y directions are recorded.
[0078] Singular value decomposition is performed on the x and y gradient values of each small block to reduce the dimensionality of the original matrix of the preset pixels to that of the target pixel. The trace of the resulting matrix is used as the texture intensity value of the current small block. The target pixel can be 2^x. 2. In this invention, specifically, after performing singular value decomposition on the x and y gradient values of each small block, the original pixel value of 8... The dimensionality of an 8-dimensional matrix is reduced to 2. A matrix of size 2, the trace of which is used as the texture intensity value for the patch.
[0079] After obtaining the texture intensity values of all small blocks, data normalization is performed. Specifically, the Min-Max Normalization method can be used to normalize the texture intensity values of all small blocks.
[0080] The data normalization result is evaluated. If the texture intensity value in the normalized result is less than or equal to the first scale parameter threshold, it is determined to be a flat region; if the texture intensity value is greater than the first scale parameter threshold, it is determined to be a textured region. A mask image is then generated based on the flat and textured regions. Specifically, an empirical threshold, namely the first scale parameter threshold t, can be preset. If the texture intensity is less than or equal to t, it is determined to be a flat region; otherwise, it is a textured region. The resulting mask image of the image card is the first mask image, as shown below. Figure 3 As shown. In this invention, by generating a mask image from the acquired image card, the region of interest image can be obtained. At the same time, certain areas on the acquired image card can be masked, greatly reducing the amount of data computation and saving time costs while improving the computing speed.
[0081] Step 103: Perform center square recognition on the first mask image;
[0082] In this invention, the first mask image is preprocessed by image erosion and dilation to remove burrs, and then all square contours in the first mask image are identified to obtain the coordinates of the center square.
[0083] Specifically, image erosion can be achieved by scanning all pixels of the first mask image using a pre-set structuring element. More specifically, it can be performed by scanning each pixel of the first mask image with the origin of the structuring element as the coordinate. A bitwise AND operation is then performed between the structuring element and each corresponding point in the binary image covered by the structuring element. Further, let the binary image of the first mask image be... Its connected regions are set as The structuring element is S. When the origin of a structuring element S is moved to point ( , When ), it is denoted as element. At this time, the image The operation of erosion by structuring element S can be:
[0084] S= ;
[0085] When the origin of the structural element S is moved to point ( , When the position is defined, if S is completely contained within X, then the pixel value of that point on the eroded image is 1; otherwise, the pixel value is 0.
[0086] In this invention, the structural elements can be objects of any size and shape, including linear, diamond-shaped, disk-shaped, spherical, etc.
[0087] By employing erosion processing, the structuring element can be used to probe the first mask image, find the region in the image where the structuring element can be placed, eliminate boundary points, and shrink the boundary points inward, thereby eliminating small and meaningless target objects.
[0088] The dilation preprocessing operation includes: scanning each pixel of the binary image with a structuring element, performing an OR operation between the structuring element and each corresponding point in the binary image it covers, and if the structuring element and each corresponding point in the binary image it covers are both 0, then the pixel in the resulting image is 0; otherwise, it is 1.
[0089] Deburring removal involves treating all branches and burrs in the image after preprocessing (erosion and dilation) as branches of varying lengths. If a branch is too short (less than a predetermined length), it is considered a burr and removed. Each branch ends at an endpoint. The specific process includes traversing all points in all connected regions to find all endpoints. An endpoint is defined as a point whose eight neighbors contain only one pixel. For example, a red pixel is considered an endpoint if its eight neighbors contain only one black pixel.
[0090] Iterate through each endpoint until you reach the starting point of the branch, which is also the bifurcation point. The bifurcation point is defined as: after refinement, the number of pixels in its 8-neighborhood is greater than or equal to 3. Count the length of each branch, and branches with a length less than a threshold are identified as spur branches. Erase the spur branches.
[0091] The process involves identifying all square outlines in the first mask image and obtaining the coordinates of the center square. This includes: Gaussian blurring of the mask image, smoothing and noise reduction, and edge sharpening to make edges easier to detect; detecting potential outlines; filtering the detected quadrilaterals based on their approximation as polygons; removing squares that do not meet preset filtering conditions; and further, removing squares with an area smaller than a preset area threshold and a side length smaller than a preset length. The preset area threshold and preset length are custom data and can be any value greater than zero. The process also includes obtaining the coordinates of squares located near the image center.
[0092] The Gaussian blurring process for the mask image includes averaging the values of surrounding pixels for each pixel. The "midpoint" value is calculated by averaging the values of the surrounding pixels and set to 1. This creates a blurring effect at the graphic level, causing the "midpoint" to lose detail. In this invention, the inventors discovered that the larger the range of values used in calculating the average, the stronger the blurring effect; the larger the blur radius, the more blurred the image. From a numerical perspective, this means the values are smoother.
[0093] By taking the "center point" as the origin and assigning weights to other points according to their positions on the normal curve, a weighted average can be obtained.
[0094] A two-dimensional Gaussian function is derived from a one-dimensional Gaussian function, where μ is the mean of x and σ is the variance of x. Since the origin is the center point when calculating the average, μ equals 0. The weights of each point are calculated using the one-dimensional Gaussian function. Assuming σ = 1.5, a weight matrix with a blur radius of 1 is obtained. The sum of the weights of these 9 points equals 0.4787147. If only the weighted average of these 9 points is calculated, their sum must equal 1; therefore, each of the 9 values must be divided by 0.4787147 to obtain the final weight matrix. For the grayscale values of the 9 pixels, the grayscale value of each pixel is multiplied by its own weight, and the result is added to obtain the Gaussian blur value of the center point. The same operation is performed on each pixel to obtain the Gaussian blurred image. For pixels on the boundary, the existing points can be copied to the corresponding positions on the other side to simulate a complete matrix for calculation.
[0095] Detecting latent contours involves: using a raster to scan the binary image of the Gaussian-blurred image, acquiring pixels that satisfy the initial point condition for boundary tracking, generating and recording boundary sequence numbers. The initial point condition can be an outer boundary or a hole boundary. The parent boundary is obtained based on the boundary sequence numbers. The entire boundary is tracked, and the raster scan restarts until the entire image is scanned, thus obtaining the latent contours of the image. Polygons are then approximated based on these latent contours.
[0096] Step 104: In the case of failure to identify the central square, adjust the first scale parameter threshold according to the preset method to generate the second scale parameter threshold;
[0097] In this invention, after the center square is identified in the first mask image, it is determined whether the center square identification is successful. If the center square identification fails, the sigma value of the texture area is calculated based on the identified texture area mask. The sigma value of the texture area is subtracted from the average sigma value of the image, and the result is used as the second scale parameter threshold.
[0098] Step 105: Identify flat and textured regions based on the second scale parameter threshold, and generate a second mask image;
[0099] In this invention, principal component analysis is used to reduce the pixel dimension of the image card, and the normalization result of the obtained texture intensity value data is judged. If the texture intensity value in the normalization result is less than or equal to the second scale parameter threshold, it is determined to be a flat region; if the texture intensity value in the normalization result is greater than the second scale parameter threshold, it is determined to be a textured region. A new mask image is generated based on the flat region and the textured region.
[0100] In another embodiment of the present invention, the step of generating the scale parameter threshold can be performed a preset number of times to generate a second mask image.
[0101] Step 106: Perform center square recognition on the second mask image;
[0102] In this invention, the method for identifying the center square of the second mask image is the same as the method for identifying the center square described in step 103, and will not be repeated here.
[0103] Step 107: If the central square is successfully identified, calculate the modulation transfer function, and perform noise reduction and smoothing on the obtained modulation transfer function calculation result to obtain the final spatial frequency response chart.
[0104] In this invention, when the central square is successfully identified, the maximum and minimum brightness points are obtained. The MTF (Modulation Transfer Function) is calculated based on the contrast between the maximum and minimum brightness points. Specifically, the maximum and minimum brightness points are subtracted to obtain a first result; then they are added to obtain a second result; finally, the first and second results are divided, and the resulting value is used as the modulation transfer function. In other words, the modulation transfer function is: MTF = (Maximum Brightness - Minimum Brightness) / (Maximum Brightness + Minimum Brightness). The modulation transfer function is a function describing the modulation degree as a function of spatial frequency. Initially, the modulation transfer function was used to describe the capabilities of a lens. In various camera lenses, the MTF curve is frequently used to describe the lens's capabilities. The modulation transfer function can also be used to evaluate the resolution of the entire imaging system.
[0105] In another embodiment of the present invention, the adaptive SFR card recognition method is described from the perspective of data flow, such as... Figure 4 As shown, it includes:
[0106] After acquiring images from the SFR image card, the card's components are analyzed. Specifically, principal component analysis can be used to reduce the dimensionality of flat and textured regions, as well as to identify the square located at the center of the image. The specific execution method is the same as described above. When identifying the central square, interference factors such as image brightness, graphic distortion, and occlusion may cause the identification of the central square to fail. In this case, the threshold can be adaptively adjusted, and the identification of the central square can be repeated until it is successfully identified, and then MTF calculation can be performed.
[0107] This method effectively solves the problem of accurately identifying the position of the color card under different lighting conditions and when the card is occluded.
[0108] In a second aspect of the invention, a device for identifying SFR chart cards is provided, such as... Figure 5 As shown, it includes:
[0109] Image acquisition module 501 is used to acquire images from a spatial frequency response chart.
[0110] The first mask module 502 is used to identify flat areas and textured areas in the image using a first scale parameter threshold, thereby obtaining a first mask image;
[0111] In this invention, the first mask module 502 is used to identify flat areas and textured areas in the image using principal component analysis; it is also used to adjust the image to a preset size, calculate the derivative of the two-dimensional coordinate values of the image, scan the entire image using small blocks of preset pixels, record the gradient values of each small block in the x and y directions, perform singular value decomposition, reduce the matrix of the original preset pixels to the target pixel, and use the trace of the obtained matrix as the texture intensity value of the current small block;
[0112] The first mask module 502 is further configured to perform data normalization processing after obtaining the texture intensity values of all small blocks, and to judge the obtained data normalization processing result. If the texture intensity value in the data normalization processing result is less than or equal to the first scale parameter threshold, it is determined to be a flat area; if the texture intensity value in the data normalization processing result is greater than the first scale parameter threshold, it is determined to be a textured area, and the first mask image is generated based on the flat area and the textured area.
[0113] The first recognition module 503 is used to perform central square recognition on the first mask image;
[0114] In this invention, the first identification module 503 includes a processing submodule 5031 and an identification submodule 5032, wherein,
[0115] Processing submodule 5031 is used to perform image erosion and dilation preprocessing on the first mask image to remove burrs;
[0116] The recognition submodule 5032 is used to recognize all the square outlines in the first mask image and obtain the coordinates of the center square.
[0117] Furthermore, the processing submodule 5031 is used to scan all pixels of the first mask image using a pre-set structuring element, perform an AND operation between the structuring element and each corresponding point in the binary image covered by the structuring element, set the pixel value of the point according to the operation result, and obtain the eroded image.
[0118] The processing submodule 5031 is also used to scan each pixel of the binary image with the structuring element, perform an "OR" operation between the structuring element and each corresponding point in the binary image it covers, set the pixel value of the point according to the operation result, and obtain the dilated image.
[0119] The processing submodule 5031 is also used to treat all branches and burrs as branches of different lengths in the image obtained after dilation, and to determine that the branch length is less than the predetermined length as a burr and remove the burr.
[0120] Furthermore, the recognition submodule 5032 is used to perform Gaussian blur processing on the first mask image, smooth and reduce noise, sharpen edges, detect potential contours, filter the detected quadrilaterals based on the fact that the detected potential contours are approximately polygons, remove squares that do not meet the preset filtering conditions, and obtain the squares located near the center of the image and their coordinates.
[0121] Furthermore, the recognition submodule 5032 includes a Gaussian blur processing unit, which takes the average value of the surrounding pixels for each pixel, takes the average value of the surrounding points for the center point, takes the center point as the origin, assigns weights to other points according to their positions on the normal curve, obtains a weighted average value, derives a two-dimensional Gaussian function based on the one-dimensional Gaussian function, calculates the weight of each point based on the one-dimensional Gaussian function, multiplies the gray value of each pixel by its own weight and adds the result to obtain the Gaussian blur value of the center point, performs the same operation on each pixel, and finally obtains the Gaussian blurred image.
[0122] Furthermore, the recognition submodule includes a 5032 contour analysis unit, which is used to scan the binary image of the Gaussian blurred image using a raster, obtain the pixel points that meet the initial point conditions for boundary tracking, generate and record the boundary sequence number, obtain the parent boundary based on the boundary sequence number, track the entire boundary, and the raster restarts scanning until the entire image is scanned, thereby obtaining the potential contour of the image.
[0123] The adjustment module 504 is used to adjust the first scale parameter threshold according to a preset method to generate the second scale parameter threshold when the central square recognition fails.
[0124] In this invention, the adjustment module 504 is used to calculate the sigma value of the texture region based on the identified texture region mask, subtract the sigma value of the texture region from the average sigma value of the image, and use the calculated result as the second scale parameter threshold.
[0125] The second mask module 505 is used to identify flat areas and textured areas according to the second scale parameter threshold and generate a second mask image.
[0126] In this invention, the second mask module 505 is used to perform pixel dimensionality reduction processing on the image using principal component analysis, and to judge the normalization result of the obtained texture intensity value data. If the texture intensity value in the normalization result is less than or equal to the second scale parameter threshold, it is determined to be a flat region; if the texture intensity value in the normalization result is greater than the second scale parameter threshold, it is determined to be a textured region. The second mask image is generated based on the flat region and the textured region.
[0127] In another embodiment of the present invention, the second mask module 505 may also be used to perform the step of generating the second scale parameter threshold a preset number of times to generate the second mask image.
[0128] The second recognition module 506 is used to perform central square recognition on the second mask image;
[0129] In this invention, the second recognition module 506 is used to perform the same method as the first recognition module 503 for recognizing the center square of the second mask image.
[0130] The modulation transfer module 507 is used to calculate the modulation transfer function when the central square is successfully identified, and to perform noise reduction and smoothing on the obtained modulation transfer function calculation result to obtain the final spatial frequency response chart.
[0131] Furthermore, the modulation transfer module 507 is used to obtain the maximum brightness point and the minimum brightness point when the central square is successfully identified, subtract the maximum brightness from the minimum brightness to obtain the first calculation result, add the maximum brightness from the minimum brightness to obtain the second calculation result, and divide the first calculation result and the second calculation result to obtain the calculation result as the modulation transfer function; the modulation transfer module 507 is also used to perform noise reduction and smoothing processing on the obtained modulation transfer function calculation result to obtain the final spatial frequency response chart.
[0132] In a third aspect of the present invention, an electronic device is provided, as described below. Figure 6 The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of the present disclosure. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0133] like Figure 6As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the electronic device. The processing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0134] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0135] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.
[0136] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0137] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0138] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0139] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: receive a voice signal from a first device; parse the voice signal to obtain a second device identifier and a second device control command; send the second device control command to the second device according to the second device identifier; receive the execution result of the second device control command from the second device; and send the execution result of the second device control command to the first device.
[0140] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0141] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0142] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0143] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0144] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0145] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0146] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0147] It should be understood that the above detailed description of the technical solutions of the present invention with reference to preferred embodiments is illustrative and not restrictive. Those skilled in the art can modify the technical solutions described in the embodiments or make equivalent substitutions for some of the technical features based on reading this specification; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying SFR charts, characterized in that, include: Acquire spatial frequency response graph images; The first scale parameter threshold is used to identify flat areas and textured areas in the image card to obtain a first mask image; Perform center square recognition on the first mask image; In the event that the central square recognition fails, the first scale parameter threshold is adjusted according to a preset method to generate a second scale parameter threshold. Based on the second scale parameter threshold, flat areas and textured areas are identified, and a second mask image is generated; Perform center square recognition on the second mask image; If the central square is successfully identified, the modulation transfer function is calculated, and the obtained modulation transfer function calculation result is subjected to noise reduction and smoothing to obtain the final spatial frequency response chart. The step of identifying flat and textured regions in the image using a first scale parameter threshold to obtain a first mask image includes: identifying flat and textured regions in the image using principal component analysis; adjusting the image to a preset size, calculating the derivative of the two-dimensional coordinates of the image, scanning the entire image using small blocks of preset pixels, recording the gradient values of each small block in the x and y directions, performing singular value decomposition, reducing the original matrix of preset pixels to the target pixel, and using the trace of the resulting matrix as the texture intensity value of the current small block; after obtaining the texture intensity values of all small blocks, performing data normalization processing, and judging the obtained data normalization processing result; if the texture intensity value in the data normalization processing result is less than or equal to the first scale parameter threshold, it is determined to be a flat region; if the texture intensity value in the data normalization processing result is greater than the first scale parameter threshold, it is determined to be a textured region; and generating a first mask image based on the flat and textured regions. The step of identifying flat and textured regions based on the second scale parameter threshold and generating a second mask image includes: performing pixel dimensionality reduction processing on the image using principal component analysis, and judging the normalized result of the obtained texture intensity value data. If the texture intensity value in the normalized data result is less than or equal to the second scale parameter threshold, it is determined to be a flat region; if the texture intensity value in the normalized data result is greater than the second scale parameter threshold, it is determined to be a textured region. The second mask image is then generated based on the flat and textured regions.
2. The method as described in claim 1, characterized in that, The process of identifying the center square of the first mask image includes: The first mask image is preprocessed with image erosion and dilation to remove burrs, and all square contours in the first mask image are identified to obtain the coordinates of the center square.
3. The method as described in claim 2, characterized in that, The step of performing image erosion and dilation preprocessing on the first mask image to remove burrs includes, All pixels of the first mask image are scanned using a pre-set structuring element. The structuring element is then ANDed with each corresponding point in the binary image covered by the structuring element. The pixel value of the point is set according to the result of the operation to obtain the eroded image. The structuring element is used to scan each pixel of the binary image, and an "OR" operation is performed between the structuring element and each corresponding point in the binary image it covers. The pixel value of the point is set according to the operation result to obtain the dilated image. For the image obtained after dilation, all branches and burrs are considered as branches of different lengths. If the branch length is less than a predetermined length, it is determined to be a burr and the burr is removed.
4. The method as described in claim 3, characterized in that, The process of identifying all square outlines in the first mask image and obtaining the coordinates of the central square includes: The first mask image is subjected to Gaussian blur processing, smoothing and noise reduction, edge sharpening, and potential contour detection. Since the detected potential contours are approximately polygons, the detected quadrilaterals are filtered to remove squares that do not meet the preset filtering conditions, and the squares located near the center of the image and their coordinates are obtained.
5. The method as described in claim 4, characterized in that, The Gaussian blurring process on the first mask image includes: For each pixel, the average value of its surrounding pixels is taken. For the center point, the average value of its surrounding pixels is taken. The center point is taken as the origin. Other points are assigned weights according to their positions on the normal curve to obtain a weighted average value. A two-dimensional Gaussian function is derived from the one-dimensional Gaussian function. The weight of each point is calculated based on the one-dimensional Gaussian function. The gray value of each pixel is multiplied by its own weight and the result is added to obtain the Gaussian blur value of the center point. The same operation is performed on each pixel to finally obtain the Gaussian blurred image.
6. The method as described in claim 4, characterized in that, The detection of potential contours includes: scanning the binary image of the Gaussian blurred image using a raster, obtaining pixels that meet the initial point conditions for boundary tracking, generating and recording boundary sequence numbers, obtaining the parent boundary based on the boundary sequence numbers, tracking the entire boundary, and then restarting the raster scan until the entire image is scanned, thereby obtaining the potential contours of the image.
7. The method as described in claim 1, characterized in that, In the event that the central square recognition fails, the first scale parameter threshold is adjusted according to a preset method to generate a second scale parameter threshold, including: In the case where the central square recognition fails, the sigma value of the texture area is calculated based on the recognized texture area mask. The sigma value of the texture area is then subtracted from the average sigma value of the image, and the result is used as the second scale parameter threshold.
8. The method as described in claim 1, characterized in that, In the case where the central square is successfully identified, the modulation transfer function is calculated, including: If the central square is successfully identified, the maximum brightness point and the minimum brightness point are obtained. The maximum brightness point and the minimum brightness point are subtracted to obtain the first operation result. The maximum brightness point and the minimum brightness point are added to obtain the second operation result. The first operation result and the second operation result are divided to obtain the modulation transfer function.
9. A device for identifying SFR chart cards, characterized in that, include: The image acquisition module is used to acquire images from the spatial frequency response chart. The first mask module is used to identify flat areas and textured areas in the image card using a first scale parameter threshold, thereby obtaining a first mask image; The first recognition module is used to perform central square recognition on the first mask image; The adjustment module is used to adjust the first scale parameter threshold according to a preset method to generate a second scale parameter threshold when the central square recognition fails. The second mask module is used to identify flat areas and textured areas according to the second scale parameter threshold, and generate a second mask image; The second recognition module is used to perform central square recognition on the second mask image; The modulation transfer module is used to calculate the modulation transfer function when the central square is successfully identified, and to perform noise reduction and smoothing on the obtained modulation transfer function calculation result to obtain the final spatial frequency response chart. The first mask module is further configured to: identify flat areas and textured areas in the image using principal component analysis; adjust the image to a preset size; calculate the derivative of the two-dimensional coordinate values of the image; scan the entire image using small blocks of preset pixels; record the gradient values of each small block in the x and y directions; perform singular value decomposition; reduce the matrix of the original preset pixels to the target pixel; and use the trace of the obtained matrix as the texture intensity value of the current small block. After obtaining the texture intensity values of all small blocks, data normalization is performed, and the results of the data normalization are judged. If the texture intensity value in the data normalization result is less than or equal to the threshold of the first scale parameter, it is judged as a flat area. If the texture intensity value in the data normalization processing result is greater than the threshold of the first scale parameter, it is determined to be a texture region, and a first mask image is generated based on the flat region and the texture region. The second mask module is further configured to: perform pixel dimensionality reduction processing on the image card using principal component analysis, and judge the normalization processing result of the obtained texture intensity value data. If the texture intensity value in the data normalization processing result is less than or equal to the threshold of the second scale parameter, it is determined to be a flat area. If the texture intensity value in the data normalization process is greater than the threshold of the second scale parameter, it is determined to be a texture region, and a second mask image is generated based on the flat region and the texture region.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed, enables the implementation of the method as described in any one of claims 1-8.
Citation Information
Patent Citations
A method of identifying animal species
CN109165681A
An SFR automatic extraction and analysis method of a graphic card image
CN109272540A