Image processing method and device, equipment and medium
By performing RGB three-channel separation and texture complexity division on the original color image, appropriate detection methods and filtering methods are selected, and the error detection and miss detection problems of traditional image defect detection methods in complex textures and colors are solved, achieving higher detection accuracy and lower error detection rate.
Patent Information
- Application Number
- CN202411502587.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-25
AI Technical Summary
When traditional image defect detection methods deal with different textures and color areas, it is difficult to adapt to texture segmentation and select appropriate detection algorithms, resulting in misdetection and missed detection, and poor detection effect.
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. Perform image processing.
This improves image detection accuracy, reduces error detection rate, and significantly improves the accuracy of image defect detection.
Smart Images

Figure CN119444702A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, equipment and medium. Background Art
[0002] Printing defects may occur in the printing process due to a variety of reasons. Severe printing defects will lead to poor printing quality and even cause serious economic losses. In traditional image defect detection methods, different textures and colors use the same detection threshold and detection method. However, the complexity of textures and colors in different areas of the image is different. Objectively, using the same threshold and the same detection method for all textures and colors in the image is very likely to cause false detection and missed detection, resulting in poor detection results. Summary of the invention
[0003] In order to solve the above technical problems, the present disclosure provides an image processing method, device, equipment and medium.
[0004] According to one aspect of the present disclosure, there is provided an image processing method, comprising:
[0005] 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;
[0006] 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;
[0007] 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;
[0008] According to the different texture complexities, different image detection methods and different filtering methods are selected to perform image processing on each image area.
[0009] According to another aspect of the present disclosure, there is also provided an image processing device, comprising:
[0010] 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;
[0011] 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;
[0012] 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;
[0013] The image processing module is used to select different image detection methods and different filtering methods to perform image processing on each image area according to different texture complexities.
[0014] According to another aspect of the present disclosure, an electronic device is provided, the electronic device comprising:
[0015] processor;
[0016] a memory for storing instructions executable by the processor;
[0017] The processor is used 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, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the above method.
[0019] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0020] The technical solution provided by the embodiment of the present disclosure includes: acquiring an original color image, and performing RGB three-channel separation on the original color image to obtain a single-channel grayscale image for 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 a plurality of image areas with different texture complexities according to the image roughness, image information entropy and image brightness of each pixel unit; and selecting different image detection methods and different filtering methods to perform image processing on each of the image areas according to the different texture complexities.
[0021] This technical solution first separates the RGB three channels and divides the original color image into single-channel grayscale images of different color channels in terms of color; for each single-channel grayscale image, the texture is segmented according to the complexity of the image, according to the image roughness, image information entropy and image brightness, and the regions of different complexity are adaptively identified and divided; through the above color segmentation and differentiation of texture complexity, different detection methods and filtering methods can be determined for the single-channel grayscale image of each color channel and the image regions with different texture complexities; that is, in the face of different colors and different texture complexities, different detection methods and filtering methods will be adopted accordingly, which can greatly improve the detection accuracy and reduce the false detection rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0024] Figure 1 This is a flowchart of the image processing method described in an embodiment of the present disclosure;
[0025] Figure 2 A schematic diagram of the image processing process described in an embodiment of the present disclosure;
[0026] Figure 3 A schematic diagram of segmenting an image region according to an embodiment of the present disclosure;
[0027] Figure 4 is a structural block diagram of the image processing device according to an embodiment of the present disclosure;
[0028] Figure 5 It is a schematic diagram of the structure of the electronic device described in the embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0030] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of 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. As a result, it is very easy to cause false detection and missed detection, and the detection accuracy is poor. In response to the above problems, the embodiments of the present disclosure provide an image processing method, device, equipment and medium. The technical solution adopts an automatic color texture segmentation algorithm. In the early stage of detection, the texture is divided into complexity according to the image roughness, image information entropy and image brightness; different detection methods and filtering methods are determined for different color channels and image regions with different texture complexities, thereby greatly improving the detection accuracy and reducing false detections.
[0032] like Figure 1 As shown, the embodiment of the present disclosure provides an image processing method, which can be applied to the detection of surface defects of industrial products such as printed materials and fabrics. The method can be executed by an image processing device configured in a terminal, and the device can be implemented by software and / or hardware. Figure 1 , the image processing method may include the following steps:
[0033] S102, obtaining an original color image, and performing RGB three-channel separation on the original color image to obtain a single-channel grayscale image for each color channel.
[0034] In this embodiment, a camera can be used to capture images of printed products to obtain an original color image. An 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 colors.
[0035] like Figure 2 As shown in the figure, the three color channels of the original color image are separated, and the single-channel image of each color channel is extracted respectively, and then the single-channel image is converted into a grayscale image, that is, a single-channel grayscale image is obtained. A grayscale image is an image that only contains grayscale information. Unlike 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] This embodiment can obtain a single-channel grayscale image for each color channel by performing RGB three-channel separation on the original color image, 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 in terms of color, which can greatly reduce the difficulty of subsequent segmentation of regions of different complexity.
[0037] S104, for any single-channel grayscale image, calculating the image coarseness, image information entropy and image brightness of each pixel unit divided in the single-channel grayscale image.
[0038] In this embodiment, the single-channel grayscale image can be divided into multiple pixel units, each pixel unit is, for example, a 5*5 pixel area consisting of 5 horizontal pixels and 5 vertical pixels. 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 a single-channel grayscale image into multiple pixel units with finer granularity, the image coarseness, image information entropy and image brightness of each pixel unit can be calculated.
[0040] The calculation method of image roughness includes:
[0041] Calculate the grayscale difference between the maximum grayscale value and the minimum grayscale value of the pixel point in the pixel unit, as well as the grayscale ratio between the minimum grayscale value and the maximum grayscale value. Determine the image roughness of the pixel unit based on the grayscale difference and grayscale 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 grayscale value in the pixel unit, MinVale(x,y) represents the minimum grayscale value in the pixel unit, (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.
[0046] Regarding the calculation method of image information entropy, the one-dimensional entropy of an image represents the amount of information contained in the aggregated features of the grayscale distribution in the image. Based on this, in this embodiment, Pi represents the proportion of pixels with a grayscale value of i in a pixel unit, and the one-dimensional grayscale entropy H of the pixel unit is:
[0047]
[0048] The proportion Pi of the pixels with the gray value i in the pixel unit can be obtained from the gray histogram; the unary gray entropy calculated by the above formula is the image information entropy of the pixel unit.
[0049] Regarding image brightness, the average brightness of each pixel in a pixel unit, such as the average brightness of each pixel in a 5*5 pixel area, can be calculated and used as the image brightness of the pixel unit.
[0050] S106, 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.
[0051] The image roughness, image information entropy and image brightness of each pixel unit obtained in the above embodiment can reflect the complexity of the image from the texture, so that the image roughness, image information entropy and image brightness are used as indicators for evaluating the complexity of image texture. When implementing this step, firstly, the texture complexity of each pixel unit is determined according to the image roughness, image information entropy and image brightness of each pixel unit; then, according to the texture complexity of each pixel unit and the preset complexity division range, the single-channel grayscale image is divided into multiple image areas with different texture complexities.
[0052] In a specific embodiment, the weighted sum of the image roughness, image information entropy and image brightness of the pixel unit may 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 belonging to the same complexity division range and interconnected 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, a single-channel grayscale image can be divided into M image regions corresponding to N types of texture complexity, and M ≥ N.
[0054] Among them, the complexity division range includes, for example: two complexity division ranges: texture complexity is greater than the first complexity threshold C>C1 and 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 areas under two texture complexities, and there may be multiple image areas corresponding to each texture complexity. For example, a single-channel grayscale image includes multiple characters, and the multiple characters correspond to the same texture complexity, but the multiple characters are in different positions. Therefore, multiple image areas corresponding to the multiple characters can be under the same texture complexity.
[0055] Alternatively, another complexity division range includes, for example, three complexity division ranges: texture complexity is less than or equal to the second complexity threshold C≤C2, texture complexity is greater than the second complexity threshold and less than or equal to the third complexity threshold C2<C≤C3, and texture complexity is greater than the third complexity threshold C>C3. Based on the above three complexity division ranges, a single-channel grayscale image can be divided into multiple image regions under three texture complexities, and there may be multiple image regions corresponding to each texture complexity.
[0056] Of course, the above are merely examples of the range of texture complexity division and should not be construed as limitations.
[0057] This embodiment can divide a single-channel grayscale image into multiple image regions with different texture complexities based on the image roughness, image information entropy and image brightness of each pixel unit, and divide the single-channel grayscale image into relatively more complex image regions and relatively simpler (flatter) image regions. This is conducive to using different methods to process images in different image regions with different texture complexities.
[0058] After dividing the single-channel grayscale image into multiple image areas with different texture complexity according to the above embodiments, the present disclosure may further include: according to the texture complexity of each pixel unit, cutting out the image area corresponding to the same texture complexity from the single-channel grayscale image to obtain an independent image area.
[0059] by Figure 3 For example, according to the texture complexity of each pixel unit and the preset complexity division range, Figure 3 The single-channel grayscale image shown is divided into two image regions with different texture complexity, namely, a five-pointed star and a background. For an irregular polygonal region such as a five-pointed star, it is generally difficult to generate automatically and needs to be generated by manual drawing.
[0060] However, according to this embodiment, the texture complexity of each pixel unit can be determined and the five-pointed star image area corresponding to the same texture complexity can be divided, so that the five-pointed star image area can be directly cut out from the single-channel grayscale image, so that an independent five-pointed star image area can be obtained. In the above manner, the user can easily obtain the irregular image area that is difficult to draw, and simplify the generation method of the irregular image area.
[0061] The obtained independent image region can be applied to image detection scenarios, for example, as a golden template image for image defect detection.
[0062] S108, selecting different image detection methods and different filtering methods to perform image processing on each image region according to different texture complexities.
[0063] In one implementation, a matching image detection method and filtering method can be determined for each texture complexity, and a matching relationship between texture complexity and the image detection method and filtering method can be generated. Based on this, after a single-channel grayscale image is divided into a plurality of image regions with different texture complexities, an image detection method and filtering method suitable for each image region with different texture complexity can be determined according to the above matching relationship. Among them, image detection methods include golden template matching methods and neighbor matching methods, and filtering methods include Gaussian filtering methods. It can be understood that the above are only examples and are not limited to this. 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, image regions with a first texture complexity and image regions with a second texture complexity, and the first texture complexity is greater than the second texture complexity.
[0065] Based on this, different image detection methods and different filtering methods are selected to process each image area according to different texture complexities, which may include:
[0066] According to the first texture complexity, a golden template comparison method and a first Gaussian kernel are selected, and image processing is performed on an image area 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, 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;
[0068] 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 embodiment, the golden template comparison method is: training and learning a set of defect-free golden template images, and subtracting the golden template images from the image to be detected to generate a difference map. Accordingly, for the image area of the first texture complexity, image processing according to the golden template comparison method and the first Gaussian kernel may include:
[0070] The image area corresponding to the first texture complexity is processed according to the preset target golden template image to generate a first difference map; specifically, the image area corresponding to the first texture complexity is subtracted from the target golden template image to obtain the first difference map, and the first difference map is used to detect whether there is a defect in the image area corresponding to the first texture complexity.
[0071] Then, the first difference image is filtered using the first Gaussian kernel to obtain a filtered result image. Gaussian filtering is a linear smoothing filter that is suitable for eliminating Gaussian noise and is widely used in the noise reduction process of image processing. In layman's terms, Gaussian filtering is the process of weighted averaging the entire image. The value of each pixel is obtained by weighted averaging the value of itself and other pixels in the neighborhood.
[0072] The specific operation of filtering the first difference image using the first Gaussian kernel is to use the first Gaussian kernel (for example, a 3*3 Gaussian kernel) to scan each pixel in the first difference image, and replace the value of the central pixel of the first Gaussian kernel with the weighted average grayscale value of the pixel points in the neighborhood determined by the first Gaussian kernel.
[0073] In this embodiment, for a relatively simple image area of the second texture complexity, image processing is performed according to a neighbor comparison method and a second Gaussian kernel. Among them, the neighbor comparison method is: in the real-time detection process, a reference image and an image area of the second texture complexity to be detected are obtained according to a certain periodic rule (texture minimum period), and a second difference map is generated by subtracting the reference image from the image area of the second texture complexity. Then, the second difference map is filtered using a second Gaussian kernel (for example, a 5*5 Gaussian kernel) to obtain a filtered result image. In this embodiment, when the image processing method is used, the image area of the second texture complexity to be detected refers to an image area with a repeating unit and a periodic texture structure.
[0074] For the sake of distinction, the image area with the first texture complexity mentioned above can also be called a complex image area, and the image area with the second texture complexity can be called a simple image area. For complex image areas, the defect signal is relatively strong, so this embodiment uses a more stringent golden template comparison method and a smaller 3*3 Gaussian kernel for filtering; for simple image areas, the defect signal is relatively weak, so this embodiment uses a relatively loose neighbor comparison method and a larger 5*5 Gaussian kernel for filtering. The advantage of this is that different detection methods and filtering methods are used for image areas with different texture complexities, and then the complex image areas with higher attention are strictly detected, while the non-key simple image areas are relaxed, so that strict detection is achieved in key areas and relaxed detection in non-key areas. 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 result corresponding to the single-channel grayscale image of each color channel.
[0076] Combination Figure 2By separating the RGB three channels of the original color image, the single-channel grayscale image corresponding to each color channel will be divided into multiple image regions with different texture complexity. Figure 2 In the example, the complex image region m is used i and simple image region m j To refer to a relatively more complex image area and a relatively simple image area; of course, the texture complexity in this embodiment is not limited to two, and the image area can also be multiple. Each image area will use an image detection method and a filtering method that matches its texture complexity for image processing; then, the image processing results of each image area corresponding to the single-channel grayscale image of each color channel are stored.
[0077] In summary, the image processing method provided by the embodiment of the present disclosure includes: acquiring an original color image, and performing RGB three-channel separation on the original color image to obtain a single-channel grayscale image for 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 areas with different texture complexity; according to different texture complexities, selecting different image detection methods and different filtering methods to perform image processing on each image area.
[0078] This technical solution first separates the RGB three channels and divides the original color image into single-channel grayscale images of different color channels in terms of color; for each single-channel grayscale image, the texture is segmented according to the complexity of the image, according to the image roughness, image information entropy and image brightness, and the regions with different texture complexities are adaptively identified and divided; through the above color segmentation and differentiation of texture complexity, different detection methods and filtering methods can be determined for the single-channel grayscale image of each color channel and its image regions with different texture complexities; that is, in the face of different colors and different texture complexities, different detection methods and filtering methods will be adopted accordingly, which can greatly improve the detection accuracy and reduce the false detection rate.
[0079] like Figure 4 As shown, the present disclosure provides a structural block diagram of an image processing device, which can be used to implement an image processing method. The device can be implemented using software and / or hardware. Figure 4 , the image processing device may include the following modules:
[0080] The image separation module 310 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 of each color channel;
[0081] An image calculation module 320, for calculating, for any of the single-channel grayscale images, the image roughness, image information entropy and image brightness of each pixel unit divided in the single-channel grayscale image;
[0082] A complexity division module 330, configured to divide 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;
[0083] The image processing module 340 is used to select different image detection methods and different filtering methods to perform image processing on each of the image regions according to different texture complexities.
[0084] The implementation principle and technical effects of the device provided in this embodiment are the same as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0085] Figure 5 The structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in FIG. Figure 5 As 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 product 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, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a 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, noise components, etc. 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 via a bus system and / or other forms of connection mechanisms (not shown).
[0089] In addition, the input device 403 may also 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 a remote output device connected thereto, and the like.
[0091] Of course, to simplify, 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 situations, the electronic device 400 may also include any other appropriate components.
[0092] Furthermore, this embodiment also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the above-mentioned image processing method.
[0093] The computer program product of an image processing method, device, electronic device and medium provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.
[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 such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0095] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may 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 conform to 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.
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 1, 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 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.
6. The method according to claim 5, 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.
7. 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.
8. 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; The image processing module is used to select different image detection methods and different filtering methods to perform image processing on each image area according to different texture complexities.
9. 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 7.
10. 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 7.
Citation Information
Patent Citations
An image processing method and apparatus
CN109214996A
Counterweight weight weight detection method and system, counterweight weight acquisition method and system and crane
CN110956180A
Cloth defect detection method based on artificial intelligence
CN114494259A
Periodic texture image processing method and device, equipment and medium
CN118822984A
Object color difference defect detection method, device, computer device, and storage medium
WO2020173177A1