An image processing method, its computer-readable storage medium, and an electronic device

By dividing the image into local images, calculating and filtering feature points, the problem of uneven extraction of image feature points is solved, and the uniform distribution and representative reflection of feature points are achieved.

CN115880504BActive Publication Date: 2025-07-04SPEEDBOT ROBOTICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310024107.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-09-07
Filing Date
2023-01-09
Publication Date
2025-07-04
Estimated Expiration
2043-01-09

AI Technical Summary

Technical Problem

In the prior art, image feature points are extracted unevenly and cannot effectively reflect the overall characteristics of the image.

Method used

The feature image to be extracted is divided into multiple local images, the pixel point feature parameters of each local image are calculated, representative points are selected, representative points of the local image are counted as feature points, and some candidate feature points are filtered out according to the spacing of candidate feature points to determine the target feature points.

Benefits of technology

The uniform distribution and representativeness of feature points are achieved, which can better reflect the overall characteristics of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115880504B_ABST
    Figure CN115880504B_ABST
Patent Text Reader

Abstract

The present invention relates to an image processing method, a computer-readable storage medium, and an electronic device thereof. First, the image to be extracted with features is divided into multiple local images, and then, according to feature parameters such as the smoothness, brightness, slope, and gradient of pixel points in the image, one or more representative points are selected as feature points in each image. The key is to statistically determine the representative points of each local image as the feature points of the image to be extracted with features based on the principle of hypothesis consistency of feature parameters of the local images, which has both representativeness and generalization, and can ensure that the feature points are evenly distributed to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition, and in particular to an image processing method. Background Art

[0002] In smart factories, workpiece recognition is the primary premise and basis for tasks such as automatic sorting, assembly, coding, and grasping. Image processing methods for extracting feature points are the primary premise and basis for workpiece recognition. Therefore, how to efficiently and accurately extract image feature points is a hot topic and focus of current research.

[0003] In the prior art, image feature points are mostly extracted based on image features, neural network models, etc. However, no matter which method is used, there is a problem of uneven feature point extraction, which cannot well reflect the overall characteristics of the image. Therefore, how to extract image features uniformly is an important problem that needs to be solved in the current image processing field. Summary of the invention

[0004] In order to solve the above technical problems, the present invention provides an image processing method for extracting feature points, comprising:

[0005] T1: Divide the feature image to be extracted into multiple local images;

[0006] T2: Calculate the characteristic parameters of each pixel of the local image;

[0007] T3: Determine the representative point of each local image according to the characteristic parameters of the pixel points of each local image;

[0008] T4: Count the representative points of all local images as the feature points of the feature image to be extracted.

[0009] Furthermore, it also includes: T5, setting the feature points determined in T4 as candidate feature points; screening out some candidate feature points according to the feature parameters of the candidate feature points to determine the target feature points of the feature image to be extracted, and taking the target feature points as the feature points finally selected for the feature image to be extracted.

[0010] Further, T5 is specifically: according to the spacing of the candidate feature points, the candidate feature points whose spacing does not exceed the set threshold are screened out to determine the target feature points of the feature image to be extracted.

[0011] Furthermore, the characteristic parameters include: one or more of gradient direction, gradient amplitude, slope, and brightness.

[0012] Further, T2 specifically includes: calculating the gradient direction and gradient magnitude of each pixel point in the local image; step T3 specifically includes: based on the gradient direction and gradient magnitude of each pixel point in the local image, selecting the pixel point with the highest gradient direction vote count or the smallest difference from the mean gradient direction, and the largest gradient magnitude or the smallest difference from the mean gradient magnitude in each local image as the representative point.

[0013] Further, T5 includes:

[0014] T51: Sort all candidate feature points in descending order according to the gradient magnitude of the candidate feature points and number them as P q ; q = 1...p, where p is the number of candidate feature points;

[0015] T52: Let q = 1;

[0016] T53: Determine whether the distance between candidate feature point P q+1 and candidate feature point P q is greater than the set threshold;

