Computer image processing method based on machine vision

By acquiring the target image under different color lights, performing grayscale value conversion and target profile optimization fit, the problem of machine vision with low recognition accuracy under different light source conditions is solved, and high-precision target profile acquisition and good environmental adaptability are achieved.

CN119991718AActive Publication Date: 2025-05-13THE ENG & TECHN COLLEGE OF CHENGDU UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510071058.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-05-13
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

When the prior art uses machine vision to extract target features, due to the influence of external light sources, the acquired target images may be different after grayscale processing, resulting in low recognition accuracy and high requirements for ambient light sources, which has limitations.

Method used

By obtaining the target images under different colors of lights, performing grayscale value conversion, the target outline is extracted, and optimized and fitted. The final high-precision target outline is generated using overlapping processing and edge optimization techniques.

Benefits of technology

It realizes the acquisition of target contours with high precision under different ambient light sources, improves image recognition accuracy, and has good environmental adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991718A_ABST
    Figure CN119991718A_ABST
Patent Text Reader

Abstract

The invention discloses a computer image processing method based on machine vision, and relates to the technical field of computer vision. According to the computer image processing method based on machine vision, target images under different colors of lamplight are obtained, gray value conversion is carried out respectively, independent extraction of target contours is carried out, and on the premise that the target images serve as references, coincidence comparison of the target contours is carried out, so that optimal fitting of the final target contours is achieved, and the target contours are extracted independently. According to the method, under the condition that defect processing does not need to be carried out on the target contours, high-precision obtaining of the target contours is achieved, the image recognition precision is high, meanwhile, good environment adaptability is achieved, and through stacking analysis of the multiple target contours, after the fixed contour part is determined, the target contours can be obtained more accurately. The non-fixed contour with the highest similarity is adopted as the unique fitting contour for the non-fixed contour part, the obtained final target contour can be more fit with the actual target contour in the target image, and the method has the advantages of being high in precision and efficient in processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer vision, and in particular to a computer image processing method based on machine vision. Background Art

[0002] The machine vision inspection system uses a CCD camera to convert the inspected target into an image signal, which is transmitted to a dedicated image processing system and converted into a digital signal based on pixel distribution, brightness, color and other information. The image processing system performs various operations on these signals to extract the target's features, such as area, quantity, position, and length, and then outputs the results based on the preset tolerances and other conditions, including size, angle, number, pass / fail, presence / absence, etc., to achieve automatic recognition.

[0003] When machine vision is conventionally used for target feature extraction, due to the influence of external light sources, the grayscale image obtained after grayscale processing may be different from the target image, which leads to low recognition accuracy when performing target feature recognition. In order to obtain high-precision feature recognition results, high requirements are placed on the ambient light source, which limits image processing. For this reason, a computer image processing method based on machine vision is proposed. By acquiring target images under different colors of light and converting the grayscale values, the target contour is optimized and fitted. The image recognition accuracy is high and the method has good environmental adaptability. Summary of the invention

[0004] In view of the shortcomings of the prior art, the present invention provides a computer image processing method based on machine vision, which solves the problem that when conventional machine vision is used to extract target features, due to the influence of external light sources, the grayscale image obtained after grayscale processing may be different from the grayscale image obtained by the acquired target image, which in turn leads to low recognition accuracy when performing target feature recognition. In order to obtain feature recognition results with higher accuracy, higher requirements are placed on the ambient light source, which limits the problem of image processing.

[0005] To achieve the above objectives, the present invention is implemented through the following technical solutions: a computer image processing method based on machine vision, specifically comprising the following steps:

[0006] S1. Use a CCD camera to obtain the target image to be analyzed, and obtain the target image of the corresponding color light under the conditions of different color lights;

[0007] S2, performing grayscale processing on a plurality of target images to obtain a plurality of grayscale images;

[0008] S3, extracting the target contour from the grayscale image, and obtaining several optimized target contours after preprocessing;

[0009] S4. Overlapping several optimized target contours and performing edge optimization to obtain a final target contour.

[0010] The present invention is further configured as follows: the method for acquiring the target image in S1 includes:

[0011] A1. Set the lighting positions and the order of lighting of different colors. After the lights of different colors arrive at the lighting positions, they will illuminate the target at fixed brightness and angles.

