Image type determination method, device, apparatus and storage medium

By calculating the RGB mean and standard deviation of the image and performing noise reduction, the problem of low efficiency in image type determination in existing technologies is solved, and more efficient differentiation between color and black-and-white images is achieved.

CN116935137BActive Publication Date: 2026-05-29AFIRSTSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AFIRSTSOFT CO LTD
Filing Date
2023-08-02
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing methods for determining whether an image or video is color or black and white based on color distribution are inefficient, especially when dealing with black and white images that have watermarks, color casts, or yellowing.

Method used

By detecting the initial pixels of the image, calculating the RGB mean and standard deviation, performing noise reduction processing, obtaining the target pixels, and determining the image type based on the target RGB standard deviation and a preset threshold.

Benefits of technology

It effectively removes image noise, improving the accuracy and efficiency of image type determination, and can more accurately distinguish between color and black-and-white images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116935137B_ABST
    Figure CN116935137B_ABST
Patent Text Reader

Abstract

The application relates to the field of image processing, and discloses a kind of image type determination method, device, equipment and storage medium.The method comprises the following steps: when detecting a to-be-identified image, traversing the initial pixel point of the to-be-identified image;calculating the average value of the initial pixel point of RGB;calculating the average value of the standard deviation of RGB corresponding to the average value of RGB according to the average value of RGB and a preset formula;de-noising the initial pixel point according to the average value of the standard deviation of RGB to obtain a target pixel point;calculating the target average value of the target pixel point of RGB;calculating the target average value of the target standard deviation of RGB corresponding to the target average value of RGB according to the target average value of RGB and a preset formula;and determining the type of the to-be-identified image according to the target average value of the target standard deviation of RGB and a preset threshold.The application improves the accuracy of image type determination.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing, and more particularly to a method, apparatus, device, and storage medium for determining image type. Background Technology

[0002] Early cameras captured photos and videos in black and white, so a large number of black and white photos and videos still exist today. AI technology can colorize these black and white photos and videos, turning them into color images or videos. An essential step in achieving this is distinguishing whether the input image or video is black and white or color. If it's black and white, the model colors it; otherwise, it skips the process. Determining whether an image or video is color or black and white can be done by statistically analyzing the color distribution of the image. However, in practical applications, a black and white image may have watermarks, color casts, or yellowing, meaning that not all pixels have a small standard deviation for their RGB values. Determining whether an image or video is color or black and white based solely on color distribution is complex and inefficient. Summary of the Invention

[0003] The main objective of this invention is to solve the technical problem of low efficiency in determining whether an image or video is color or black and white based on color distribution.

[0004] The first aspect of this invention provides a method for determining image type, the method comprising:

[0005] When an image to be identified is detected, the initial pixels of the image to be identified are traversed.

[0006] Calculate the average RGB value of the initial pixel;

[0007] Calculate the mean RGB standard deviation corresponding to the RGB average value based on the RGB average value and a preset formula;

[0008] The initial pixel is denoised based on the mean of the RGB standard deviation to obtain the target pixel.

[0009] Calculate the target RGB average value of the target pixel;

[0010] Calculate the mean of the target RGB standard deviation corresponding to the target RGB average value based on the target RGB average value and the preset formula;

[0011] The type of the image to be identified is determined based on the mean of the target RGB standard deviation and a preset threshold.

[0012] Optionally, in a first implementation of the first aspect of the present invention, the step of calculating the RGB average value of the pixel points includes:

[0013] The average RGB values ​​are obtained by determining the average red RGB value, the average green RGB value, and the average blue RGB value corresponding to the initial pixel.

[0014] Optionally, in a second implementation of the first aspect of the present invention, the step of calculating the mean RGB standard deviation corresponding to the RGB average value based on the RGB average value and a preset formula includes:

[0015] The mean of the RGB standard deviation is calculated based on the RGB average value and the size of the image to be identified.

