Image Processing Method, Apparatus, Device and Medium

By performing RGB three-channel separation and texture complexity division on the image, and selecting detection methods and filtering methods suitable for different regions, the problems of error detection and miss detection in traditional image defect detection methods are solved, achieving higher detection accuracy and lower error detection rate.

CN119444702BActive Publication Date: 2025-06-10SINO MV TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411502587.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-06-10
Estimated Expiration
2044-10-25

AI Technical Summary

Technical Problem

When dealing with different textures and color areas, the traditional image defect detection method adopts the same threshold and detection method, resulting in misdetect and missed detection, and the detection effect is poor.

Method used

By acquiring the original color image and performing RGB three-channel separation, the image roughness, information entropy and brightness of each pixel unit are calculated, and the image is divided into areas with different texture complexity, and different detection methods and filtering methods are selected according to the texture complexity of the region.

Benefits of technology

It improves image detection accuracy, reduces error detection rate, and significantly improves detection effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444702B_ABST
    Figure CN119444702B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an image processing method, apparatus, device, and medium. The method includes: obtaining an original color image, and performing RGB three-channel separation on the original color image to obtain a single-channel grayscale image of each color channel; for any single-channel grayscale image, calculating the image roughness, image information entropy, and image brightness of each pixel unit divided in the single-channel grayscale image; dividing the single-channel grayscale image into multiple image regions with different texture complexities according to the image roughness, image information entropy, and image brightness of each pixel unit; and respectively selecting different image detection methods and different filtering methods to perform image processing on each image region according to different texture complexities. The present disclosure can improve the image detection accuracy and reduce the false detection rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technologies, and in particular, to an image processing method, apparatus, device, and medium. Background Art

[0002] During the printing process, printed matter may have printing defects due to various reasons. Severe printing defects will lead to low printing quality of products and even cause serious economic losses. In traditional image defect detection methods, the same detection threshold and detection method are used for different textures and colors. However, the complexities of textures and colors in different regions of an image are different. Objectively, using the same threshold and the same detection method for all textures and colors in the image is likely to cause false detections and missed detections, and the detection effect is poor. Summary of the Invention

[0003] To solve the above technical problems, the present disclosure provides an image processing method, apparatus, device, and medium.

[0004] According to one aspect of the present disclosure, there is provided an image processing method, including:

[0005] Obtain an original color image, and perform RGB three-channel separation on the original color image to obtain a single-channel grayscale image of each color channel;

[0006] For any one of the single-channel grayscale images, calculate the image roughness, image information entropy, and image brightness of each pixel unit divided in the single-channel grayscale image;

[0007] According to the image roughness, image information entropy, and image brightness of each pixel unit, divide the single-channel grayscale image into multiple image regions with different texture complexities;

[0008] According to different texture complexities, respectively select different image detection methods and different filtering methods to perform image processing on each of the image regions.

[0009] According to another aspect of the present disclosure, there is also provided an image processing apparatus, including:

[0010] An image separation module, configured to obtain an original color image, and perform RGB three-channel separation on the original color image to obtain a single-channel grayscale image of each color channel;

[0011] An image calculation module, configured to calculate the image roughness, image information entropy, and image brightness of each pixel unit divided in any one of the single-channel grayscale images;

[0012] A complexity division module, configured to divide the single-channel grayscale image into multiple image regions with different texture complexities according to the image roughness, image information entropy, and image brightness of each pixel unit;

[0013] An image processing module, configured to perform image processing on each of the image regions by respectively selecting different image detection methods and different filtering methods according to different texture complexities.

[0014] According to another aspect of the present disclosure, there is also provided an electronic device, including:

[0015] A processor;

[0016] A memory for storing executable instructions of the processor;

[0017] The processor is configured to read the executable instructions from the memory and execute the instructions to implement the above method.

[0018] According to another aspect of the present disclosure, there is also provided a computer-readable storage medium storing a computer program for executing the above method.

[0019] The technical solution provided by the embodiments of the present disclosure has the following advantages compared with the prior art:

