CN115578354A - Image processing method, apparatus, device and medium - Google Patents
Image processing method, apparatus, device and medium Download PDFInfo
- Publication number
- CN115578354A CN115578354A CN202211277120.7A CN202211277120A CN115578354A CN 115578354 A CN115578354 A CN 115578354A CN 202211277120 A CN202211277120 A CN 202211277120A CN 115578354 A CN115578354 A CN 115578354A
- Authority
- CN
- China
- Prior art keywords
- image
- region
- area
- target object
- segmented
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 15
- 230000007547 defect Effects 0.000 claims abstract description 94
- 238000000034 method Methods 0.000 claims abstract description 50
- 238000012545 processing Methods 0.000 claims description 50
- 238000001914 filtration Methods 0.000 claims description 20
- 230000002950 deficient Effects 0.000 claims description 15
- 238000004891 communication Methods 0.000 claims description 12
- 238000007781 pre-processing Methods 0.000 claims description 6
- 238000005520 cutting process Methods 0.000 claims description 5
- 238000003709 image segmentation Methods 0.000 claims description 5
- 238000003860 storage Methods 0.000 claims description 3
- 238000001514 detection method Methods 0.000 abstract description 18
- 238000010586 diagram Methods 0.000 description 15
- 238000011179 visual inspection Methods 0.000 description 13
- 230000008569 process Effects 0.000 description 12
- 230000011218 segmentation Effects 0.000 description 9
- 238000000605 extraction Methods 0.000 description 8
- 238000004458 analytical method Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 238000007689 inspection Methods 0.000 description 4
- 238000004519 manufacturing process Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 238000012935 Averaging Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000012937 correction Methods 0.000 description 2
- 238000009826 distribution Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 2
- 238000010191 image analysis Methods 0.000 description 2
- 230000001681 protective effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000877 morphologic effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
- G06T7/0006—Industrial image inspection using a design-rule based approach
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The application provides an image processing method, an apparatus, a device and a medium, wherein the method comprises the following steps: denoising a target image to obtain a denoised image, wherein the target image is an image obtained by image acquisition of a target object; extracting a local threshold of the denoised image, and segmenting the denoised image according to the local threshold to obtain a segmented image, wherein the segmented image comprises characteristic information of the target object; extracting defect areas in the segmented image, and combining all the defect areas to obtain a new image; and extracting a skeleton region in the new image, and determining whether the target object is qualified or unqualified according to the skeleton region. According to the technical scheme, the efficiency of detecting the appearance flaws of the electronic product can be improved, the labor cost is reduced, and the stability and the accuracy of detection are higher.
Description
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an image processing method, an image processing apparatus, an image processing device, and an image processing medium.
Background
With the progress of technology, electronic products are more and more widely used, for example, mobile phones, tablet computers, wearable devices, and the like are widely used in daily life. In the production process of electronic products, a process is usually provided to detect whether there is a defect in the appearance of the electronic product, and the electronic product with the defect is regarded as an unqualified product.
In the prior art, at present, the qualified inspection of the appearance of electronic products mostly depends on manual visual inspection.
However, the visual inspection workload is often large, and the manual visual inspection is easily affected by subjective judgment, so that the situations of false inspection and missed inspection are easily caused, and the qualified detection effect is poor.
Disclosure of Invention
The application provides an image processing method, an image processing device and an image processing medium, which are used for solving the problems of poor detection effect and poor appearance of the existing manual visual inspection electronic product.
In a first aspect, an embodiment of the present application provides an image processing method, including:
denoising a target image to obtain a denoised image, wherein the target image is an image obtained by image acquisition of a target object;
extracting a local threshold of the denoised image, and segmenting the denoised image according to the local threshold to obtain a segmented image, wherein the segmented image comprises characteristic information of the target object;
extracting defect areas in the segmented image, and combining all the defect areas to obtain a new image;
and extracting a skeleton region in the new image, and determining whether the target object is qualified or unqualified according to the skeleton region.
In a second aspect, an embodiment of the present application provides an image processing apparatus, including:
the image denoising module is used for denoising a target image to obtain a denoised image, wherein the target image is an image obtained by image acquisition of a target object;
the image segmentation module is used for extracting a local threshold of the denoised image and segmenting the denoised image according to the local threshold to obtain a segmented image, wherein the segmented image comprises the characteristic information of the target object;
the image merging module is used for extracting the defect areas in the segmented image and merging all the defect areas to obtain a new image;
and the image judging module is used for extracting a skeleton region in the new image and determining whether the target object is qualified or unqualified according to the skeleton region.
In a third aspect, an embodiment of the present application provides a computer device, including: a processor, and a memory communicatively coupled to the processor; the memory stores computer-executable instructions; the processor executes computer-executable instructions stored by the memory to implement the method as described above.
In a fourth aspect, the present application provides a computer-readable storage medium, in which computer instructions are stored, and when executed by a processor, the computer instructions are used to implement the method described above.
According to the image processing method, the image processing device, the image processing equipment and the image processing medium, the processed image is obtained by performing operations such as denoising processing, threshold segmentation, defect extraction and merging, skeleton extraction and the like on the target image, whether flaws exist or not and whether the electronic product is qualified or not can be determined by analyzing the appearance of the electronic product based on the processed image, and compared with manual visual inspection, the image processing method, the image processing device, the image processing equipment and the image processing medium can improve the efficiency of appearance detection, reduce labor cost and have higher detection stability and accuracy.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application;
fig. 1 is a schematic view of a scene of product appearance detection provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of an image processing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a denoised image according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a connected image according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a filtered defect region provided in an embodiment of the present application;
FIG. 6 is a schematic diagram of a defect region after an expansion process provided by an embodiment of the present application;
FIG. 7 is a schematic diagram of an image to be processed according to an embodiment of the present disclosure;
fig. 8 is a schematic flowchart of an image processing method according to another embodiment of the present application;
fig. 9 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of example in the drawings and will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
At present, when the appearance of the produced electronic product is detected, manual visual inspection is mostly relied on, and if the appearance is found to have larger flaws through the manual visual inspection, the electronic product can be marked as unqualified. In the actual production process of electronic products, the number of electronic products needing visual inspection is often large, detection personnel are often easy to fatigue and are influenced by human subjectivity, the stability of the manual visual inspection cannot be guaranteed, and some small flaws cannot be basically detected completely by means of manual work. This results in poor manual visual inspection.
In order to solve the problem of poor manual visual inspection effect, an intelligent detection system is adopted for automatic detection. Specifically, the appearance of a target object (namely, an electronic product) is shot through a camera to obtain a target image, then the target image is subjected to denoising processing, threshold segmentation, defect extraction and merging, skeleton extraction and other operations through an intelligent detection system to obtain a processed image, the appearance of the electronic product is analyzed based on the processed image, and whether flaws exist or not and whether the electronic product is qualified or not can be determined. This application is examined for the manual work, can improve the efficiency that the outward appearance detected, reduces the cost of labor, and the stability and the degree of accuracy that detect simultaneously are higher.
The technical solution of the present application will be described in detail below with reference to specific examples. It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
For example, fig. 1 is a scene schematic diagram of product appearance detection provided in an embodiment of the present application, and as shown in fig. 1, an intelligent visual inspection system may be mounted in a computer device 10, where the intelligent visual inspection system is configured to process an image captured by a camera on a fixture 11. Wherein, a product production line can be arranged below the camera, and the product production line comprises the electronic product 12 to be subjected to appearance detection. Illustratively, the electronic product 12 may include a mobile phone, a tablet computer, a wearable device, and the like. After the camera captures the appearance image of the electronic product 12, the image is transmitted to the computer device 10, and the computer device 10 processes the appearance image to determine whether there is any defect (such as scratch, stain, and light and white dots), and if there is any defect, it may determine whether the current electronic product 12 is qualified based on a preset defect threshold.
Fig. 2 is a schematic flowchart of an image processing method according to an embodiment of the present disclosure, where the image processing method can be applied to a device with a visual detection function. Illustratively, taking a computer device as an example, as shown in fig. 2, the method may specifically include the following steps:
step S201, denoising the target image to obtain a denoised image. The target image is an image obtained by image acquisition of a target object.
In the present embodiment, the target image is an image obtained by shooting the appearance of a target object (i.e., an electronic product) by a camera. The captured image may include a front side and/or a back side of the electronic product (for example, a front display interface and a back protective case). In the process of appearance inspection, whether defects such as scratches, stains, black and white light spots exist on the display interface on the front side of the electronic product or whether defects such as scratches, stains, black and white light spots exist on the protective shell on the back side of the electronic product can be inspected.
When the target image is subjected to denoising processing, the purpose is to remove noise in the target image, so that the target image is smoother. The denoising process may include three methods as follows: filter-based methods, model-based methods, and learning-based methods. Among them, the filter-based method is to remove image noise (e.g., median filter) using an artificially designed low-pass filter, and the model-based method attempts to model the distribution of natural images or noise, and then they attempt to obtain a clear image and an optimization algorithm using the model distribution as a priori. Learning-based methods focus on learning the potential mapping of noisy images to clean images and can be divided into traditional learning-based methods and deep-network-based learning methods.
And S202, extracting a local threshold of the denoised image, and segmenting the denoised image according to the local threshold to obtain a segmented image. The segmented image comprises characteristic information of the target object.
In this embodiment, the characteristic information of the target object may refer to some defect characteristics (i.e. flaws) existing on the appearance of the electronic product, and the flaws may specifically be scratches, stains, and black and white light points. It can be understood that there may be many scratches, stains, black and white dots, and different scratches, stains, and black and white dots in the appearance of the electronic product.
The denoised image can be analyzed, a dynamic local threshold of the denoised image is calculated, and then the denoised image is segmented by the dynamic local threshold to obtain a segmented image. The segmentation aims at extracting only image characteristic information, and aims at accelerating image analysis efficiency in subsequent analysis images.
Step S203, extracting the defect regions in the segmented image, and combining all the defect regions to obtain a new image.
In this embodiment, the defect area may be an area where a defect is located, for example, a spot may be circled by a circle as the defect area. It is understood that in some scenarios, the electronic product may have a plurality of defects, thereby forming a plurality of defect regions.
Specifically, when the camera is used for imaging, some defective pixel points (namely scratches, stains and black and white light points) can fall in different areas of the target image, and after segmentation, an algorithm is added to extract all defective areas in the segmented image and combine the defective areas to obtain a new image, so that the image analysis efficiency can be accelerated in subsequent analysis images.
And step S204, extracting a skeleton region in the new image, and determining whether the target object is qualified or unqualified according to the skeleton region.
In this embodiment, the new image includes a defective region (i.e., a region where the defect is located), where the skeleton region refers to a region where the defective skeleton is located, for example, a line-shaped scratch is taken as an example, and the line-shaped scratch generally has a central axis, and the region where the central axis is located is the skeleton region.
After extraction of the skeleton region is completed, the skeleton region can be communicated, the area of a flaw is calculated based on the skeleton region, and whether an electronic product is qualified or not can be determined based on the area of the flaw and a preset threshold value. For example, taking the scratch as an example, if the area of the scratch obtained by calculation is larger than a preset threshold value, it is determined that the electronic product is unqualified. It should be noted that, when there are many defects in the appearance of the electronic product, for example, both a stain and a scratch are included, the area of any one of the defects is larger than a preset threshold value, and the electronic product is considered to be rejected.
According to the embodiment of the application, the intelligent detection system is used for carrying out operations such as denoising processing, threshold segmentation, defect extraction and merging, skeleton extraction and the like on the target image to obtain the processed image, and the appearance of the electronic product is analyzed based on the processed image to determine whether flaws exist and whether the electronic product is qualified. This application is examined for the manual work, can improve the efficiency that the outward appearance detected, reduces the cost of labor, and the stability and the degree of accuracy that detect simultaneously are higher.
In other embodiments, step S201 may be implemented by: and denoising the target image through a mean value filtering algorithm to obtain a denoised image.
In this embodiment, the principle of denoising processing of the mean filtering algorithm is a neighborhood averaging method, which calculates the pixel mean of other pixels around a target pixel to serve as the pixel value of the target pixel, and the specific formula is as follows:
where Sxy denotes the center point at (x, y), M denotes a filter window of size M × n, M = (2m + 1) (2n + 1), M and n may be equal, g (s, t) denotes the original image, and f (x, y) denotes the image obtained after mean filtering. In practice, the pixel values in the original image are replaced by an averaging method, that is, a template with the size of M is selected, the template consists of a plurality of pixels adjacent to the template, the average value of all the pixels in the template is calculated, and finally the template is filled into an output image.
According to the embodiment of the application, the target image is denoised by using the mean filtering algorithm, so that the image denoising can be rapidly realized, and the appearance detection efficiency of the electronic product is further improved.
In other embodiments, in the step S202, "segmenting the denoised image according to the local threshold to obtain the segmented image" may specifically be implemented by the following steps: acquiring a pixel value of each pixel point in the denoised image; determining the pixel value of each pixel point and the pixel values of other pixel points adjacent to each pixel point, and calculating to obtain a pixel mean value; comparing the pixel value of each pixel point with the pixel mean value; if the pixel value of the pixel point is larger than the pixel mean value, the pixel point is segmented from the denoised image; and constructing to obtain a segmented image according to the segmented pixel points, wherein the segmented pixel points are used for representing the characteristic information of the target object.
In this embodiment, the threshold is calculated for a pixel under the condition that a point in the neighborhood is centered on the pixel, and the calculation formula of each pixel threshold is as follows:
T Niblack =m+k*s
in the above formula, m is the mean value of the neighborhood window of the image, s is the standard deviation of the neighborhood window, and k is a preset correction value. T is Niblack In order to calculate the obtained pixel threshold, namely the pixel mean value corresponding to the pixel point, when the pixel value of the pixel point is greater than the pixel threshold, the value is 1, and when the pixel value is less than the pixel threshold, the value is 0, and the segmentation of the whole denoised image is realized through the difference of the value 0 or the value 1.
And constructing a segmented image which comprises the characteristic information of the target object after the pixel point with the value of 1 is segmented. The characteristic information is the above mentioned defects, such as scratches, stains, and light black and white dots.
For example, fig. 3 is a schematic diagram of a denoised image provided by an embodiment of the present application, as shown in fig. 3, the electronic product includes many defects, such as scratches, stains, and black and white light spots, in appearance. After the denoised image is segmented, the resulting segmented image includes the flaws shown in fig. 3.
In the embodiment of the application, each pixel point is independently used for calculating the pixel threshold according to the neighborhood condition of the pixel point, and the pixel point close to the neighborhood mean value m (x, y) is judged as the background, and otherwise, the pixel point is judged as the foreground; and the specific degree of similarity is determined by the standard deviation s (x, y) and the correction coefficient k, so that the flexibility of segmentation is ensured, and the accurate segmentation of the denoised image is realized.
In some embodiments, the "extracting a defective region in the segmented image" in step S203 may specifically be implemented by the following steps: performing communication processing on the segmented image to obtain a communicated image; and filtering to obtain a region with pixel deletion in the connected image as a defect region according to the area occupied by each pixel point in the connected image.
In this embodiment, the connection processing is to connect all defective pixels in the divided image, and connect the defective pixels in series, so that the defects in the divided image can be more emphasized. After the connected image is processed, the connected image can show the flaws more prominently, and at this time, an area algorithm can be used to filter out the defect area (i.e., the area where the flaws are located) from the whole connected image.
The area algorithm has the main principle that for an image without defects, the areas of pixel points on the whole surface of the image are the same, but for an image with defects, pixel points with different areas exist on the surface of the image, and the defects with large sizes and small sizes can be found by utilizing the area algorithm. For example, fig. 4 is a schematic diagram of a connected image provided in the embodiment of the present application, and as shown in fig. 4, for an image with a scratch, a plurality of pixel points are connected in series to form a line, so that the scratch is more prominent.
For example, fig. 5 is a schematic diagram of a defect area obtained by filtering according to an embodiment of the present application, and as shown in fig. 5, the defect area obtained by filtering through an area algorithm, that is, a defect existing in the appearance of an electronic product, may specifically include a scratch, a stain, a black and white light point, and the like.
The image after being divided is communicated, so that the flaws in the image after being communicated can be more prominent, and based on the area occupied by each pixel point in the image after being communicated, the area where the flaws are located can be quickly and accurately positioned, and the corresponding defect area can be found.
In other embodiments, the method may further include the steps of: and performing expansion processing on the defect area in the new image. For example, fig. 6 is a schematic diagram of a defect region after the expansion process provided in the embodiment of the present application, and as shown in fig. 6, the defect region obtained by filtering in fig. 5 is expanded, so that the area occupied by the defect region is expanded greatly. In this example, the defect region was subjected to expansion processing, and its structural element was a circle with a radius of 3.5.
The application can reduce burrs in each defect area by expanding the defect areas, and improve the accuracy of appearance detection.
In some embodiments, the step S204 may be specifically implemented by the following steps: determining a central axis of a defect area in a new image; extracting a skeleton region in a new image according to the central axis of the defect region; performing communication processing on the skeleton area to form an image to be processed; preprocessing the image to be processed, and determining an interested area in the preprocessed image to be processed, wherein the interested area comprises characteristic information of a target object; and determining whether the target object is qualified or unqualified according to the area size of the region of interest.
In this embodiment, the region where the skeleton is located may be obtained as the skeleton region for the defect region after expansion, where the skeleton region may be simply understood as the region where the central axis of the defect region is located. For example, taking the defect area as a scratch, the shape of the scratch is usually a line, and the corresponding skeleton area is an area where a central axis of the line is located.
The morphological skeleton of the image X can be obtained by selecting a proper structural element B, continuously corroding and opening X, and if S (X) represents the skeleton of X, the expression of the skeleton of the image X is:
S(X)=(XΘnB)-[(XΘnB)*B]
in the above formula, sn (X) is the nth skeleton subset of X, and N is the last iteration number before (X theta nB) operation corrodes X into empty set, that is to say(X Θ nB) indicates that X is etched with B n consecutive times, i.e.:
(XΘnB)=((...(XΘnB)ΘB)Θ...)ΘB
the purpose of communicating the obtained skeleton region is to form a new picture of the obtained skeleton region so as to reduce pixel points of an original image, and the analysis efficiency can be improved when the picture is analyzed.
In this embodiment, after performing connectivity processing on the skeleton region to obtain an image to be processed, the preprocessing operation for extracting a flaw (i.e., a region of interest) may specifically include the following steps:
step 1, initializing parameters such as a connected domain, a selection domain, a combination domain, a width, a height, an area and the like.
And 2, enclosing a characteristic area, wherein the characteristic area comprises characteristic information of the target object.
And 3, circling out flaws in the characteristic area through an ellipse, cutting out the flaws, and then filtering through binaryzation.
And 4, communicating all the ellipses and judging the areas.
And 5, judging whether the defect area in the ellipse is 0 or null, and if the defect area in the ellipse is 0 or null, determining that the target object is qualified.
And 6, if the defect area is not 0 or empty, outputting the defect area, and continuously judging whether the target object is qualified or not based on the threshold value.
According to the method and the device, the accurate interested area (namely the defect area) can be obtained by preprocessing the image to be processed, and meanwhile, whether the target object is qualified or not can be automatically judged based on the area of the interested area, so that the accuracy of appearance detection is improved.
Further, on the basis of the foregoing embodiments, in another embodiment, in the foregoing method, when determining a region of interest in the image to be processed after the preprocessing, the method may specifically include the following steps: dividing a characteristic region in the image to be processed, wherein the characteristic region comprises all characteristic information of a target object; cutting out a defect area in the characteristic area, and carrying out binarization processing on the defect area to obtain a binarization area, wherein the defect area comprises at least one piece of characteristic information of the target object; and communicating all the binarization areas to obtain communicated areas, and filtering the communicated areas to obtain an interested area.
In this embodiment, the feature region may be encapsulated using an encapsulation tool (e.g., the drawing setup tool SetDraw). Specifically, a rectangle can be formed by drawing points and lines, and a selectable area is obtained as the feature area. Wherein, all the feature information included in the feature area is all the defects existing on the appearance of the electronic product.
The method comprises the steps of cutting out one flaw in an ellipse drawing mode to serve as a defect area, and performing binarization filtering on the cut-out defect area to obtain the flaws. Exemplarily, fig. 7 is a schematic diagram of an image to be processed according to an embodiment of the present application, as shown in fig. 7, a feature region is marked off by a rectangular frame, a defect region is circled by an ellipse, and after the defect region is circled, an actual flaw, that is, a region of interest, can be obtained by filtering through a binarization process.
According to the method and the device, the defect area is cut out, the defect area is filtered through binarization processing, the accurate flaw and the flaw area can be obtained, and the accuracy of the electronic product whether qualified or not based on the area of the flaw can be ensured.
On the basis of the foregoing embodiments, in other embodiments, in the foregoing method, when "the target object is determined to be qualified or unqualified according to the area size of the region of interest", the method may specifically be implemented by the following steps: determining whether the area of the region of interest is equal to a preset threshold value; if the area of the region of interest is equal to a preset threshold value, determining that the target object is qualified; if the area of the region of interest is larger than a preset threshold value, comparing the area of the region of interest with the preset threshold value; if the area of the region of interest is smaller than or equal to a preset threshold value, determining that the target object is qualified; and if the area of the region of interest is larger than a preset threshold value, determining that the target object is unqualified.
In this embodiment, the preset threshold may be 0, when the area of the region of interest is 0, the electronic product may be determined as a qualified product, when the area of the region of interest is not 0, the preset threshold may be set, for example, 50, when the preset threshold is passed, further screening may be performed, for example, the area where the defect exists in the target image a is greater than the preset threshold, the electronic product may be filtered and classified as a large defective product, and the area where the defect exists in the target image B is less than or equal to the preset threshold, the electronic product may be filtered and classified as a small defective product. Further, a large defective product may be regarded as an unqualified product, and a small defective product may be regarded as a qualified product.
According to the embodiment of the application, the preset threshold value and the preset threshold value are set, so that the target object can be classified based on the area of the flaw while whether the target object is qualified is judged, and the flexibility of appearance detection of the electronic product is improved.
Exemplarily, fig. 8 is a schematic flowchart of an image processing method according to another embodiment of the present application, and as shown in fig. 8, the method includes the following steps: and step S801, denoising and smoothing. Step S802, a local threshold is extracted. In step S803, the picture is divided for the extraction threshold. And step S804, adding an algorithm after segmentation, and then communicating. In step S805, a defective region is filtered out. In step S806, the defective areas are merged again. In step S807, the merged region is subjected to expansion processing. And step S808, adding an algorithm to solve the skeleton characteristics after expansion. And step 809, performing connection processing on the skeleton characteristics. Step S810, filtering the size defects of the picture, and judging whether the picture is qualified.
In step S801, noise may be removed from the picture through a mean filtering algorithm, so that the picture is smoother. The purpose of step S801 is to take an average value of n pieces of data before and after a certain pixel point in the picture, and separate the background colors before and after the picture. In step S803, the smoothed picture is analyzed, dynamic local thresholds of the picture are calculated, and the local thresholds are divided into maps. The purpose of dividing the picture is to extract the feature information of the picture, and also to accelerate the analysis time efficiency when the picture is analyzed. In step S806, the filtered defect regions are merged again, so as to recombine the extracted defect regions to obtain a new picture, so that the number of pixels of the whole picture is reduced, and the analysis time efficiency is increased when the picture is analyzed. Illustratively, the merging may be performed using the following formula:
G(x)=(1-α)f0(x)+αf1(x)
in the above formula, G (x) may be a merged image, and f0 (x) and f1 (x) may be defect regions of two to be merged. Wherein, alpha is a coefficient, and the value of alpha is (0, 1).
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Fig. 9 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application, where the image processing apparatus may be integrated on a computer device, or may be independent of the computer device and cooperate with the computer device to implement the present solution. As shown in fig. 9, the image processing apparatus 900 includes an image denoising module 910, an image segmentation module 920, an image merging module 930, and an image determination module 940.
The image denoising module 910 is configured to perform denoising processing on a target image to obtain a denoised image, where the target image is an image obtained by image acquisition of a target object. The image segmentation module 920 is configured to extract a local threshold of the denoised image, and segment the denoised image according to the local threshold to obtain a segmented image, where the segmented image includes feature information of the target object. The image merging module 930 is configured to extract defect regions in the segmented image, and merge all the defect regions to obtain a new image. The image determination module 940 is configured to extract a skeleton region in the new image, and determine whether the target object is qualified or unqualified according to the skeleton region.
Optionally, the image denoising module may be specifically configured to: and denoising the target image through a mean value filtering algorithm to obtain a denoised image.
Optionally, the image segmentation module may be specifically configured to: acquiring a pixel value of each pixel point in the denoised image; determining the pixel value of each pixel point and the pixel values of other pixel points adjacent to each pixel point, and calculating to obtain a pixel mean value; comparing the pixel value of each pixel point with the pixel mean value; if the pixel value of the pixel point is larger than the pixel mean value, the pixel point is segmented from the denoised image; and constructing to obtain a segmented image according to the segmented pixel points, wherein the segmented pixel points are used for representing the characteristic information of the target object.
Optionally, the image merging module may be specifically configured to: performing communication processing on the segmented image to obtain a communicated image; and filtering to obtain a defect area in the communicated image according to the area occupied by each pixel point in the communicated image.
Optionally, the image processing apparatus may further include an expansion module, configured to perform expansion processing on the defect region in the new image.
Optionally, the image determining module may be specifically configured to: determining a central axis of a defect area in a new image; extracting a skeleton region in a new image according to the central axis of the defect region; performing communication processing on the skeleton area to form an image to be processed; preprocessing the image to be processed, and determining an interested area in the preprocessed image to be processed, wherein the interested area comprises characteristic information of a target object; and determining whether the target object is qualified or unqualified according to the area size of the region of interest.
Optionally, the image determination module may be specifically configured to: dividing a characteristic region in the image to be processed, wherein the characteristic region comprises all characteristic information of a target object; cutting out a defect area from the characteristic area, and carrying out binarization processing on the defect area to obtain a binarization area, wherein the defect area comprises at least one piece of characteristic information of the target object; and communicating all the binarization areas to obtain a communicated area, and filtering the communicated area to obtain an interested area.
Optionally, the image determination module may be specifically configured to: determining whether the area of the region of interest is equal to a preset threshold; if the area of the region of interest is equal to a preset threshold value, determining that the target object is qualified; if the area of the region of interest is larger than a preset threshold value, comparing the area of the region of interest with the preset threshold value; if the area of the region of interest is smaller than or equal to a preset threshold value, determining that the target object is qualified; and if the area of the region of interest is larger than the preset threshold value, determining that the target object is unqualified.
The apparatus provided in the embodiment of the present application may be configured to perform the method in the above embodiment, and the implementation principle and technical effects are similar, which are not described herein again.
It should be noted that the division of the modules of the above apparatus is only a logical division, and the actual implementation may be wholly or partially integrated into one physical entity, or may be physically separated. And these modules can all be implemented in the form of software invoked by a processing element; or can be implemented in the form of hardware; and part of the modules can be realized in the form of calling software by the processing element, and part of the modules can be realized in the form of hardware. For example, the image denoising module may be a processing element separately set up, or may be implemented by being integrated in a chip of the apparatus, or may be stored in a memory of the apparatus in the form of program code, and a processing element of the apparatus calls and executes the function of the image denoising module. The other modules are implemented similarly. In addition, all or part of the modules can be integrated together or can be independently realized. The processing element here may be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.
Fig. 10 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 10, the computer apparatus 1000 includes: at least one processor 1001, memory 1002, bus 1003, and communication interface 1004.
Wherein: the processor 1001, the communication interface 1004, and the memory 1002 communicate with each other via the bus 1003. The communication interface 1004 is used for communication with other devices. The communication interface comprises a communication interface for data transmission, a display interface or an operation interface for man-machine interaction and the like. The processor 1001 is used for executing computer-executable instructions, and may specifically execute relevant steps in the methods described in the above embodiments. The processor may be a central processing unit, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the present invention. The computer device includes one or more processors, which may be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs. The memory 1002 is used to store computer-executable instructions. The memory may comprise high speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
The present embodiment also provides a computer-readable storage medium, in which computer instructions are stored, and when at least one processor of a computer device executes the computer instructions, the computer device executes the image processing method provided by the above-mentioned various embodiments.
In the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated object, indicating that there may be three relationships, for example, a and/or B, which may indicate: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship; in the formula, the character "/" indicates that the preceding and following related objects are in a relationship of "division". "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or multiple.
It is to be understood that the various numerical references referred to in the embodiments of the present application are merely for convenience of description and distinction and are not intended to limit the scope of the embodiments of the present application. In the embodiment of the present application, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiment of the present application.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and these modifications or substitutions do not depart from the scope of the technical solutions of the embodiments of the present application.
Claims (11)
1. An image processing method, comprising:
denoising a target image to obtain a denoised image, wherein the target image is an image obtained by image acquisition of a target object;
extracting a local threshold of the denoised image, and segmenting the denoised image according to the local threshold to obtain a segmented image, wherein the segmented image comprises characteristic information of the target object;
extracting defect areas in the segmented image, and combining all the defect areas to obtain a new image;
and extracting a skeleton region in the new image, and determining whether the target object is qualified or unqualified according to the skeleton region.
2. The method according to claim 1, wherein the denoising the target image to obtain a denoised image comprises:
and denoising the target image through a mean filtering algorithm to obtain the denoised image.
3. The method of claim 1, wherein segmenting the denoised image according to the local threshold to obtain a segmented image comprises:
acquiring a pixel value of each pixel point in the denoised image;
determining the pixel value of each pixel point and the pixel values of other pixel points adjacent to each pixel point, and calculating to obtain a pixel mean value;
comparing the pixel value of each pixel point with the pixel mean value;
if the pixel value of the pixel point is larger than the pixel mean value, the pixel point is segmented from the denoised image;
and constructing to obtain a segmented image according to the segmented pixel points, wherein the segmented pixel points are used for representing the characteristic information of the target object.
4. The method of claim 1, wherein the extracting the defective region in the segmented image comprises:
performing communication processing on the segmented images to obtain communicated images;
and filtering to obtain a defect area in the communicated image according to the area occupied by each pixel point in the communicated image.
5. The method of claim 1, wherein prior to the extracting the skeleton region in the new image, further comprising:
and performing expansion processing on the defect area in the new image.
6. The method of claim 1, wherein extracting a skeletal region in the new image and determining whether the target object is qualified or unqualified according to the skeletal region comprises:
determining a central axis of a defect region in the new image;
extracting a skeleton region in the new image according to the central axis of the defect region;
performing communication processing on the skeleton region to form an image to be processed;
preprocessing the image to be processed, and determining an interested area in the preprocessed image to be processed, wherein the interested area comprises the characteristic information of the target object;
and determining whether the target object is qualified or unqualified according to the area size of the region of interest.
7. The method of claim 6, wherein the determining the region of interest in the pre-processed image comprises:
dividing a characteristic region in the image to be processed, wherein the characteristic region comprises all characteristic information of the target object;
cutting out a defect area in the characteristic area, and carrying out binarization processing on the defect area to obtain a binarization area, wherein the defect area comprises at least one piece of characteristic information of the target object;
and communicating all the binarization areas to obtain a communicated area, and filtering the communicated area to obtain the region of interest.
8. The method of claim 6, wherein determining whether the target object is eligible or ineligible based on the area of the region of interest comprises:
determining whether the area of the region of interest is equal to a preset threshold;
if the area of the region of interest is equal to a preset threshold value, determining that the target object is qualified;
if the area of the region of interest is larger than the preset threshold value, comparing the area of the region of interest with the preset threshold value;
if the area of the region of interest is smaller than or equal to the preset threshold value, determining that the target object is qualified;
and if the area of the region of interest is larger than the preset threshold value, determining that the target object is unqualified.
9. An image processing apparatus characterized by comprising:
the image denoising module is used for denoising a target image to obtain a denoised image, wherein the target image is an image obtained by image acquisition of a target object;
the image segmentation module is used for extracting a local threshold of the denoised image and segmenting the denoised image according to the local threshold to obtain a segmented image, wherein the segmented image comprises the characteristic information of the target object;
the image merging module is used for extracting the defect areas in the segmented image and merging all the defect areas to obtain a new image;
and the image judging module is used for extracting a skeleton region in the new image and determining whether the target object is qualified or unqualified according to the skeleton region.
10. A computer device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer execution instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any of claims 1-8.
11. A computer-readable storage medium having stored thereon computer instructions for implementing the method of any one of claims 1-8 when executed by a processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211277120.7A CN115578354A (en) | 2022-10-18 | 2022-10-18 | Image processing method, apparatus, device and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211277120.7A CN115578354A (en) | 2022-10-18 | 2022-10-18 | Image processing method, apparatus, device and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115578354A true CN115578354A (en) | 2023-01-06 |
Family
ID=84585243
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211277120.7A Withdrawn CN115578354A (en) | 2022-10-18 | 2022-10-18 | Image processing method, apparatus, device and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115578354A (en) |
-
2022
- 2022-10-18 CN CN202211277120.7A patent/CN115578354A/en not_active Withdrawn
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11443437B2 (en) | Vibe-based three-dimensional sonar point cloud image segmentation method | |
CN111612781A (en) | Screen defect detection method and device and head-mounted display equipment | |
CN111882568B (en) | Fire image edge extraction processing method, terminal and system | |
CN112669318A (en) | Surface defect detection method, device, equipment and storage medium | |
CN108918093B (en) | Optical filter mirror surface defect detection method and device and terminal equipment | |
JP6208426B2 (en) | Automatic unevenness detection apparatus and automatic unevenness detection method for flat panel display | |
CN115205223B (en) | Visual inspection method and device for transparent object, computer equipment and medium | |
CN109584215A (en) | A kind of online vision detection system of circuit board | |
CN114495098B (en) | Diaxing algae cell statistical method and system based on microscope image | |
JP2022551366A (en) | Method, computer program product and computer readable medium for generating masks for camera streams | |
CN109378279A (en) | Wafer detection method and wafer detection system | |
CN109716355B (en) | Particle boundary identification | |
CN115526885A (en) | Product image defect detection method, system, device and medium | |
CN115908415A (en) | Defect detection method, device and equipment based on edge and storage medium | |
CN114897881A (en) | Crystal grain defect detection method based on edge characteristics | |
CN114821274A (en) | Method and device for identifying state of split and combined indicator | |
CN114913194A (en) | Parallel optical flow method moving target detection method and system based on CUDA | |
CN111695374B (en) | Segmentation method, system, medium and device for zebra stripes in monitoring view angles | |
CN117173107A (en) | Product defect detection method, device, equipment, system and readable storage medium | |
CN115578354A (en) | Image processing method, apparatus, device and medium | |
CN112329572B (en) | Rapid static living body detection method and device based on frame and flash point | |
Abdusalomov et al. | Robust shadow removal technique for improving image enhancement based on segmentation method | |
CN108010020B (en) | Silicon wafer slide detection method and device | |
JP2711649B2 (en) | Surface scratch detection method for inspection object | |
JP6043178B2 (en) | Automatic unevenness detection apparatus and automatic unevenness detection method for flat panel display |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20230106 |