[0017] T54: If the distance is not greater than the set threshold, then filter out candidate feature point P q+1 ; and let q = q + 1; determine whether q is greater than p. If q is not greater than p, then return to step T53. If q is greater than p, then end;

[0018] T55: If the distance is greater than the set threshold, then retain candidate feature point P q+1 ; and let q = q + 1; determine whether q is greater than p. If q is not greater than p, then return to step T53. If q is greater than p, then end.

[0019] Further, the set threshold is the ratio of the number of candidate feature points to the number of target feature points.

[0020] On the other hand, the present invention also provides a computer-readable storage medium storing computer-executable program code; the computer-executable program code is used to execute any of the above image processing methods.

[0021] On the other hand, the present invention also provides an electronic device including a memory and a processor; the memory stores program code executable by the processor; the program code is used to execute any of the above image processing methods.

[0022] The image processing method, computer-readable storage medium, and electronic device of the present invention first divide the image from which features are to be extracted into multiple local images, and then, based on feature parameters such as the smoothness, brightness, slope, and gradient of pixel points in the image, select one or more representative points in each image as feature points. The key lies in the principle of assuming consistency of feature parameters for local images, and statistically taking the representative points of each local image as the feature points of the image from which features are to be extracted, which is both representative and generalizable, and can ensure that the feature points are evenly distributed to a certain extent. Description of the Drawings

[0023] Figure 1 It is a flowchart of an embodiment of the image processing method of the present invention. Detailed Embodiment

[0024] As Figure 1 shown, the present invention provides an image processing method for extracting feature points, including:

[0025] T1: Divide the image from which features are to be extracted into multiple local images; specifically, optionally but not limited to sliding a window within the image from which features are to be extracted to divide it into multiple local images. By way of example, taking the image from which features are to be extracted as an image of 15×15 pixels, optionally but not limited to selecting a window of 3×3 size, and sliding the window in the 15×15 image from which features are to be extracted to divide the 15×15 image from which features are to be extracted into 25 local images, each local window being a local image of 3×3 size, and each local image including 9 pixel points.

[0026] T2: Calculate the feature parameters of the pixel points of each local image; specifically, optionally but not limited to calculating one or more of the gradient direction, gradient amplitude, slope, brightness, etc. of each pixel point as the feature parameters of the pixel points of each local image.

[0027] T3: Determine the representative points of each local image according to the feature parameters of the pixel points of each local image;

[0028] T4: Statistically take the representative points of all local images as the feature points of the image from which features are to be extracted. Specifically, optionally but not limited to, according to the feature parameters of the pixel points, select one or several representative points from the 9 pixel points of each of the above local images, and statistically take the representative points of all local images as the feature points of the image from which features are to be extracted.

[0029] In this embodiment, an image processing method for extracting feature points is provided. First, the feature image to be extracted is divided into multiple local images. Then, based on feature parameters such as the smoothness, brightness, slope, and gradient of pixel points in the image, one or more representative points are selected as feature points in each image. The key is to statistically determine the representative points of each local image as the feature points of the feature image to be extracted based on the principle of assumed consistency of feature parameters of local images, which is both representative and generalizable, and can ensure that the feature points are evenly distributed to a certain extent. More specifically, steps T1 - T4 can be optionally but not limited to being executed one or more times. For example, for the above-mentioned 15 * 15 feature image to be extracted, optionally but not limited to, first using a 3 * 3 window size, the feature image to be extracted is divided into 25 local images, each local image includes 9 pixel points. Taking the example of selecting one representative pixel point as the representative point for each local image according to the feature parameters of the pixel points (multiple representative points can also be selected), a total of 25 representative points are obtained as the feature points of the feature image to be extracted. On this basis, steps T1 - T4 can be executed again, using a 5 * 5 window size (larger and wider in scope than the previous window), to divide the feature image to be extracted into 9 local images, each local image includes 25 pixel points (at this time, each local image may include one or more previously selected representative points, or may not include representative points). According to the feature parameters of the pixel points, 9 more representative feature points are selected from the already selected 25 feature points as the feature points of the feature image to be extracted. It should be noted that the above example is for explanation by taking one representative point in each local image. Those skilled in the art can understand that multiple representative points can also be optionally but not limited to being selected in each local image. For example, in 25 local images, 2 representative points are selected for each local image, resulting in 50 representatives.