[0020] The technical solution provided by the embodiments of the present disclosure includes: obtaining an original color image, performing RGB three-channel separation on the original color image to obtain a single-channel grayscale image of each color channel; for any single-channel grayscale image, calculating the image roughness, image information entropy, and image brightness of each pixel unit divided in the single-channel grayscale image; dividing the single-channel grayscale image into multiple image regions with different texture complexities according to the image roughness, image information entropy, and image brightness of each pixel unit; performing image processing on each of the image regions by respectively selecting different image detection methods and different filtering methods according to different texture complexities.

[0021] This technical solution first divides the original color image into single-channel grayscale images of different color channels in terms of color through RGB three-channel separation; for each single-channel grayscale image, the texture is segmented according to the image roughness, image information entropy, and image brightness, and different complexity regions are adaptively identified and divided; through the above color segmentation and texture complexity differentiation, different detection methods and filtering methods can be determined for each single-channel grayscale image of each color channel and its image regions with different texture complexities; that is to say, different detection methods and filtering methods will be correspondingly adopted in the face of different colors and different texture complexities, thereby greatly improving the detection accuracy and reducing the false detection rate. Description of the Drawings

[0022] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present disclosure and, together with the specification, are used to explain the principles of the present disclosure.

[0023] To more clearly illustrate the technical solutions in the embodiments of the present disclosure or in the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0024] Figure 1 It is a flowchart of the image processing method according to the embodiment of the present disclosure;

[0025] Figure 2 It is a schematic diagram of the image processing process according to the embodiment of the present disclosure;

[0026] Figure 3 It is a schematic diagram of the segmentation of the image area according to the embodiment of the present disclosure;

[0027] Figure 4 It is a structural block diagram of the image processing device according to the embodiment of the present disclosure;

[0028] Figure 5 It is a schematic diagram of the structure of the electronic device according to the embodiment of the present disclosure. Detailed implementation manners

[0029] In order to be able to more clearly understand the above-mentioned objects, features, and advantages of the present disclosure, the following will further describe the solutions of the present disclosure. It should be noted that, without conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other.

[0030] In the following description, many specific details are set forth in order to fully understand the present disclosure, but the present disclosure can also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present disclosure, rather than all the embodiments.

[0031] In some image defect detection methods, the same threshold and the same detection method are used for all textures and colors in the image. This method cannot adaptively segment textures, cannot adaptively select different detection algorithms for different textures, and cannot adaptively select different filtering methods for different regions. Therefore, it is very easy to cause false detection and missed detection, and the detection accuracy is poor. In view of the above problems, the embodiments of the present disclosure provide an image processing method, apparatus, device, and medium. The technical solution uses an automatic color texture segmentation algorithm to perform a complexity segmentation of the texture according to the image roughness, image information entropy, and image brightness at the initial stage of detection. For image regions with different color channels and different texture complexities, different detection methods and filtering methods are respectively determined, thereby greatly improving the detection accuracy and reducing false detection.

[0032] As Figure 1 shown, the embodiments of the present disclosure provide an image processing method, which can be applicable to the situation of surface defect detection of industrial products such as printed matter and fabrics. This method can be executed by an image processing device configured in a terminal, and the device can be implemented by software and / or hardware. Referring to Figure 1 , the image processing method may include the following steps:

[0033] S102, obtain an original color image, and perform RGB three-channel separation on the original color image to obtain a single-channel grayscale image for each color channel.

[0034] In this embodiment, an image of a product such as printed matter can be collected by a camera to obtain an original color image. The original color image is an image containing color information, usually composed of three color channels: red (R), green (G), and blue (B). These three color channels can be superimposed to form various different colors.

[0035] As Figure 2 shown, separate the RGB three color channels of the original color image, extract the single-channel image of each color channel respectively, and then convert the single-channel image into a grayscale image, that is, obtain a single-channel grayscale image. A grayscale image is an image that only contains grayscale information. Different from a color image, a grayscale image has only one color channel, and the grayscale value of each pixel represents the brightness level of the pixel.