[0012] A2. Collect the specific parameters of the CCD camera when it can capture the target high-definition image under different color lights, and use them as the adjustment parameters of the corresponding color lights;

[0013] A3. After the target arrives at the preset shooting point, illuminate the target in the order of illumination. During the process, adjust the parameters of the CCD camera according to the adjustment parameters to obtain the target image under different color lights.

[0014] The present invention is further configured as follows: the acquisition of the grayscale image in S2 includes:

[0015] Get the R, G, and B components of each pixel in the target image and calculate the grayscale value of the corresponding pixel:

[0016] H=a×R+b×G+c×B

[0017] In the formula, H is the grayscale value, R is the red light value, G is the green light value, B is the blue light value, a is the weight of the red light value, preferably 0.298, b is the weight of the green light value, preferably 0.589, and c is the weight of the blue light value, preferably 0.113.

[0018] The present invention is further configured as follows: the method for extracting the target contour in S3 includes:

[0019] Use the Canny algorithm to mark points with significant brightness changes from the grayscale image as boundary points.

[0020] Connect adjacent boundary points to generate the target contour.

[0021] The present invention is further configured as follows: the preprocessing in S3 includes using a Gaussian filter to perform noise reduction processing on the extracted target contour.

[0022] The present invention is further configured as follows: the overlapping processing in S4 includes:

[0023] B1, highlighting the target contour in the grayscale image converted from the corresponding target image;

[0024] B2, stacking several target contours with the target image as reference;

[0025] B3. Filter out the common overlapping parts of several target contours as fixed contours, filter out the fitting contours in the non-fixed contours, and generate the target contour to be optimized.

[0026] The present invention is further configured as follows: the screening of the fitting profile in B3 includes:

[0027] The non-fixed contour parts in different target contours are highlighted and marked as contours to be analyzed, and the contours to be analyzed corresponding to several target images are classified according to spatial coordinates;

[0028] Use the Euclidean distance between contours to compare the similarity of contours to be analyzed in the same category, and score the contours to be analyzed based on the similarity comparison results, where the similarity comparison results are positively correlated with the scores;

[0029] The profile to be analyzed with the highest score among the profiles to be analyzed of the same category is selected as the unique fitting profile corresponding to the category.

[0030] The present invention is further configured as follows: the edge optimization in S4 includes smoothing the contour of the target to be optimized.

[0031] The present invention provides a computer image processing method based on machine vision, which has the following beneficial effects:

[0032] (1) The present invention obtains target images under different color lights, converts the grayscale values ​​respectively, and then extracts the target contour separately. Under the premise of using the target image as a reference, the target contour is overlapped and compared to achieve the optimal fitting of the final target contour. This method can achieve high-precision acquisition of the target contour without defect processing of the target contour. It has high image recognition accuracy and good environmental adaptability.

[0033] (2) The present invention performs stacking analysis on several target contours. After determining the fixed contour part, the non-fixed contour with the highest similarity is used as the only fitting contour for the non-fixed contour part to achieve the acquisition of the final target contour. This method has the advantages of high precision and efficient processing. The final target contour can be more closely aligned with the actual target contour in the target image. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a schematic diagram of the process of the present invention;

[0035] Figure 2 It is a schematic diagram of the process of acquiring the target image of the present invention;

[0036] Figure 3 It is a schematic diagram of the process of overlap processing of the present invention. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] See also Figure 1-3 , the embodiment of the present invention provides the following technical solutions:

[0039] Embodiment 1

[0040] A computer image processing method based on machine vision specifically comprises the following steps:

[0041] S1. Use a CCD camera to obtain the target image to be analyzed, and obtain the target image of the corresponding color light under the conditions of different color lights;

[0042] The target image is obtained by:

[0043] A1. Set the lighting positions and the order of lighting of different colors. After the lights of different colors arrive at the lighting positions, they will illuminate the target at fixed brightness and angles.

[0044] A2. Collect the specific parameters of the CCD camera when it can capture the target high-definition image under different color lights, and use them as the adjustment parameters of the corresponding color lights;