[0016] Optionally, in a third implementation of the first aspect of the present invention, the step of denoising the initial pixel based on the mean of the RGB standard deviation to obtain the target pixel includes:

[0017] Determine the mean of the RGB standard deviations to be operated on that are greater than a preset value * 3 and less than the preset value / 3;

[0018] In the initial pixel points, the pixel points corresponding to the RGB standard deviation to be operated on are marked as noise and removed to obtain the target pixel points.

[0019] Optionally, in a fourth implementation of the first aspect of the present invention, the step of determining the type of the image to be identified based on the target RGB standard deviation mean and a preset threshold includes:

[0020] If the mean standard deviation of the target RGB is greater than or equal to the preset threshold, the type of the image to be identified is determined to be a color image;

[0021] If the mean of the target RGB standard deviation is less than the preset threshold, the type of the image to be identified is determined to be a black and white image.

[0022] Optionally, in a fifth implementation of the first aspect of the present invention, before the step of determining the type of the image to be identified based on the target RGB standard deviation mean and a preset threshold, the method further includes:

[0023] Acquire sample images, including black-and-white sample images and color sample images;

[0024] The preset threshold is determined based on the sample image.

[0025] Optionally, in a sixth implementation of the first aspect of the present invention, after the step of determining the type of the image to be identified based on the target RGB standard deviation mean and a preset threshold, the method further includes:

[0026] The preset threshold is updated based on the mean of the target RGB standard deviation.

[0027] A second aspect of the present invention provides an image type determination device, comprising:

[0028] The detection module is used to traverse the initial pixels of the image to be identified when an image to be identified is detected.

[0029] The first calculation module is used to calculate the RGB average value of the initial pixel points;

[0030] The second calculation module is used to calculate the mean RGB standard deviation corresponding to the RGB average value based on the RGB average value and a preset formula.

[0031] The noise reduction module is used to denoise the initial pixel based on the mean of the RGB standard deviation to obtain the target pixel.

[0032] The third module is used to calculate the target RGB average value of the target pixel;

[0033] The fourth module is used to calculate the mean of the target RGB standard deviation corresponding to the target RGB average value based on the target RGB average value and the preset formula;

[0034] The determination module is used to determine the type of the image to be identified based on the mean of the target RGB standard deviation and a preset threshold.

[0035] A third aspect of the present invention provides an image type determination device, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a circuit; the at least one processor invokes the instructions in the memory to cause the image type determination device to perform the image type determination method described above.

[0036] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the above-described image type determination method.

[0037] In this embodiment of the invention, when an image to be identified is detected, the initial pixels of the image to be identified are traversed; the RGB average value of the initial pixels is calculated; the mean RGB standard deviation corresponding to the RGB average value is calculated according to the RGB average value and a preset formula; the initial pixels are denoised according to the mean RGB standard deviation to obtain target pixels; the target RGB average value of the target pixels is calculated; the mean target RGB standard deviation corresponding to the target RGB average value is calculated according to the target RGB average value and the preset formula; and the type of the image to be identified is determined according to the mean target RGB standard deviation and a preset threshold. The image type determination device can remove noise from the image by processing the image to be identified, thereby obtaining the target image. Specifically, the method first detects the image to be identified and traverses the initial pixels of the image. Then, the RGB average value of these initial pixels is calculated, and the mean RGB standard deviation corresponding to the RGB average value is calculated according to a preset formula. Next, the initial pixels are denoised using the calculated mean RGB standard deviation to obtain target pixels. Then, the target RGB average value of the target pixels is calculated, and the mean target RGB standard deviation corresponding to the target RGB average value is calculated according to a preset formula. Finally, the type of the image to be identified is determined based on the mean of the target RGB standard deviation and a preset threshold. This method effectively removes noise from images by processing and analyzing their pixels, and determines the image type according to specific criteria, thereby improving the accuracy of image type determination. Attached Figure Description

[0038] Figure 1 This is a schematic diagram of an embodiment of the image type determination method in this invention;