[0036] In this embodiment, by performing RGB three-channel separation on the original color image, a single-channel grayscale image for each color channel can be obtained, that is, the R channel corresponds to a single-channel grayscale image, the G channel corresponds to a single-channel grayscale image, and the B channel corresponds to a single-channel grayscale image. In this way, the original color image is segmented from the color aspect, which can greatly reduce the difficulty of subsequent dividing regions with different complexities.

[0037] S104. For any single-channel grayscale image, calculate the image roughness, image information entropy, and image brightness of each pixel unit divided in the single-channel grayscale image.

[0038] In this embodiment, a single-channel grayscale image can be divided into multiple pixel units. Each pixel unit, for example, is a 5*5 pixel area composed of 5 pixel points horizontally and 5 pixel points vertically. Specifically, the pixel units of the single-channel grayscale image can be divided according to the image size and actual detection requirements.

[0039] After dividing the single-channel grayscale image into multiple pixel units with finer granularity, the image roughness, image information entropy, and image brightness of each pixel unit can be calculated.

[0040] Among them, the calculation method of image roughness includes:

[0041] Calculate the gray-level difference between the maximum gray value and the minimum gray value of the pixel points in the pixel unit, and the gray-level ratio of the minimum gray value to the maximum gray value. Determine the image roughness of the pixel unit based on the gray-level difference and the gray-level ratio; specifically, the image roughness of the pixel unit can be determined according to the following formula:

[0042] Roughness(x,y)

[0043] =(MaxValue(x,y)–MinVale(x,y))*(1

[0044] +MinVale(x,y) / MaxValue(x,y))

[0045] Among them, Roughness(x,y) represents the image roughness of the current pixel unit, MaxValue(x,y) represents the maximum gray value in the pixel unit, MinVale(x,y) represents the minimum gray value in the pixel unit, (MaxValue(x,y)–MinVale(x,y)) represents the gray-level difference between the maximum gray value and the minimum gray value, and MinVale(x,y) / MaxValue(x,y)) represents the gray-level ratio of the minimum gray value to the maximum gray value.

[0046] Regarding the calculation method of image information entropy, the one-dimensional entropy of an image represents the amount of information contained in the aggregation characteristics of the gray-level distribution in the image. Based on this, in this embodiment, let Pi represent the proportion of pixel points with gray value i in the pixel unit, then the unary gray entropy H of the pixel unit is:

[0047]

[0048] The proportion Pi of the pixel points with the above grayscale value i in the pixel unit can be obtained from the grayscale histogram; the unary grayscale entropy calculated by the above formula is the image information entropy of the pixel unit.

[0049] Regarding the image brightness, the average value of the brightness of each pixel point within the pixel unit can be calculated, specifically, the average value of the brightness of each pixel point within a 5*5 pixel point area, and this is used as the image brightness of the pixel unit.

[0050] S106, according to the image roughness, image information entropy, and image brightness of each pixel unit, divide the single-channel grayscale image into multiple image regions with different texture complexities.

[0051] The image roughness, image information entropy, and image brightness of each pixel unit obtained in the above embodiments can reflect the complexity of the image from the texture. Thus, the image roughness, image information entropy, and image brightness are used as indicators for evaluating the texture complexity of the image. When implementing this step, first, according to the image roughness, image information entropy, and image brightness of each pixel unit, determine the texture complexity of each pixel unit; then, according to the texture complexity of each pixel unit and the preset complexity division range, divide the single-channel grayscale image into multiple image regions with different texture complexities.

[0052] In a specific embodiment, the weighted sum among the image roughness, image information entropy, and image brightness of the pixel unit can be determined as the texture complexity of the pixel unit.

[0053] According to the texture complexity of each pixel unit and the preset complexity division range, multiple pixel units that belong to the same complexity division range and are connected to each other form an image region. Considering the richness of the image content, in a single-channel grayscale image, there can be at least one image region corresponding to the same complexity division range. In other words, the single-channel grayscale image can be divided into M image regions corresponding to N texture complexities, and M≥N.