[0030] More specifically, in a preferred embodiment, optionally but not limited to, the gradient direction and gradient magnitude of pixel points are used as the feature parameters of pixel points, but it is not limited to this.

[0031] Specifically, step T2 can be, but is not limited to, specifically: calculating the gradient direction and gradient magnitude of each pixel point in the local image; specifically, optionally but not limited to, calculating its gradient direction and gradient magnitude along the X and Y directions according to each pixel point. More specifically, for the convenience of subsequent calculations, the gradient direction can be, optionally but not limited to, quantified into k directions according to the angle, represented by direction 1 to direction k; for example, taking the gradient direction quantified into 8 directions as an example, optionally but not limited to, collectively referring to 0-22.5° as direction 1, 22.5°-45° as direction 2, 45°-67.5° as direction 3, 67.5°-90° as direction 4, 90°-112.5° as direction 5, 112.5°-135° as direction 6, 135°-157.5° as direction 7, 157.5°-180° as direction 8, quantifying the gradient direction into 8 directions is convenient for storing with an 8-bit binary string. For example, representing direction 1 as 00000001, direction 2 as 00000010... etc., to accelerate subsequent calculations and improve the robustness of the algorithm. More specifically, the specific quantization quantity, quantization form, whether it is equally divided, etc. of the gradient direction can be arbitrarily set by those skilled in the art according to recognition accuracy, calculation requirements, etc., such as quantifying into 4 directions, 16 directions, or even 360 directions, with each angle as a direction, etc.

[0032] Step T3 can be, optionally but not limited to, specifically: determining the representative points of the feature image to be extracted according to the gradient direction and gradient magnitude of each pixel point in the local image.

[0033] More specifically, in a preferred embodiment, step T3 can be, optionally but not limited to, specifically: according to the gradient direction and gradient magnitude of each pixel point in the local image, selecting the pixel point with the highest gradient direction vote count and the largest gradient magnitude in each local image as the representative point; for example, taking the above example: each local image includes 9 pixel points, the process of determining the representative point of each local image can be, optionally but not limited to, voting and counting the gradient directions of the 9 pixel points. For example, assuming the voting result shows that: direction 2 has 3 votes, direction 4 has 5 votes, and direction 6 has 1 vote, then first select the pixel point corresponding to the direction 4 with the highest vote count (the pixel point corresponding to 5 votes), and then select one or more pixel points with the largest gradient magnitude among these 5 pixel points (that is, the pixel point ranked first in gradient magnitude or the top several pixel points) as the representative point of this local image.

[0034] In this embodiment, the gradient direction and gradient magnitude of the selected pixel points are used as the characteristic parameters of the pixel points and serve as the evaluation indicators for whether a pixel point is selected as a feature point. This is mainly because the gradient direction reflects the change trend of the pixel point, and the gradient magnitude reflects the strength of the pixel point. It is representative and generalizable, and is a preferred embodiment for determining feature points. However, those skilled in the art can understand that the characteristic parameter indicators for determining feature points are not limited to this gradient direction and gradient magnitude. For example, inflection points, slopes, etc. can be used as characteristic parameters. More specifically, taking the pixel point with the highest gradient direction vote count and the largest gradient magnitude as the representative point is also an example for illustration. Those skilled in the art can understand that in addition to the highest vote count in terms of direction, in other embodiments, the pixel point with the smallest difference from the average gradient direction can also be considered as the representative point. Similarly, for the gradient magnitude, the average value, etc. can also be considered. How to specifically determine the representative point based on the gradient direction and gradient magnitude can be set by those skilled in the art according to the selection rules. Only a preferred embodiment is given here.