[0039] Figure 2 This is a schematic diagram of one embodiment of the image type determination device in this invention;

[0040] Figure 3 This is a schematic diagram of one embodiment of the image type determination device in this invention. Detailed Implementation

[0041] This invention provides a method, apparatus, device, and storage medium for determining image type.

[0042] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0043] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 One embodiment of the image type determination method in this invention includes:

[0044] 101. When an image to be identified is detected, traverse the initial pixels of the image to be identified;

[0045] Specifically, by traversing each pixel of the image, each pixel can be further processed and analyzed to obtain more image information.

[0046] Traversing the initial pixels of an image allows for comprehensive analysis and processing of the entire image. During image processing, information such as the position coordinates and pixel value of each pixel can be accessed as needed for subsequent calculations and operations.

[0047] By iterating through every pixel of the image, subsequent processing steps, such as calculating the RGB average of pixels, denoising, and image segmentation, can be performed without missing any pixels. This ensures comprehensive processing of the entire image and yields more accurate results.

[0048] 102. Calculate the average RGB value of the initial pixel;

[0049] Optionally, the average red RGB value, the average green RGB value, and the average blue RGB value corresponding to the initial pixel are determined to obtain the average RGB value.

[0050] Specifically, by calculating the RGB average value, the average level of the overall color of the image can be obtained, thus providing a basis for subsequent processing and analysis.

[0051] Optionally, for each pixel, obtain its corresponding red (R), green (G), and blue (B) pixel values; sum the R, G, and B values ​​of all pixels and divide them by the number of pixels to obtain the average values ​​of R, G, and B; these three average values ​​are the initial RGB average values ​​of the pixels.

[0052] Calculating the RGB average value reflects the color distribution of the entire image, helping to understand the overall tone of the image. In image processing, the RGB average value is often used as the basis for operations such as color correction and white balance.

[0053] 103. Calculate the mean of the RGB standard deviation corresponding to the RGB average value and the preset formula;

[0054] Optionally, the mean of the RGB standard deviations corresponding to the RGB average value can be calculated based on the RGB average value and the size of the image to be identified.

[0055] Optionally, obtain the red (R), green (G), and blue (B) pixel values ​​for each pixel. For each pixel, calculate the square of the difference between each channel (R, G, B) and the mean of the corresponding channel, and sum the results for all three channels. Divide the result obtained in the previous step by the number of pixels (the total number of pixels in the image). After completing the above calculations, take the square root of the obtained values ​​to obtain the mean of the RGB standard deviation.

[0056] The RGB standard deviation mean is a statistic describing the color distribution of an image. It represents the dispersion of pixel values ​​across different channels, thus reflecting the color differences and contrast of the image.

[0057] 104. Denoise the initial pixel based on the mean of the RGB standard deviation to obtain the target pixel;

[0058] Specifically, the RGB standard deviation is compared with a preset threshold. If it is less than or equal to the threshold, the pixel is considered a target pixel; otherwise, it is considered noise. Pixels identified as target pixels are retained, while other pixels identified as noise are marked or filtered.

[0059] Optionally, the specific threshold settings and denoising strategies can be adjusted according to the actual application scenario and requirements. Common denoising methods also include mean filtering, median filtering, Gaussian filtering, etc., which are not limited here.

[0060] Denoising can reduce noise interference in images and extract clear and accurate target pixels, providing a more reliable data foundation for subsequent image analysis and processing.

[0061] 105. Calculate the target RGB average value of the target pixel;

[0062] Specifically, after obtaining the target pixels, their target RGB average value can be calculated. This involves iterating through all target pixels and obtaining the red (R), green (G), and blue (B) pixel values ​​for each pixel. The R, G, and B values ​​of all target pixels are then summed. Finally, the summed values ​​are divided by the number of target pixels to obtain the target RGB average value. The target RGB average value reflects the overall color level of the target pixels. By calculating the target pixel's RGB average value, the overall color characteristics of the target in the image can be understood.