[0045] A3. After the target arrives at the preset shooting point, illuminate the target in the order of illumination. During the process, adjust the parameters of the CCD camera according to the adjustment parameters to obtain the target image under different color lights.

[0046] S2. grayscale processing is performed on a plurality of target images to obtain a plurality of grayscale images. The grayscale images are obtained by:

[0047] Get the R, G, and B components of each pixel in the target image and calculate the grayscale value of the corresponding pixel:

[0048] H=a×R+b×G+c×B

[0049] In the formula, H is the grayscale value, R is the red light value, G is the green light value, B is the blue light value, a is the weight of the red light value, preferably 0.298, b is the weight of the green light value, preferably 0.589, and c is the weight of the blue light value, preferably 0.113.

[0050] S3. Extracting the target contour from the grayscale image. The target contour extraction method includes:

[0051] Use the Canny algorithm to mark points with significant brightness changes from the grayscale image as boundary points.

[0052] Connect adjacent boundary points to generate the target contour;

[0053] The extracted target contours are subjected to denoising using a Gaussian filter to obtain several optimized target contours.

[0054] S4, performing overlapping processing on a plurality of optimized target contours, wherein the overlapping processing comprises: obtaining the orthographic projection of the contours after the plurality of optimized target contours are overlapped, obtaining the boundary point connection line of the orthographic projection, and obtaining the target contour to be optimized;

[0055] After smoothing the target contour to be optimized, the final target contour is obtained.

[0056] In this embodiment, the final target contour obtained may include the actual target contour in the target image.

[0057] Embodiment 2

[0058] This embodiment is an improvement of the previous embodiment, a computer image processing method based on machine vision, specifically comprising the following steps:

[0059] S1. Use a CCD camera to obtain the target image to be analyzed, and obtain the target image of the corresponding color light under the conditions of different color lights;

[0060] The target image is obtained by:

[0061] A1. Set the lighting positions and the order of lighting of different colors. After the lights of different colors arrive at the lighting positions, they will illuminate the target at fixed brightness and angles.

[0062] A2. Collect the specific parameters of the CCD camera when it can capture the target high-definition image under different color lights, and use them as the adjustment parameters of the corresponding color lights;

[0063] A3. After the target arrives at the preset shooting point, illuminate the target in the order of illumination. During the process, adjust the parameters of the CCD camera according to the adjustment parameters to obtain the target image under different color lights.

[0064] S2. grayscale processing is performed on a plurality of target images to obtain a plurality of grayscale images. The grayscale images are obtained by:

[0065] Get the R, G, and B components of each pixel in the target image and calculate the grayscale value of the corresponding pixel:

[0066] H=a×R+b×G+c×B

[0067] In the formula, H is the grayscale value, R is the red light value, G is the green light value, B is the blue light value, a is the weight of the red light value, preferably 0.298, b is the weight of the green light value, preferably 0.589, and c is the weight of the blue light value, preferably 0.113.

[0068] S3. Extracting the target contour from the grayscale image. The target contour extraction method includes:

[0069] Use the Canny algorithm to mark points with significant brightness changes from the grayscale image as boundary points.

[0070] Connect adjacent boundary points to generate the target contour;

[0071] A Gaussian filter is used to perform noise reduction on the extracted target contours to obtain several optimized target contours;

[0072] S4, performing overlapping processing on a plurality of optimized target contours, specifically including:

[0073] B1, highlighting the target contour in the grayscale image converted from the corresponding target image;

[0074] B2, stacking several target contours with the target image as reference;

[0075] B3. Filter out the common overlapping parts of several target contours as fixed contours, filter out the fitting contours in the non-fixed contours, and generate the target contour to be optimized. The screening of the fitting contour includes:

[0076] The non-fixed contour parts in different target contours are highlighted and marked as contours to be analyzed, and the contours to be analyzed corresponding to several target images are classified according to spatial coordinates;

[0077] Use the Euclidean distance between contours to compare the similarity of contours to be analyzed in the same category, and score the contours to be analyzed based on the similarity comparison results, where the similarity comparison results are positively correlated with the scores;

[0078] Select the contour to be analyzed with the highest score among the contours to be analyzed of the same category as the only fitting contour corresponding to the category;

[0079] After smoothing the target contour to be optimized, the final target contour is obtained.