[0035] More specifically, to screen out some unobservable feature points in step T4, this image processing method may also optionally but not limited to include T5: setting the feature points determined in step T4 as candidate feature points; screening out some candidate feature points according to the characteristic parameters of the candidate feature points to determine the target feature points of the feature image to be extracted, and taking the finally determined target feature points as the finally selected feature points of the feature image to be extracted.

[0036] In this embodiment, this image processing method also adds a step of further optimizing and screening among the feature points determined in the previous step according to the characteristic parameters of the candidate feature points to determine the final feature points. This can further optimize and update the feature points on the basis of the above-mentioned zoning and selection of local representative points, further ensuring the uniform distribution of the feature points, which is both holistic and representative. Specifically, it may optionally but not limited to screen the candidate feature points according to the characteristic parameters of the candidate feature points such as the position of the candidate feature points and the distance between adjacent candidate feature points.

[0037] Preferably by way of example, in step T5, it may optionally but not limited to screen out the candidate feature points with a spacing not exceeding the set threshold according to the spacing between the candidate feature points to determine the target feature points of the feature image to be extracted. In this embodiment, a specific embodiment of step T5 is given, using the spacing between the candidate feature points as the characteristic parameter to screen out some candidate feature points, filtering the candidate feature points by distance to ensure their relatively uniform distribution on the image, so as to more objectively and effectively reflect the features of the feature image to be extracted.

[0038] More preferably, step T5 may optionally but not limited to include:

[0039] T51: Sort all candidate feature points in descending order according to the gradient magnitude of the candidate feature points and number them as Pq ; q = 1…p, where p is the number of candidate feature points;

[0040] T52: Let q = 1;

[0041] T53: Determine whether the distance between candidate feature point P q+1 and candidate feature point P q is greater than the set threshold;

[0042] T54: If not, then filter out candidate feature point P q+1 ; and let q = q + 1; Determine whether q is greater than p. If not, return to step T53. If so, end; In this step, through threshold judgment, points that are relatively close to candidate feature point P q can all be filtered out.

[0043] T55: If so, then retain candidate feature point Pq + 1; and let q = q + 1; Determine whether q is greater than p. If not, return to step T53. If so, end. In this step, through threshold judgment, points that are relatively far from candidate feature point P q and exceed the set threshold can all be retained, that is, the finally determined target feature points to be retained.

[0044] In this embodiment, a specific implementation manner of how step T5 filters out candidate feature points and determines the final feature points is given. Filter out feature points whose distance does not exceed the set threshold to ensure that the feature points are evenly distributed on the feature image to be extracted, can reflect the overall features of the feature image to be extracted, avoid reflecting only the features of some local images, and are more representative and global in reflecting the features of the feature image to be extracted. More specifically, the set threshold of this distance can be selected but not limited to being determined according to the number of candidate feature points and the number of target feature points, and can be selected but not limited to using the ratio of the two as the set threshold of the distance.

[0045] It should be noted that steps T51 - T55 are only a specific example of the candidate feature point screening rule, but not limited thereto. Again, for example, steps T52 - T55 can also be selected but not limited to being replaced with:

[0046] Taking candidate feature point P q as the center and the set threshold as the radius, delimit the ownership space of candidate feature point P q and delete all other candidate feature points within the ownership space; that is, only retain the candidate feature point with the largest gradient magnitude within this ownership space;

[0047] Among the candidate feature points arranged in descending order, find the candidate feature point with the largest gradient magnitude among the candidate feature points except those that have been compared and screened out. Then, with this candidate feature point as the center and a set threshold as the radius, delimit the ownership space for this candidate feature point, and delete all other candidate feature points within the ownership space; that is, only retain the candidate feature point with the largest gradient magnitude within this ownership space. Repeat the above steps until all candidate feature points have been traversed and compared to obtain the finally determined target feature points.