[0063] Optionally, the RGB average value of the target pixels should only include pixels identified as targets, excluding noise or other non-target pixels. This ensures accurate target color information.

[0064] 106. Calculate the mean of the target RGB standard deviation corresponding to the target RGB average value based on the target RGB average value and the preset formula;

[0065] Specifically, based on the target RGB average value and a preset formula, the target RGB standard deviation mean can be calculated. Iterate through all target pixels, obtaining the red (R), green (G), and blue (B) pixel values ​​for each pixel. For each pixel, calculate the square of the difference between each channel's (R, G, B) value and the corresponding channel's average value, and sum the results for all three channels. Divide the result from the previous step by the number of target pixels to obtain the target pixel's RGB standard deviation mean. The target RGB standard deviation mean is a statistic describing the color distribution of target pixels. It represents the dispersion of target pixels across channels, thus reflecting the color differences and contrast of the target. By calculating the target pixel's RGB standard deviation mean, we can further understand the degree of color difference among target pixels, providing more detailed information for subsequent image processing and analysis.

[0066] 107. Determine the type of the image to be identified based on the mean of the target RGB standard deviation and a preset threshold.

[0067] Specifically, the type of the image to be identified can be determined based on the target RGB standard deviation mean and a preset threshold. The target RGB standard deviation mean is compared to the preset threshold. If the target RGB standard deviation mean is less than the threshold, the image is classified into one type (e.g., a black and white image). If the target RGB standard deviation mean is greater than or equal to the threshold, the image is classified into another type (e.g., a color image). The threshold for determining the image type can be set according to actual needs and application scenarios. Different types of images may have different color distributions and texture features; therefore, the target RGB standard deviation mean can be used to initially determine the image's sharpness or blurriness.

[0068] Optionally, if the mean of the target RGB standard deviation is greater than or equal to the preset threshold, the image to be identified is determined to be a color image. If the mean of the target RGB standard deviation is less than the preset threshold, the image to be identified is determined to be a black and white image.

[0069] Optionally, sample images are acquired, including black and white sample images and color sample images; the preset threshold is determined based on the sample images.

[0070] Optionally, the preset threshold is updated based on the target RGB standard deviation mean. In practical applications, the preset threshold can be dynamically updated based on changes in the target RGB standard deviation mean to better adapt to different types of images. The following is one update method:

[0071] 1. Set an initial preset threshold.

[0072] 2. For each image to be identified, calculate the mean of the target RGB standard deviation.

[0073] 3. Compare the calculated mean standard deviation of the target RGB values ​​with the current preset threshold.

[0074] 4. If the mean standard deviation of the target RGB exceeds the current preset threshold, it indicates that the image type may have changed and the threshold needs to be updated.

[0075] 5. Update the preset threshold using preset update rules, such as using the target RGB standard deviation mean as the new preset threshold, or by weighting the average based on historical data.

[0076] 6. Repeat steps 2 to 5 above to judge new images to be identified, and continuously update the preset threshold as needed.

[0077] By dynamically updating preset thresholds, accuracy for different types of images can be improved based on the characteristics and changes of the actual images. Appropriate update rules and strategies need to be selected according to specific application scenarios and requirements to ensure that the preset thresholds can flexibly adapt to different types of images.

[0078] Optionally, the mean of the RGB standard deviations to be operated on is determined, which are greater than a preset value * 3 and less than the preset value / 3; in the initial pixel points, the pixels corresponding to the RGB standard deviations to be operated on are marked as noise and removed to obtain the target pixel points. In a complete technical solution, black and white images are divided into pure black and white images and grayscale black and white images. In the RGB color model space, pure black and white images only have black and white, where white R = G = B = 255 and black R = G = B = 0.

[0079] Grayscale black and white refers to RGB values ​​that are equal or similar.