[0054] Among them, the complexity division range includes, for example: two complexity division ranges where the texture complexity is greater than the first complexity threshold C>C1 and the texture complexity is less than or equal to the first complexity threshold C≤C1. Based on the above two complexity division ranges, the single-channel grayscale image can be divided into multiple image regions under two texture complexities, and moreover, there may be multiple image regions corresponding to each texture complexity. For example, in a single-channel grayscale image, there are multiple people, and the multiple people correspond to the same texture complexity, but the multiple people are in different positions respectively. Thus, there can be multiple image regions of multiple people corresponding to the same texture complexity.

[0055] Alternatively, another range of complexity division, for example, includes three ranges of complexity division: the texture complexity is less than or equal to a second complexity threshold C≤C2, the texture complexity is greater than the second complexity threshold and less than or equal to a third complexity threshold C2<C≤C3, and the texture complexity is greater than the third complexity threshold C>C3. Based on the above three ranges of complexity division, a single-channel grayscale image can be divided into multiple image regions under three texture complexities, and moreover, there may be multiple image regions corresponding to each texture complexity.

[0056] Of course, the above is only an example of the range of texture complexity division and should not be construed as a limitation.

[0057] According to the image roughness, image information entropy, and image brightness of each pixel unit in this embodiment, a single-channel grayscale image can be divided into multiple image regions with different texture complexities from a texture perspective, dividing the single-channel grayscale image into relatively more complex image regions and relatively simpler (flatter) image regions. In this way, it is beneficial to adopt different methods for image processing for image regions with different texture complexities respectively.

[0058] After dividing a single-channel grayscale image into multiple image regions with different texture complexities according to the above embodiments, the present disclosure may further include: cutting out the image regions corresponding to the same texture complexity from the single-channel grayscale image according to the texture complexity of each pixel unit to obtain independent image regions.

[0059] Take Figure 3 as an example. According to the texture complexity of each pixel unit and a preset range of complexity division, the single-channel grayscale image shown in Figure 3 can be divided into two image regions with different texture complexities, namely a pentagram and a background. For an irregular polygon region like a pentagram, it is generally very difficult to generate automatically and requires manual drawing.

[0060] However, according to this embodiment, it is possible to determine the texture complexity of each pixel unit and thereby divide out the pentagram image region corresponding to the same texture complexity. Thus, the pentagram image region can be directly cut out from the single-channel grayscale image, and in this way, an independent pentagram image region can be obtained. Through the above method, it enables users to easily obtain irregular image regions that are difficult to draw and simplifies the generation method of irregular image regions.

[0061] For the obtained independent image regions, they can be applied to the scenario of image detection. For example, they can be used as the golden template images for image defect detection.

[0062] S108, according to different texture complexities, respectively select different image detection methods and different filtering methods to perform image processing on each image region.

[0063] In one implementation, an image detection method and a filtering method that match each texture complexity can be determined, and a matching relationship between the texture complexity, the image detection method, and the filtering method can be generated. Based on this, after dividing a single-channel grayscale image into multiple image regions with different texture complexities, according to the above matching relationship, an image detection method and a filtering method suitable for each image region with different texture complexities can be determined respectively. Among them, the image detection methods include, for example, the golden template comparison method and the neighboring comparison method, etc., and the filtering method includes, for example, the Gaussian filtering method, etc. It can be understood that the above are only examples and are not limited thereto. In practice, other image detection methods and filtering methods can also be used.

[0064] Exemplarily, according to the above embodiments, a single-channel grayscale image is divided into multiple image regions with two texture complexities, namely an image region with the first texture complexity and an image region with the second texture complexity, and the first texture complexity is greater than the second texture complexity.

[0065] Based on this, according to different texture complexities, different image detection methods and different filtering methods are respectively selected to perform image processing on each image region, which may include:

[0066] According to the first texture complexity, the golden template comparison method and the first Gaussian kernel are selected, and image processing is performed on the image region corresponding to the first texture complexity according to the golden template comparison method and the first Gaussian kernel;