[0080] The advantage of this embodiment over the previous embodiment is that by stacking and analyzing several target contours, after determining the fixed contour part, the non-fixed contour with the highest similarity is used as the only fitting contour for the non-fixed contour part to achieve the acquisition of the final target contour, which has the advantages of high precision and efficient processing, and the final target contour can be more closely aligned with the actual target contour in the target image.

[0081] In summary, by acquiring the target images under different color lights, converting the grayscale values ​​respectively, the target contours are extracted separately, and the target contours are overlapped and compared under the premise of taking the target images as references to achieve the optimal fitting of the final target contours. This method can achieve high-precision acquisition of the target contour without defect processing of the target contour. It has high image recognition accuracy and good environmental adaptability.

[0082] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0083] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A computer image processing method based on machine vision, characterized in that: The specific steps include: S1. Use a CCD camera to obtain the target image to be analyzed, and obtain the target image of the corresponding color light under the conditions of different color lights; S2, performing grayscale processing on a plurality of target images to obtain a plurality of grayscale images; S3, extracting the target contour from the grayscale image, and obtaining several optimized target contours after preprocessing; S4. Overlapping several optimized target contours and performing edge optimization to obtain a final target contour.

2. The method for computer image processing based on machine vision according to claim 1, characterized in that: The method of acquiring the target image in S1 includes: A1. Set the lighting positions and the order of lighting of different colors. After the lights of different colors arrive at the lighting positions, they will illuminate the target at fixed brightness and angles. A2. Collect the specific parameters of the CCD camera when it can capture the target high-definition image under different color lights, and use them as the adjustment parameters of the corresponding color lights; A3. After the target arrives at the preset shooting point, illuminate the target in the order of illumination. During the process, adjust the parameters of the CCD camera according to the adjustment parameters to obtain the target image under different color lights.

3. The method for computer image processing based on machine vision according to claim 1, characterized in that: The acquisition of the grayscale image in S2 includes: Get the R, G, and B components of each pixel in the target image and calculate the grayscale value of the corresponding pixel: H=a×R+b×G+c×B In the formula, H is the grayscale value, R is the red light value, G is the green light value, B is the blue light value, a is the weight of the red light value, preferably 0.298, b is the weight of the green light value, preferably 0.589, and c is the weight of the blue light value, preferably 0.

113.

4. The method for computer image processing based on machine vision according to claim 1, characterized in that: The method of extracting the target contour in S3 includes: Use the Canny algorithm to mark points with significant brightness changes from the grayscale image as boundary points. Connect adjacent boundary points to generate the object contour.

5. The method for computer image processing based on machine vision according to claim 4, characterized in that: The preprocessing in S3 includes using a Gaussian filter to perform noise reduction on the extracted target contour.

6. The method for computer image processing based on machine vision according to claim 1, characterized in that: The overlapping processing in S4 includes: B1, highlighting the target contour in the grayscale image converted from the corresponding target image; B2, stacking several target contours with the target image as reference; B3. Filter out the common overlapping parts of several target contours as fixed contours, filter out the fitting contours in the non-fixed contours, and generate the target contour to be optimized.

7. The method for computer image processing based on machine vision according to claim 6, characterized in that: The screening of the fitting profile in B3 includes: The non-fixed contour parts in different target contours are highlighted and marked as contours to be analyzed, and the contours to be analyzed corresponding to several target images are classified according to spatial coordinates; Use the Euclidean distance between contours to compare the similarity of contours to be analyzed in the same category, and score the contours to be analyzed based on the similarity comparison results, where the similarity comparison results are positively correlated with the scores; The profile to be analyzed with the highest score among the profiles to be analyzed of the same category is selected as the unique fitting profile corresponding to the category.

8. The method for computer image processing based on machine vision according to claim 7, characterized in that: The edge optimization in S4 includes smoothing the contour of the target to be optimized.

Citation Information

Patent Citations

  • Image contour extraction method based on binarization result of reference region

    CN115187790A

  • Robot grassland boundary identification and positioning method and mowing robot thereof

    CN115272867A

  • Gravure coating image recognition system

    CN117994532A

  • Picture projection system and picture projection device

    JP2005352171A