[0080] Based on the condition that "RGB values ​​are equal or similar", we know that the standard deviation among the three RGB values ​​of each pixel will be relatively small. However, in practical applications, a black and white image may contain noise (watermarks, color casts, yellowing), meaning that not all pixels have a small standard deviation for their RGB values. Therefore, an additional noise reduction step is needed.

[0081] Therefore, the specific implementation method is as follows:

[0082] 1. Calculate the standard deviations S1, S2, ... Si of the RGB values ​​of all pixels in an image with width W and height H;

[0083] 2. Calculate the mean standard deviation of all pixels.

[0084] 3. Identify and remove noise. Mark pixels corresponding to values ​​greater than 3 times A and less than 1 / 3 of A as noise and remove them. After removing noise, recalculate the mean standard deviation B according to the formula in step 2.

[0085] Select a threshold. Test and statistically analyze the B values ​​of a batch of color and black-and-white images. Select a specific threshold such that images with values ​​greater than the threshold are considered color images, and those with values ​​less than the threshold are considered black-and-white images.

[0086] In this embodiment of the invention, when an image to be identified is detected, the initial pixels of the image to be identified are traversed; the RGB average value of the initial pixels is calculated; the mean RGB standard deviation corresponding to the RGB average value is calculated according to the RGB average value and a preset formula; the initial pixels are denoised according to the mean RGB standard deviation to obtain target pixels; the target RGB average value of the target pixels is calculated; the mean target RGB standard deviation corresponding to the target RGB average value is calculated according to the target RGB average value and the preset formula; and the type of the image to be identified is determined according to the mean target RGB standard deviation and a preset threshold. The image type determination device can remove noise from the image by processing the image to be identified, thereby obtaining the target image. Specifically, the method first detects the image to be identified and traverses the initial pixels of the image. Then, the RGB average value of these initial pixels is calculated, and the mean RGB standard deviation corresponding to the RGB average value is calculated according to a preset formula. Next, the initial pixels are denoised using the calculated mean RGB standard deviation to obtain target pixels. Then, the target RGB average value of the target pixels is calculated, and the mean target RGB standard deviation corresponding to the target RGB average value is calculated according to a preset formula. Finally, the type of the image to be identified is determined based on the mean of the target RGB standard deviation and a preset threshold. This method effectively removes noise from images by processing and analyzing their pixels, and determines the image type according to specific criteria, thereby improving the accuracy of image type determination.

[0087] The image type determination method in the embodiments of the present invention has been described above. The image type determination device in the embodiments of the present invention will be described below. Please refer to [link / reference]. Figure 2 One embodiment of the image type determination device in this invention includes:

[0088] The detection module 301 is used to traverse the initial pixels of the image to be identified when an image to be identified is detected.

[0089] The first calculation module 302 is used to calculate the RGB average value of the initial pixel points;

[0090] The second calculation module 303 is used to calculate the mean RGB standard deviation corresponding to the RGB average value based on the RGB average value and a preset formula.

[0091] Denoising module 304 is used to denoise the initial pixel based on the mean of the RGB standard deviation to obtain the target pixel.

[0092] The third module 305 is used to calculate the target RGB average value of the target pixel;

[0093] The fourth module 306 is used to calculate the mean of the target RGB standard deviation corresponding to the target RGB average value based on the target RGB average value and the preset formula;

[0094] The determination module 307 is used to determine the type of the image to be identified based on the mean of the target RGB standard deviation and a preset threshold.

[0095] Optionally, the first calculation module 302 can also be specifically used for:

[0096] The average RGB values ​​are obtained by determining the average red RGB value, the average green RGB value, and the average blue RGB value corresponding to the initial pixel.

[0097] Optionally, the second calculation module 303 can also be specifically used for:

[0098] The mean of the RGB standard deviation is calculated based on the RGB average value and the size of the image to be identified.

[0099] Optionally, the noise reduction module 304 can also be specifically used for:

[0100] Determine the mean of the RGB standard deviations to be operated on that are greater than a preset value * 3 and less than the preset value / 3;