[0067] According to the second texture complexity, the neighboring comparison method and the second Gaussian kernel are selected, and image processing is performed on the image region corresponding to the second texture complexity according to the neighboring comparison method and the second Gaussian kernel;

[0068] Among them, the first texture complexity is greater than the second texture complexity, and the size of the first Gaussian kernel is smaller than the size of the second Gaussian kernel.

[0069] In the above embodiments, the golden template comparison method is: training and learning a set of defect-free golden template images, and subtracting the golden template image from the image to be detected to generate a difference map. Correspondingly, for the image region with the first texture complexity, performing image processing according to the golden template comparison method and the first Gaussian kernel may include:

[0070] Processing the image region corresponding to the first texture complexity according to a preset target golden template image to generate a first difference map; specifically, subtracting the target golden template image from the image region corresponding to the first texture complexity to obtain the first difference map, and detecting whether there are defects in the image region corresponding to the first texture complexity through the first difference map.

[0071] Subsequently, the first difference map is filtered using the first Gaussian kernel to obtain a filtered result image. Gaussian filtering is a linear smoothing filter suitable for eliminating Gaussian noise and is widely used in the denoising process of image processing. Generally speaking, Gaussian filtering is a process of weighted averaging of the entire image, and the value of each pixel point is obtained by weighted averaging of itself and other pixel values in its neighborhood.

[0072] The specific operation of filtering the first difference map using the first Gaussian kernel is to scan each pixel point in the first difference map using the first Gaussian kernel (such as a 3*3 Gaussian kernel), and replace the value of the central pixel point of the first Gaussian kernel with the weighted average gray value of the pixel points in the neighborhood determined by the first Gaussian kernel.

[0073] In this embodiment, for the image region with relatively simple second texture complexity, image processing is performed according to the adjacent comparison method and the second Gaussian kernel. Among them, the adjacent comparison method is: in the real-time detection process, the reference image and the image region with the second texture complexity to be detected are obtained according to a certain periodic rule (the minimum texture period), and the second difference map is generated by subtracting the reference image from the image region with the second texture complexity. Subsequently, the second difference map is filtered using the second Gaussian kernel (such as a 5*5 Gaussian kernel) to obtain a filtered result image. In the process of image processing using the adjacent comparison method in this embodiment, the image region with the second texture complexity to be detected refers to an image region with a repetitive unit and a periodic texture structure.

[0074] For the sake of easy distinction, the above-mentioned image region with the first texture complexity can also be called a complex image region, and the image region with the second texture complexity can be called a simple image region. For the complex image region, its defect signal is relatively strong. Therefore, in this embodiment, the more stringent golden template comparison method is selected and a 3*3 Gaussian kernel with a smaller size is used for filtering; for the simple image region, its defect signal is relatively weak. Therefore, in this embodiment, the relatively loose adjacent comparison method is selected and a 5*5 Gaussian kernel with a larger size is used for filtering. The advantage of this is that different detection methods and filtering methods are selected for image regions with different texture complexities. Furthermore, the complex image regions with higher attention are strictly detected, while the non-key simple image regions are relaxed in detection, achieving stricter detection of key regions and relaxed detection of non-key regions. Therefore, the error rate can be effectively suppressed and the image detection rate can be improved.

[0075] Based on the above embodiments, the image processing method may further include: storing the image processing results corresponding to the single-channel gray images of each color channel.

[0076] Combined with Figure 2, by separating the original color image into three RGB color channels, each single-channel grayscale image corresponding to a color channel is divided into multiple image regions with different texture complexities. In Figure 2 , the complex image region m i and the simple image region m j are used to refer to the relatively more complex image region and the relatively simpler image region; of course, the texture complexity in this embodiment is not limited to two, and the image regions can also be multiple. For each image region, an image detection method and a filtering method matching its texture complexity are selected for image processing; furthermore, the image processing results of each image region corresponding to the single-channel grayscale image of each color channel are stored.