[0048] On the other hand, the present invention also provides a computer-readable storage medium storing computer-executable program codes; the computer-executable program codes are used to execute any of the above image processing methods.

[0049] On the other hand, the present invention also provides an electronic device including a memory and a processor; the memory stores program codes executable by the processor; the program codes are used to execute any of the above image processing methods.

[0050] Exemplarily, the program codes can be divided into one or more modules / units, and the one or more modules / units are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the program codes in the terminal device.

[0051] The electronic device can be a computing device such as a desktop computer, a notebook, a palm computer, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the electronic device may further include input / output devices, network access devices, a bus, etc.

[0052] The processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0053] The memory may be an internal storage unit of the electronic device, such as a hard disk or a memory. The memory may also be an external storage device of the electronic device, such as a plug-in hard disk equipped on the electronic device, a SmartMedia Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Further, the memory may also include both an internal storage unit of the electronic device and an external storage device. The memory is used to store the program code and other programs and data required by the electronic device. The memory may also be used to temporarily store the data that has been output or will be output.

[0054] The above computer-readable storage medium and electronic device are created based on the above image processing method. The combination of their technical features and technical effects will not be elaborated here. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0055] The above embodiments only represent several implementation manners of the present invention. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several deformations and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the invention patent should be subject to the appended claims.

Claims

1. An image processing method for extracting feature points, characterized in that, Including: T1: Divide the feature image to be extracted into multiple local images; T2: Calculate the feature parameters of the pixel points of each local image; Specifically: Calculate the gradient direction and gradient magnitude of the pixel points of each local image; T3: Determine the representative point of each local image according to the feature parameters of the pixel points of each local image; Specifically: According to the gradient direction and gradient magnitude of the pixel points of each local image, select the pixel point with the highest gradient direction vote or the smallest difference from the mean gradient direction, and the largest gradient magnitude or the smallest difference from the mean gradient magnitude in each local image as the representative point; T4: Count the representative points of all local images as the feature points of the feature image to be extracted; T5, Set the feature points determined in T4 as candidate feature points; According to the feature parameters of the candidate feature points, screen out some candidate feature points to determine the target feature points of the feature image to be extracted, and use the target feature points as the finally selected feature points of the feature image to be extracted; Including: T51: Sort all candidate feature points in descending order according to the gradient magnitude of the candidate feature points and number them as P q ; q = 1...p, where p is the number of candidate feature points; T52: Let q = 1; T53: Determine the candidate feature point P q+1 The distance between the candidate feature point P q and whether it is greater than the set threshold value; T54: If the distance is not greater than the set threshold value, then filter out the candidate feature point P q+1 ; and let q = q + 1; determine whether q is greater than p. If q is not greater than p, then return to step T53. If q is greater than p, then end; T55: If the distance is greater than the set threshold value, the candidate feature point P will be retained q+1 ; and let q = q + 1; determine whether q is greater than p. If q is not greater than p, return to step T53. If q is greater than p, end.

2. The image processing method according to claim 1, characterized in that, T5, Specifically: According to the spacing between candidate feature points, screen out candidate feature points with a spacing not exceeding the set threshold to determine the target feature points of the feature image to be extracted.

3. The image processing method according to any one of claims 1-2, characterized in that, The feature parameters include one or more of gradient direction, gradient magnitude, slope, and brightness.

4. The image processing method according to claim 3, wherein The set threshold is the ratio of the number of candidate feature points to the number of target feature points.

5. A computer-readable storage medium, characterized in that, Store computer-executable program code; The computer-executable program code is used to execute the image processing method described in any one of claims 1-4.

6. An electronic device, characterized in that, Including a memory and a processor; The memory stores program code executable by the processor; The program code is used to execute the image processing method described in any one of claims 1-4.

Citation Information

Patent Citations

  • Image matching method, device, computer device and storage medium

    CN109101867A

  • Non-destructive testing method and system for welding defects of anechoic chamber of air conditioner based on machine vision

    CN114414599A