[0101] In the initial pixel points, the pixel points corresponding to the RGB standard deviation to be operated on are marked as noise and removed to obtain the target pixel points.

[0102] Optionally, the determination module 307 can also be specifically used for:

[0103] If the mean of the target RGB standard deviation is greater than or equal to the preset threshold, the type of the image to be identified is determined to be a color image;

[0104] If the mean of the target RGB standard deviation is less than the preset threshold, the type of the image to be identified is determined to be a black and white image.

[0105] Optionally, the determination module 307 can also be specifically used for:

[0106] Acquire sample images, including black-and-white sample images and color sample images;

[0107] The preset threshold is determined based on the sample image.

[0108] Optionally, the determination module 307 can also be specifically used for:

[0109] The preset threshold is updated based on the mean of the target RGB standard deviation.

[0110] In this embodiment of the invention, when an image to be identified is detected, the initial pixels of the image to be identified are traversed; the RGB average value of the initial pixels is calculated; the mean RGB standard deviation corresponding to the RGB average value is calculated according to the RGB average value and a preset formula; the initial pixels are denoised according to the mean RGB standard deviation to obtain target pixels; the target RGB average value of the target pixels is calculated; the mean target RGB standard deviation corresponding to the target RGB average value is calculated according to the target RGB average value and the preset formula; and the type of the image to be identified is determined according to the mean target RGB standard deviation and a preset threshold. The image type determination device can remove noise from the image by processing the image to be identified, thereby obtaining the target image. Specifically, the method first detects the image to be identified and traverses the initial pixels of the image. Then, the RGB average value of these initial pixels is calculated, and the mean RGB standard deviation corresponding to the RGB average value is calculated according to a preset formula. Next, the initial pixels are denoised using the calculated mean RGB standard deviation to obtain target pixels. Then, the target RGB average value of the target pixels is calculated, and the mean target RGB standard deviation corresponding to the target RGB average value is calculated according to a preset formula. Finally, the type of the image to be identified is determined based on the mean of the target RGB standard deviation and a preset threshold. This method effectively removes noise from images by processing and analyzing their pixels, and determines the image type according to specific criteria, thereby improving the accuracy of image type determination.

[0111] above Figure 2 The image type determination device in the embodiments of the present invention will be described in detail from the perspective of modular functional entities. The image type determination device in the embodiments of the present invention will be described in detail from the perspective of hardware processing.

[0112] Figure 3This is a schematic diagram of an image type determination device 500 provided in an embodiment of the present invention. The image type determination device 500 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) for storing application programs 533 or data 532. The memory 520 and storage media 530 can be temporary or persistent storage. The program stored in the storage media 530 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the image type determination device 500. Furthermore, the processor 510 may be configured to communicate with the storage media 530 and execute the series of instruction operations in the storage media 530 on the image type determination device 500.

[0113] The image type-based determination device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input / output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 3 The illustrated image type determination device structure does not constitute a limitation on image type determination devices, and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.

[0114] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when the instructions are executed on a computer, cause the computer to perform the steps of the image type determination method.