[0077] In summary, the image processing method provided by the embodiments of the present disclosure includes: obtaining an original color image, separating the original color image into three RGB color channels to obtain a single-channel grayscale image of each color channel; for any single-channel grayscale image, calculating the image roughness, image information entropy, and image brightness of each pixel unit divided in the single-channel grayscale image; according to the image roughness, image information entropy, and image brightness of each pixel unit, dividing the single-channel grayscale image into multiple image regions with different texture complexities; according to different texture complexities, respectively selecting different image detection methods and different filtering methods to perform image processing on each image region.

[0078] This technical solution first separates the original color image into single-channel grayscale images of different color channels in terms of color; for each single-channel grayscale image, according to the image roughness, image information entropy, and image brightness, the texture is segmented by complexity, and different texture complexity regions are adaptively identified and divided; through the above color segmentation and texture complexity differentiation, different detection methods and filtering methods can be determined for each single-channel grayscale image of each color channel and its image regions with different texture complexities; that is to say, in the face of different colors and different texture complexities, different detection methods and filtering methods will be correspondingly adopted, thereby greatly improving the detection accuracy and reducing the false detection rate.

[0079] As Figure 4 shown, the embodiments of the present disclosure provide a structural block diagram of an image processing device, which can be used to implement the image processing method, and the device can be implemented by software and / or hardware. Referring to Figure 4 , the image processing device may include the following modules:

[0080] An image separation module 310, configured to obtain an original color image and perform RGB three-channel separation on the original color image to obtain a single-channel grayscale image of each color channel;

[0081] An image calculation module 320 is configured to calculate the image roughness, image information entropy, and image brightness of each pixel unit divided in any one of the single-channel grayscale images.

[0082] A complexity division module 330 is configured to divide the single-channel grayscale image into multiple image regions with different texture complexities according to the image roughness, image information entropy, and image brightness of each pixel unit.

[0083] An image processing module 340 is configured to perform image processing on each of the image regions by respectively selecting different image detection methods and different filtering methods according to different texture complexities.

[0084] For the device provided in this embodiment, the implementation principle and the resulting technical effects are the same as those of the foregoing method embodiment. For the sake of brief description, for the parts not mentioned in the device embodiment, reference may be made to the corresponding content in the foregoing method embodiment.

[0085] Figure 5 The following is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. As Figure 5 shown, the electronic device 400 includes one or more processors 401 and a memory 402.

[0086] The processor 401 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.

[0087] The memory 402 may include one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory, etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 401 may run the program instructions to implement the image processing method of the embodiment of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, and noise components may also be stored in the computer-readable storage medium.

[0088] In one example, the electronic device 400 may further include: an input device 403 and an output device 404, and these components are interconnected through a bus system and / or other forms of connection mechanisms (not shown).

[0089] In addition, the input device 403 may further include, for example, a keyboard, a mouse, and the like.

[0090] The output device 404 can output various information to the outside, including the determined distance information, direction information, etc. The output device 404 can include, for example, a display, a speaker, a printer, a communication network, and remote output devices connected thereto, and the like.

[0091] Of course, for simplicity, Figure 5 only some of the components related to the present disclosure in the electronic device 400 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application scenarios, the electronic device 400 may further include any other appropriate components.

[0092] Furthermore, this embodiment also provides a computer-readable storage medium storing a computer program for executing the above image processing method.

[0093] A computer program product of an image processing method, apparatus, electronic device, and medium provided by an embodiment of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the method described in the foregoing method embodiments. For specific implementation, reference can be made to the method embodiments, which will not be elaborated herein.