[0115] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system, device, or unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0116] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0117] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for determining image type, characterized in that, The method for determining the image type includes: When an image to be identified is detected, the initial pixels of the image to be identified are traversed. Calculate the average RGB value of the initial pixel; Calculate the mean RGB standard deviation corresponding to the RGB average value based on the RGB average value and a preset formula; The initial pixel is denoised based on the mean of the RGB standard deviation to obtain the target pixel. Calculate the target RGB average value of the target pixel; Calculate the mean of the target RGB standard deviation corresponding to the target RGB average value based on the target RGB average value and the preset formula; The type of the image to be identified is determined based on the target RGB standard deviation mean and a preset threshold. The step of denoising the initial pixel based on the mean of the RGB standard deviation to obtain the target pixel includes: Determine the mean of the RGB standard deviations to be operated on that are greater than a preset value * 3 and less than the preset value / 3; In the initial pixel points, the pixel points corresponding to the RGB standard deviation to be operated on are marked as noise and removed to obtain the target pixel points; The step of determining the type of the image to be identified based on the target RGB standard deviation mean and a preset threshold includes: If the mean of the target RGB standard deviation is greater than or equal to the preset threshold, the type of the image to be identified is determined to be a color image; If the mean standard deviation of the target RGB is less than the preset threshold, the type of the image to be identified is determined to be a black and white image; After the step of determining the type of the image to be identified based on the target RGB standard deviation mean and a preset threshold, the method further includes: The preset threshold is updated based on the mean of the target RGB standard deviation; The preset value is the mean of the target RGB standard deviation; The step of calculating the mean standard deviation of the target RGB includes: Obtain the red (R), green (G), and blue (B) pixel values ​​for each pixel. For each pixel, calculate the square of the difference between each channel's R, G, and B values ​​and the average value of the corresponding channel. Add the results of the three channels together. Divide the result obtained in the previous step by the total number of pixels in the image. After completing the above calculations, take the square root of the obtained value to obtain the mean of the RGB standard deviation.

2. The image type determination method according to claim 1, characterized in that, The step of calculating the RGB average value of the pixel includes: The average RGB values ​​are obtained by determining the average red RGB value, the average green RGB value, and the average blue RGB value corresponding to the initial pixel.

3. The image type determination method according to claim 1, characterized in that, The step of calculating the mean RGB standard deviation corresponding to the RGB average value based on the RGB average value and a preset formula includes: The mean of the RGB standard deviation is calculated based on the RGB average value and the size of the image to be identified.

4. The image type determination method according to any one of claims 1-3, characterized in that, Before the step of determining the type of the image to be identified based on the target RGB standard deviation mean and a preset threshold, the method further includes: Acquire sample images, including black-and-white sample images and color sample images; The preset threshold is determined based on the sample image.

5. An image type determination device, characterized in that, The image type determination device includes: The detection module is used to traverse the initial pixels of the image to be identified when an image to be identified is detected. The first calculation module is used to calculate the RGB average value of the initial pixel points; The second calculation module is used to calculate the mean RGB standard deviation corresponding to the RGB average value based on the RGB average value and a preset formula. The noise reduction module is used to denoise the initial pixel based on the mean of the RGB standard deviation to obtain the target pixel. The third module is used to calculate the target RGB average value of the target pixel; The fourth module is used to calculate the mean of the target RGB standard deviation corresponding to the target RGB average value based on the target RGB average value and the preset formula; The determination module is used to determine the type of the image to be identified based on the mean of the target RGB standard deviation and a preset threshold. Specifically, the noise reduction module is used for: Determine the mean of the RGB standard deviations to be operated on that are greater than a preset value * 3 and less than the preset value / 3; In the initial pixel points, the pixel points corresponding to the RGB standard deviation to be operated on are marked as noise and removed to obtain the target pixel points; Wherein, the preset value is the mean of the target RGB standard deviation; Specifically, the determination module is used for: If the mean of the target RGB standard deviation is greater than or equal to the preset threshold, the type of the image to be identified is determined to be a color image; If the mean standard deviation of the target RGB is less than the preset threshold, the type of the image to be identified is determined to be a black and white image; The determination module is further specifically used for: The preset threshold is updated based on the mean of the target RGB standard deviation; Specifically, the third module is used for: Obtain the red (R), green (G), and blue (B) pixel values ​​for each pixel. For each pixel, calculate the square of the difference between each channel's R, G, and B values ​​and the average value of the corresponding channel. Add the results of the three channels together. Divide the result obtained in the previous step by the total number of pixels in the image. After completing the above calculations, take the square root of the obtained value to obtain the mean of the RGB standard deviation.

6. An image type determination device, characterized in that, The image type determination device includes: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor invokes the instructions in the memory to cause the image type determination device to perform the image type determination method as described in any one of claims 1-4.

7. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the image type determination method as described in any one of claims 1-4.