[0094] It should be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0095] The above are only specific embodiments of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An image processing method, characterized in that: include: Acquire an original color image, and perform RGB three-channel separation on the original color image to obtain a single-channel grayscale image for each color channel; For any of the single-channel grayscale images, calculate the image coarseness, image information entropy and image brightness of each pixel unit divided in the single-channel grayscale image; Dividing the single-channel grayscale image into a plurality of image regions with different texture complexities according to the image coarseness, image information entropy and image brightness of each pixel unit; According to the different texture complexities, different image detection methods and different filtering methods are selected to perform image processing on each image area; wherein the different image detection methods include: golden template comparison method and neighbor comparison method; the different filtering methods include: Gaussian filtering using a first Gaussian kernel and Gaussian filtering using a second Gaussian kernel; According to the different texture complexities, different image detection methods and different filtering methods are selected to perform image processing on each image area, including: Selecting a golden template comparison method and a first Gaussian kernel according to the first texture complexity, and performing image processing on an image region corresponding to the first texture complexity according to the golden template comparison method and the first Gaussian kernel; According to the second texture complexity, a neighbor comparison method and a second Gaussian kernel are selected, and image processing is performed on the image area corresponding to the second texture complexity according to the neighbor comparison method and the second Gaussian kernel; The first texture complexity is greater than the second texture complexity, and the size of the first Gaussian kernel is smaller than the size of the second Gaussian kernel.

2. The method according to claim 1, characterized in that The method for calculating the image roughness includes: Calculating the grayscale difference between the maximum grayscale value and the minimum grayscale value of the pixel points in the pixel unit, and the grayscale ratio between the minimum grayscale value and the maximum grayscale value; The image roughness of the pixel unit is determined based on the grayscale difference and the grayscale ratio.

3. The method according to claim 2, characterized in that The determining the image roughness of the pixel unit based on the grayscale difference and the grayscale ratio includes: The image roughness of the pixel unit is determined according to the following formula: Roughness(x,y) =(MaxValue(x,y)–MinVale(x,y))*(1 +MinVale(x,y) / MaxValue(x,y)) Among them, (MaxValue(x,y)–MinVale(x,y)) represents the grayscale difference between the maximum grayscale value and the minimum grayscale value, and MinVale(x,y) / MaxValue(x,y)) represents the grayscale ratio of the minimum grayscale value to the maximum grayscale value.

4. The method according to claim 1, characterized in that The step of dividing the single-channel grayscale image into a plurality of image regions with different texture complexities according to the image coarseness, image information entropy and image brightness of each pixel unit comprises: Determining the texture complexity of each pixel unit according to the image roughness, image information entropy and image brightness of each pixel unit; According to the texture complexity of each pixel unit and a preset complexity division range, the single-channel grayscale image is divided into a plurality of image regions with different texture complexities.

5. The method according to claim 1, characterized in that The performing image processing on the image area corresponding to the first texture complexity according to the golden template comparison method and the first Gaussian kernel includes: Detecting the image area corresponding to the first texture complexity according to a preset target golden template image to generate a first difference map; The first difference image is filtered using a first Gaussian kernel to obtain a filtered result image.

6. The method according to claim 1, characterized in that The method further comprises: The image processing result corresponding to the single-channel grayscale image of each color channel is stored.

7. An image processing device, characterized in that: include: An image separation module is used to obtain an original color image and perform RGB three-channel separation on the original color image to obtain a single-channel grayscale image for each color channel; An image calculation module, used for calculating the image roughness, image information entropy and image brightness of each pixel unit divided in any of the single-channel grayscale images; A complexity division module, used for dividing the single-channel grayscale image into a plurality of image regions with different texture complexities according to the image roughness, image information entropy and image brightness of each pixel unit; An image processing module, for selecting different image detection methods and different filtering methods to perform image processing on each of the image regions according to different texture complexities; wherein different image detection methods include: a golden template comparison method and a neighbor comparison method; different filtering methods include: a Gaussian filter using a first Gaussian kernel and a Gaussian filter using a second Gaussian kernel; The image processing module comprises: Selecting a golden template comparison method and a first Gaussian kernel according to the first texture complexity, and performing image processing on an image region corresponding to the first texture complexity according to the golden template comparison method and the first Gaussian kernel; According to the second texture complexity, a neighbor comparison method and a second Gaussian kernel are selected, and image processing is performed on the image area corresponding to the second texture complexity according to the neighbor comparison method and the second Gaussian kernel; The first texture complexity is greater than the second texture complexity, and the size of the first Gaussian kernel is smaller than the size of the second Gaussian kernel.

8. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • An image processing method and apparatus

    CN109214996A

  • Object color difference defect detection method, device, computer device, and storage medium

    WO2020173177A1