Low-light image recognition method, device, equipment and storage medium
By analyzing image size parameters, calculating RGB component differences, and constructing a component difference map, dark light regions are identified, solving the problem of inaccurate dark light image recognition and achieving efficient dark light image recognition.
Patent Information
- Application Number
- CN202110798260.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-15
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2041-07-15
AI Technical Summary
The existing image grayscale histogram method has low accuracy in judging low-light images, resulting in inaccurate low-light image recognition.
By receiving the image to be identified, parsing its size parameters, calculating the RGB component difference of each pixel, constructing a component difference map, identifying dark areas, determining dark pixels and clustering them in the region, and determining whether the number of pixels in the dark area information exceeds a threshold, the dark image can be identified.
It improved the recognition accuracy of low-light images to 99.4% and improved recognition efficiency.
Smart Images

Figure CN113592789B_ABST
Abstract
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 low-light image recognition. Background Technology
[0002] With the development of the internet and the widespread use of cameras, enterprises possess increasingly more data, among which image data is a crucial component. The rational utilization of this data can help enterprises reduce costs, increase efficiency, and improve productivity. The improvement in computing power and the accumulation of data have led to widespread attention being paid to existing computer vision technologies. Machine learning and deep learning are applied in areas such as object recognition, object detection, and tracking, permeating all aspects of life, including manufacturing, document analysis, medical diagnosis, and the military. Computer vision technology requires a large number of images, making image preprocessing particularly important.
[0003] In practical applications, some images may be very dark due to factors such as shooting techniques, equipment, or environment. Among existing techniques for determining image grayscale, the grayscale histogram method is the preferred method, but its accuracy is not high when identifying dark images in actual image data. Summary of the Invention
[0004] This invention provides a method, apparatus, device, and storage medium for low-light image recognition, which can improve the recognition accuracy of low-light images.
[0005] The first aspect of this invention provides a low-light image recognition method, comprising:
[0006] Receive the image to be identified and parse the image to be identified to obtain the size parameters of the image to be identified;
[0007] Based on the size parameters, the RGB component values of each pixel in the image to be identified are obtained, and the RGB component differences of each pixel in the image to be identified are calculated based on the RGB component values to obtain the set of differences corresponding to the image to be identified.
[0008] Based on the set of differences, dark light regions are identified in the image to be identified to obtain dark light region information of the image to be identified.
[0009] When the number of dark light pixels in the dark light region information is greater than a preset dark light pixel threshold, the image to be identified is determined to be a dark light image.
[0010] Optionally, in a first implementation of the first aspect of the present invention, receiving the image to be identified and parsing the image to be identified to obtain the size parameters of the image to be identified includes:
[0011] Receive the image to be identified and read the image to be identified using a preset image processing tool;
[0012] The preset image processing tool is used to traverse the pixels of the image to be identified to obtain the size parameters of the image to be identified, including the number of horizontal pixels and the number of vertical pixels.
[0013] Optionally, in a second implementation of the first aspect of the present invention, the step of obtaining the RGB component values of each pixel in the image to be recognized based on the size parameter, and calculating the RGB component differences of each pixel in the image to be recognized based on the RGB component values to obtain the difference set corresponding to the image to be recognized, includes:
[0014] Based on the number of horizontal and vertical pixels in the size parameters, extract the RGB component values of each pixel in the image to be identified. The RGB component values include red component values, green component values, and blue component values.
[0015] The red, green, and blue component values in the RGB component values are subtracted pairwise to obtain the RGB component difference value of each pixel in the image to be identified. The RGB component difference value includes the red-green component difference value, the red-blue component difference value, and the green-blue component difference value.
[0016] The RGB component differences of each pixel in the image to be identified are combined to obtain the difference set corresponding to the image to be identified.
[0017] Optionally, in a third implementation of the first aspect of the present invention, the step of identifying dark areas of the image to be identified based on the difference set to obtain dark area information of the image to be identified includes:
[0018] Based on the set of differences, a component difference map of the image to be identified is constructed, the component difference map including a red-green component difference map, a red-blue component difference map, and a green-blue component difference map;
[0019] Dark-light pixel information of the image to be identified is obtained by calculating the difference between the red and green components of each pixel in the image to be identified using the red-green component difference map, the difference between the red and blue components of each pixel in the image to be identified using the red-blue component difference map, and the difference between the green and blue components of each pixel in the image to be identified using the green-blue component difference map.
[0020] Optionally, in a fourth implementation of the first aspect of the present invention, the step of calculating dark-light pixels by performing dark-light pixel calculations on the red-green component difference of each pixel in the image to be identified using the red-green component difference map, calculating dark-light pixels by performing dark-light pixel calculations on the red-blue component difference of each pixel in the image to be identified using the red-blue component difference map, and calculating dark-light pixels by performing dark-light pixel calculations on the green-blue component difference of each pixel in the image to be identified using the green-blue component difference map, to obtain dark-light region information of the image to be identified, includes:
[0021] The red-green component difference map is used to determine whether the red-green component difference corresponding to each pixel in the image to be identified is less than a preset red-green component threshold. The red-blue component difference map is used to determine whether the red-blue component difference corresponding to each pixel in the image to be identified is less than a preset red-blue component threshold. The green-blue component difference map is used to determine whether the green-blue component difference corresponding to each pixel in the image to be identified is less than a preset green-blue component threshold.
[0022] If the difference between the red and green components is less than a preset red and green component threshold, the difference between the red and blue components is less than a preset red and blue component threshold, and the difference between the green and blue components is less than a preset green and blue component threshold, then the corresponding pixel is determined to be a dark-light pixel. The dark-light pixel includes the coordinate information of the dark-light pixel in the component difference map.
[0023] The number of adjacent dark-light pixels and the image region are obtained. When the number of targets is greater than or equal to a preset dark-light region number threshold, the corresponding image region is determined as a dark-light region, and the dark-light region information of the image to be identified is obtained.
[0024] Optionally, in a fifth implementation of the first aspect of the present invention, after determining that the image to be identified is a dark image when the number of dark pixels in the dark area information is greater than a preset dark pixel threshold, the dark image recognition method further includes:
[0025] Obtain the dark light pixels in the dark light region information and the coordinate information of the dark light pixels in the component difference map, and determine the position information of the dark light pixels in the image to be identified through the coordinate information;
[0026] Based on the location information, the dark areas corresponding to the dark area information are marked in the image to be identified, and the brightness information of the dark areas is output.
[0027] Optionally, in a sixth implementation of the first aspect of the present invention, determining that the image to be identified is a dark image when the number of dark-light pixels in the dark-light region information is greater than a preset dark-light pixel threshold includes:
[0028] Determine whether the number of dark light pixels in the dark light area information is greater than a preset dark light pixel threshold;
[0029] If the number of dark-light pixels is greater than or equal to a preset dark-light pixel threshold, then the image to be identified is determined to be a dark-light image.
[0030] If the number of dark-light pixels is less than a preset dark-light pixel threshold, then the image to be identified is determined to be a non-dark-light image.
[0031] A second aspect of the present invention provides a low-light image recognition device, comprising:
[0032] A receiving module is used to receive an image to be recognized and parse the image to be recognized to obtain the size parameters of the image to be recognized;
[0033] The calculation module is used to obtain the RGB component values of each pixel in the image to be recognized according to the size parameters, and calculate the RGB component differences of each pixel in the image to be recognized according to the RGB component values to obtain the difference set corresponding to the image to be recognized.
[0034] The recognition module is used to identify dark areas of the image to be recognized based on the set of differences, and to obtain dark area information of the image to be recognized.
[0035] The determination module is used to determine that the image to be identified is a dark image when the number of dark pixels in the dark area information is greater than a preset dark pixel threshold.
[0036] Optionally, in a first implementation of the second aspect of the present invention, the receiving module has the function of:
[0037] Receive the image to be identified and read the image to be identified using a preset image processing tool;
[0038] The preset image processing tool is used to traverse the pixels of the image to be identified to obtain the size parameters of the image to be identified, including the number of horizontal pixels and the number of vertical pixels.
[0039] Optionally, in a second implementation of the second aspect of the present invention, the computing module is specifically used for:
[0040] Based on the number of horizontal and vertical pixels in the size parameters, extract the RGB component values of each pixel in the image to be identified. The RGB component values include red component values, green component values, and blue component values.
[0041] The red, green, and blue component values in the RGB component values are subtracted pairwise to obtain the RGB component difference value of each pixel in the image to be identified. The RGB component difference value includes the red-green component difference value, the red-blue component difference value, and the green-blue component difference value.
[0042] The RGB component differences of each pixel in the image to be identified are combined to obtain the difference set corresponding to the image to be identified.
[0043] Optionally, in a third implementation of the second aspect of the present invention, the identification module includes:
[0044] The construction unit is configured to construct a component difference map of the image to be identified based on the difference set, wherein the component difference map includes a red-green component difference map, a red-blue component difference map, and a green-blue component difference map;
[0045] The calculation unit is used to calculate the dark light pixels of each pixel in the image to be identified by using the red-green component difference map, the red-blue component difference map, and the green-blue component difference map to calculate the dark light pixels of each pixel in the image to be identified, thereby obtaining the dark light region information of the image to be identified.
[0046] Optionally, in a fourth implementation of the second aspect of the present invention, the computing unit is specifically used for:
[0047] The red-green component difference map is used to determine whether the red-green component difference corresponding to each pixel in the image to be identified is less than a preset red-green component threshold. The red-blue component difference map is used to determine whether the red-blue component difference corresponding to each pixel in the image to be identified is less than a preset red-blue component threshold. The green-blue component difference map is used to determine whether the green-blue component difference corresponding to each pixel in the image to be identified is less than a preset green-blue component threshold.
[0048] If the difference between the red and green components is less than a preset red and green component threshold, the difference between the red and blue components is less than a preset red and blue component threshold, and the difference between the green and blue components is less than a preset green and blue component threshold, then the corresponding pixel is determined to be a dark-light pixel. The dark-light pixel includes the coordinate information of the dark-light pixel in the component difference map.
[0049] The number of adjacent dark-light pixels and the image region are obtained. When the number of targets is greater than or equal to a preset dark-light region number threshold, the corresponding image region is determined as a dark-light region, and the dark-light region information of the image to be identified is obtained.
[0050] Optionally, in a fifth implementation of the second aspect of the present invention, the low-light image recognition device further includes:
[0051] The positioning module is used to acquire the dark light pixels in the dark light area information and the coordinate information of the dark light pixels in the component difference map, and to determine the position information of the dark light pixels in the image to be identified through the coordinate information.
[0052] The annotation module is used to annotate the dark light areas corresponding to the dark light area information in the image to be identified based on the location information, and output the brightness information of the dark light areas.
[0053] Optionally, in a sixth implementation of the second aspect of the present invention, the determining module is specifically used for:
[0054] Determine whether the number of dark light pixels in the dark light area information is greater than a preset dark light pixel threshold;
[0055] If the number of dark-light pixels is greater than or equal to a preset dark-light pixel threshold, then the image to be identified is determined to be a dark-light image.
[0056] If the number of dark-light pixels is less than a preset dark-light pixel threshold, then the image to be identified is determined to be a non-dark-light image.
[0057] A third aspect of the present invention provides a low-light image recognition device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor invokes the instructions in the memory to cause the low-light image recognition device to perform the aforementioned low-light image recognition method.
[0058] 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 aforementioned low-light image recognition method.
[0059] In the technical solution provided by this invention, an image to be identified is received and parsed to obtain the size parameters of the image to be identified; based on the size parameters, the RGB component values of each pixel in the image to be identified are obtained, and the RGB component differences of each pixel in the image to be identified are calculated based on the RGB component values to obtain a set of differences corresponding to the image to be identified; based on the set of differences, dark area identification is performed on the image to be identified to obtain dark area information of the image to be identified; when the number of dark pixels in the dark area information is greater than a preset dark pixel threshold, the image to be identified is determined to be a dark image. In this embodiment of the invention, the server obtains the RGB component values of each pixel in the image to be identified by parsing the size parameters of the image to be identified, then calculates the RGB component differences of each pixel, and finally identifies the dark areas of the image to be identified based on the RGB component differences, and determines the dark image. This invention can improve the recognition accuracy of dark images. Attached Figure Description
[0060] Figure 1 This is a schematic diagram of one embodiment of the low-light image recognition method in this invention;
[0061] Figure 2 This is a schematic diagram of another embodiment of the low-light image recognition method in this invention;
[0062] Figure 3 This is a schematic diagram of one embodiment of the low-light image recognition device according to the present invention;
[0063] Figure 4 This is a schematic diagram of another embodiment of the low-light image recognition device in this invention;
[0064] Figure 5 This is a schematic diagram of one embodiment of the low-light image recognition device in this invention. Detailed Implementation
[0065] This invention provides a method, apparatus, device, and storage medium for low-light image recognition, which improves the recognition accuracy of low-light images.
[0066] 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.
[0067] 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 low-light image recognition method in this invention includes:
[0068] 101. Receive the image to be recognized and parse it to obtain the size parameters of the image to be recognized;
[0069] It is understood that the executing entity of this invention can be a low-light image recognition device, a terminal, or a server; no specific limitation is made here. This embodiment of the invention will be described using a server as an example.
[0070] In this embodiment, the image to be identified can be a surveillance image captured by a surveillance camera, or a natural image captured by a regular camera or mobile phone. This invention demonstrates good performance in light recognition of surveillance images, enabling timely determination of whether a surveillance image captured by a surveillance camera is a low-light image and promptly feeding the determination result back to the user terminal. This invention can also be used for image preprocessing. For example, before training a deep learning model, identifying low-light images using this invention can prevent image quality issues from affecting the training effect of the deep learning model.
[0071] In this embodiment, after receiving the image to be recognized, the server parses the image to extract its size parameters. The size parameters are in pixels (px), representing the pixel size of the image to be recognized. For example, if the size parameters of the image to be recognized are 90px * 60px, then the image to be recognized has a width of 90 pixels and a height of 60 pixels. The server extracts the size parameters of the image to be recognized for subsequent traversal of the pixels of the image to be recognized, thereby performing low-light image recognition.
[0072] 102. Based on the size parameters, obtain the RGB component values of each pixel in the image to be recognized, and calculate the RGB component differences of each pixel in the image to be recognized based on the RGB component values to obtain the set of differences corresponding to the image to be recognized.
[0073] In this embodiment, the RGB color mode in the color system obtains a wide variety of colors by varying the red, green, and blue color channels and superimposing them. This standard covers almost all colors perceptible to human vision. Therefore, the RGB color mode is one of the most widely used color systems. The RGB color mode assigns an intensity value in the range of 0 to 255 to the RGB component values of each pixel in an image through the RGB model. For example: pure red has an R value of 255, a G value of 0, and a B value of 0; gray has equal R, G, and B values (except for 0 and 255); white has R, G, and B values of 255; and black has R, G, and B values of 0.
[0074] In this embodiment, the server obtains the RGB component values of each pixel in the image to be recognized, namely the R (red) value, G (green) value, and B (blue) value, by traversing the RGB component values of each pixel in the image to be recognized, based on the size information of the image to be recognized, that is, the number of pixels in the image to be recognized. The server then calculates the RGB component difference of each pixel based on the RGB component value of each pixel, thereby obtaining the difference set of each pixel in the image to be recognized, which includes the RGB component difference of each pixel.
[0075] 103. Based on the difference set, perform dark light region identification on the image to be identified to obtain the dark light region information of the image to be identified;
[0076] In this embodiment, extensive experiments revealed that the RGB component differences of pixels in dark areas of an image exhibit a certain pattern (below a certain threshold). Based on this, the server identifies dark pixels in the image to be identified that meet the dark conditions (RGB component differences greater than a preset component threshold) according to the RGB component differences of each pixel in the difference set. When a certain number of dark pixels are gathered, the area where the dark pixels are gathered is taken as the dark area of the image to be identified, thereby obtaining the dark area information of the image to be identified. The dark area information includes the position information of the dark pixels in the image to be identified, the RGB component values of the dark pixels, and the RGB component differences. The dark area information is used to subsequently determine whether the image to be identified is a dark image. This embodiment can accurately identify the dark areas in the image.
[0077] 104. When the number of dark light pixels in the dark light area information is greater than the preset dark light pixel threshold, the image to be identified is determined to be a dark light image.
[0078] In this embodiment, after the server identifies the dark area information of the image to be identified, that is, the dark pixels in the image to be identified, it determines whether the image to be identified is a dark image by judging whether the number of dark pixels in the dark area information is greater than a preset dark pixel threshold. After a large number of experiments, it was found that the total number of dark pixels in the dark image is greater than a certain threshold. The server uses this threshold as the preset dark pixel threshold to reverse the determination of whether the image to be identified is a dark image. It can accurately identify dark images. The accuracy rate in the test process is as high as 99.4%, and the recognition efficiency is also relatively high due to the small amount of computation.
[0079] In this embodiment of the invention, the server obtains the RGB component values of each pixel in the image by parsing the size parameters of the image to be identified, then calculates the RGB component difference of each pixel, and finally identifies the dark area of the image to be identified based on the RGB component difference, and determines the dark image. This invention can improve the recognition accuracy of dark images.
[0080] Please see Figure 2 Another embodiment of the low-light image recognition method in this invention includes:
[0081] 201. Receive the image to be recognized and parse the image to obtain the size parameters of the image to be recognized;
[0082] Specifically, the server receives the image to be recognized and reads it using a preset image processing tool. The server then uses the preset image processing tool to traverse the pixels of the image to be recognized and obtain the size parameters of the image, which include the number of horizontal pixels and the number of vertical pixels.
[0083] In this optional embodiment, after receiving the image to be recognized, the server obtains the size information of the image by parsing the script information of the image. Since the size information of the image may be in different units, such as inches, feet, millimeters, dots, US dots, pixels, etc., in order to improve the efficiency of subsequent image processing, the server performs unit conversion using a preset unit conversion formula to uniformly convert the size unit in the size information of the image to be recognized into pixels, thereby obtaining the size parameter of the image to be recognized. The size parameter is a size parameter in pixels. The uniform size parameter can improve the calculation efficiency of low-light image recognition.
[0084] 202. Based on the size parameters, obtain the RGB component values of each pixel in the image to be recognized, and calculate the RGB component differences of each pixel in the image to be recognized based on the RGB component values to obtain the set of differences corresponding to the image to be recognized.
[0085] Specifically, the server extracts the RGB component values of each pixel in the image to be recognized according to the number of horizontal and vertical pixels in the size parameters. The RGB component values include red, green, and blue component values. The server subtracts the red, green, and blue component values from each other in the RGB component values to obtain the RGB component difference values of each pixel in the image to be recognized. The RGB component difference values include red-green, red-blue, and green-blue component differences. The server combines the RGB component difference values of each pixel in the image to be recognized to obtain the difference set corresponding to the image to be recognized.
[0086] In this optional embodiment, since the image to be identified is a two-dimensional planar image, the size parameters of the image to be identified include the number of horizontal pixels and the number of vertical pixels. For example, if the size parameters of the image to be identified are 90px*60px, then the number of horizontal pixels in the image to be identified is 90 and the number of vertical pixels is 60. The server iterates through the RGB component values of each pixel in the image to be recognized based on the number of pixels horizontally and vertically. It then subtracts the RGB component values of each pixel pairwise to obtain the RGB component difference for each pixel. For example, if the RGB component value of a pixel in the image to be recognized is X(10,20,40), where 10 represents the red component, 20 represents the green component, and 40 represents the blue component, the server subtracts the RGB component values of this pixel: 20-10=10, 40-10=30, 40-20=20, obtaining the RGB component difference Y(10,30,20). In Y, 10 represents the red-green component difference, 30 represents the red-blue component difference, and 20 represents the green-blue component difference. This process is repeated for each pixel in the image to be recognized. The server then combines the RGB component difference values Y of each pixel to obtain the set of differences for the image to be recognized.
[0087] 203. Based on the difference set, construct the component difference map of the image to be identified. The component difference map includes the red-green component difference map, the red-blue component difference map, and the green-blue component difference map.
[0088] In this embodiment, to quickly identify low-light images, the server constructs a component difference map of the image to be identified based on the RGB component differences of each pixel in the difference set. The component difference map can be a two-dimensional planar coordinate system or a three-dimensional coordinate system. When the component difference map is a two-dimensional planar coordinate system, the X-axis can represent the sequence number of each pixel in the image to be identified, and the Y-axis can represent the RGB component differences (red-green component difference, red-blue component difference, or green-blue component difference) corresponding to the corresponding pixel. The parameters represented by the X-axis and Y-axis can be interchanged without limitation. When the component difference map is a three-dimensional coordinate system, the X-axis can represent the horizontal pixel sequence number of the image to be identified, the Y-axis can represent the vertical pixel sequence number of the image to be identified, and the Z-axis can represent the RGB component differences (red-green component difference, red-blue component difference, or green-blue component difference) corresponding to the pixel. The parameters represented by the X-axis, Y-axis, and Z-axis can be interchanged without limitation.
[0089] In this embodiment, different RGB component differences (red-green component difference, red-blue component difference, or green-blue component difference) correspond to different component difference maps (red-green component difference map, red-blue component difference map, or green-blue component difference map). The component difference map provides a data basis for the subsequent determination of dark light areas and plays a more intuitive role in dark light image analysis.
[0090] 204. The dark light pixel information of the image to be identified is obtained by calculating the difference between the red and green components of each pixel in the image to be identified using the red-green component difference map, the dark light pixel information of the image to be identified using the red-blue component difference map, and the dark light pixel information of the image to be identified using the green-blue component difference map.
[0091] Specifically, the server determines whether the difference between the red and green components corresponding to each pixel in the image to be identified is less than a preset red and green component threshold by using the red-green component difference map, and whether the difference between the red and blue components corresponding to each pixel in the image to be identified is less than a preset red and blue component threshold by using the red-blue component difference map, and whether the difference between the green and blue components corresponding to each pixel in the image to be identified is less than a preset green and blue component threshold by using the green and blue component difference map. If the difference between the red and green components is less than the preset red-green component threshold, the difference between the red and blue components is less than the preset red-blue component threshold, and the difference between the green and blue components is less than the preset green and blue component threshold, then the server determines the corresponding pixel as a dark-light pixel. The dark-light pixel includes the coordinate information of the dark-light pixel in the component difference map. The server obtains the target number and image region of adjacent dark-light pixels. When the target number is greater than or equal to a preset dark-light region number threshold, the corresponding image region is determined as a dark-light region, thus obtaining the dark-light region information of the image to be identified.
[0092] In this optional embodiment, by using the red-green component difference map, red-blue component difference map, and green-blue component difference map, the server can accurately and efficiently determine whether the red-green component difference, red-blue component difference, and green-blue component difference corresponding to each pixel in the image to be identified are less than the corresponding preset component thresholds. That is, it determines whether the red-green component difference of each pixel is less than the preset red-green component threshold, whether the red-blue component difference of each pixel is less than the preset red-blue component threshold, and whether the green-blue component difference of each pixel is less than the preset green-blue component threshold. When the red-green component difference, red-blue component difference, and green-blue component difference are all less than the corresponding preset red-green component threshold, preset red-blue component threshold, and preset green-blue component threshold, respectively, the server will treat the corresponding pixel as a dark light pixel. For example, suppose the preset component thresholds are (50, 60, 70), where 50 represents the preset red-green component threshold, 60 represents the preset red-blue component threshold, and 70 represents the preset green-blue component threshold. If the red-green component difference, red-blue component difference, and green-blue component difference of a pixel in the image to be identified are 70, 80, and 90 respectively, then since 50 < 70, 60 < 80, and 70 < 90, the server determines that the pixel is a dark pixel.
[0093] In this optional embodiment, when the number of adjacent dark-light pixels in the image to be identified exceeds a preset threshold for the number of dark-light regions, that is, when the number of dark-light pixels is greater than or equal to the preset threshold for the number of dark-light regions, the server takes the image region corresponding to the adjacent dark-light pixels as the dark-light region. For example, if there are more than 50 adjacent dark-light pixels (both vertical (Y-axis) and horizontal (X-axis) adjacent are considered adjacent) in the image to be identified, which is greater than the preset threshold for the number of dark-light regions, then the server determines the dark-light region information of the image to be identified based on the coordinate information of these more than 50 dark-light pixels in the image to be identified (determined by the coordinate axes of the component difference map).
[0094] 205. When the number of dark light pixels in the dark light area information is greater than the preset dark light pixel threshold, the image to be identified is determined to be a dark light image.
[0095] Specifically, the server determines whether the number of dark-light pixels in the dark-light area information is greater than a preset dark-light pixel threshold; if the number of dark-light pixels is greater than or equal to the preset dark-light pixel threshold, the server determines that the image to be identified is a dark-light image; if the number of dark-light pixels is less than the preset dark-light pixel threshold, the server determines that the image to be identified is a non-dark-light image.
[0096] In this optional embodiment, in order to distinguish some locally dark images (local darkness does not affect the use of the image), the server determines whether the number of dark pixels in the dark area is greater than or equal to a preset dark pixel threshold, that is, whether the area occupied by the dark area in the image to be identified meets the preset dark image determination condition. When the number of dark pixels in the image to be identified is greater than the preset dark pixel threshold, it means that the dark area of the image to be identified meets the preset dark image determination condition. Then, the server determines the image to be identified as a dark image; otherwise, it determines the image to be identified as a non-dark image.
[0097] Furthermore, the server obtains the dark light pixels in the dark light area information and the coordinate information of the dark light pixels in the component difference map, and determines the position information of the dark light pixels in the image to be recognized through the coordinate information; based on the position information, the server marks the dark light area corresponding to the dark light area information in the image to be recognized, and outputs the brightness information of the dark light area.
[0098] In this optional embodiment, in order to more intuitively identify the dark areas of the image to be identified, the server finds the location information of the dark pixels in the image to be identified based on the coordinate information of the dark pixels, marks the dark pixels, verifies the recognition accuracy of the dark areas, and outputs the brightness information of the dark areas as a reference for improving the brightness of the dark areas.
[0099] In this embodiment of the invention, the server constructs a component difference map of the image to be identified based on the RGB component difference of each pixel in the difference set. Then, based on the red-green component difference map, red-blue component difference map, and green-blue component difference map in the component difference map, the server performs dark light pixel judgment on the red-green component difference, red-blue component difference, and green-blue component difference of each pixel in the image to be identified, thereby obtaining dark light area information. This invention can accurately identify dark light areas in an image, and thus identify dark light images.
[0100] The low-light image recognition method in the embodiments of the present invention has been described above. The low-light image recognition device in the embodiments of the present invention will be described below. Please refer to [link / reference]. Figure 3 One embodiment of the low-light image recognition device of the present invention includes:
[0101] The receiving module 301 is used to receive the image to be recognized and parse the image to be recognized to obtain the size parameters of the image to be recognized;
[0102] The calculation module 302 is used to obtain the RGB component values of each pixel in the image to be recognized according to the size parameters, and calculate the RGB component differences of each pixel in the image to be recognized according to the RGB component values to obtain the difference set corresponding to the image to be recognized.
[0103] The recognition module 303 is used to identify dark areas of the image to be recognized based on the difference set, and obtain dark area information of the image to be recognized.
[0104] The determination module 304 is used to determine that the image to be identified is a dark image when the number of dark pixels in the dark area information is greater than a preset dark pixel threshold.
[0105] In this embodiment of the invention, the server obtains the RGB component values of each pixel in the image by parsing the size parameters of the image to be identified, then calculates the RGB component difference of each pixel, and finally identifies the dark area of the image to be identified based on the RGB component difference, and determines the dark image. This invention can improve the recognition accuracy of dark images.
[0106] Please see Figure 4 Another embodiment of the low-light image recognition device in this invention includes:
[0107] The receiving module 301 is used to receive the image to be recognized and parse the image to be recognized to obtain the size parameters of the image to be recognized;
[0108] The calculation module 302 is used to obtain the RGB component values of each pixel in the image to be recognized according to the size parameters, and calculate the RGB component differences of each pixel in the image to be recognized according to the RGB component values to obtain the difference set corresponding to the image to be recognized.
[0109] The recognition module 303 is used to identify dark areas of the image to be recognized based on the difference set, and obtain dark area information of the image to be recognized.
[0110] The determination module 304 is used to determine that the image to be identified is a dark image when the number of dark pixels in the dark area information is greater than a preset dark pixel threshold.
[0111] Optionally, the receiving module 301 has the following functions:
[0112] Receive the image to be identified and read the image to be identified using a preset image processing tool;
[0113] The preset image processing tool is used to traverse the pixels of the image to be identified to obtain the size parameters of the image to be identified, including the number of horizontal pixels and the number of vertical pixels.
[0114] Optionally, the calculation module 302 is specifically used for:
[0115] Based on the number of horizontal and vertical pixels in the size parameters, extract the RGB component values of each pixel in the image to be identified. The RGB component values include red component values, green component values, and blue component values.
[0116] The red, green, and blue component values in the RGB component values are subtracted pairwise to obtain the RGB component difference value of each pixel in the image to be identified. The RGB component difference value includes the red-green component difference value, the red-blue component difference value, and the green-blue component difference value.
[0117] The RGB component differences of each pixel in the image to be identified are combined to obtain the difference set corresponding to the image to be identified.
[0118] Optionally, the identification module 303 includes:
[0119] The construction unit 3031 is used to construct a component difference map of the image to be identified based on the difference set, wherein the component difference map includes a red-green component difference map, a red-blue component difference map, and a green-blue component difference map;
[0120] The calculation unit 3032 is used to calculate the dark light pixels of the red-green component difference of each pixel in the image to be identified by using the red-green component difference map, and to calculate the dark light pixels of the red-blue component difference of each pixel in the image to be identified by using the red-blue component difference map, and to calculate the dark light pixels of the green-blue component difference of each pixel in the image to be identified by using the green-blue component difference map, so as to obtain the dark light area information of the image to be identified.
[0121] Optionally, the computing unit 3032 is specifically used for:
[0122] The red-green component difference map is used to determine whether the red-green component difference corresponding to each pixel in the image to be identified is less than a preset red-green component threshold. The red-blue component difference map is used to determine whether the red-blue component difference corresponding to each pixel in the image to be identified is less than a preset red-blue component threshold. The green-blue component difference map is used to determine whether the green-blue component difference corresponding to each pixel in the image to be identified is less than a preset green-blue component threshold.
[0123] If the difference between the red and green components is less than a preset red and green component threshold, the difference between the red and blue components is less than a preset red and blue component threshold, and the difference between the green and blue components is less than a preset green and blue component threshold, then the corresponding pixel is determined to be a dark-light pixel. The dark-light pixel includes the coordinate information of the dark-light pixel in the component difference map.
[0124] The number of adjacent dark-light pixels and the image region are obtained. When the number of targets is greater than or equal to a preset dark-light region number threshold, the corresponding image region is determined as a dark-light region, and the dark-light region information of the image to be identified is obtained.
[0125] Optionally, the determining module 304 is specifically used for:
[0126] Determine whether the number of dark light pixels in the dark light area information is greater than a preset dark light pixel threshold;
[0127] If the number of dark-light pixels is greater than or equal to a preset dark-light pixel threshold, then the image to be identified is determined to be a dark-light image.
[0128] If the number of dark-light pixels is less than a preset dark-light pixel threshold, then the image to be identified is determined to be a non-dark-light image.
[0129] Optionally, the low-light image recognition device further includes:
[0130] The positioning module 305 is used to acquire the dark light pixel in the dark light area information and the coordinate information of the dark light pixel in the component difference map, and to determine the position information of the dark light pixel in the image to be identified through the coordinate information.
[0131] The annotation module 306 is used to annotate the dark light region corresponding to the dark light region information in the image to be identified according to the location information, and output the brightness information of the dark light region.
[0132] In this embodiment of the invention, the server constructs a component difference map of the image to be identified based on the RGB component difference of each pixel in the difference set. Then, based on the red-green component difference map, red-blue component difference map, and green-blue component difference map in the component difference map, the server performs dark light pixel judgment on the red-green component difference, red-blue component difference, and green-blue component difference of each pixel in the image to be identified, thereby obtaining dark light area information. This invention can accurately identify dark light areas in an image, and thus identify dark light images.
[0133] above Figure 3 and Figure 4 The low-light image recognition device in this embodiment of the invention will be described in detail from the perspective of modular functional entities. The low-light image recognition device in this embodiment of the invention will be described in detail from the perspective of hardware processing.
[0134] Figure 5This is a schematic diagram of the structure of a low-light image recognition device 500 provided in an embodiment of the present invention. The low-light image recognition 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 low-light image recognition 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 low-light image recognition device 500.
[0135] The low-light image recognition 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 5 The illustrated low-light image recognition device structure does not constitute a limitation on the low-light image recognition device. It may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0136] The present invention also provides a low-light image recognition device, wherein the computer device includes a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor performs the steps of the low-light image recognition method in the above embodiments.
[0137] 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 low-light image recognition method.
[0138] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0139] 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.
[0140] 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 low-light image recognition, characterized in that, The low-light image recognition method includes: Receive the image to be identified and parse the image to be identified to obtain the size parameters of the image to be identified; Based on the size parameters, the RGB component values of each pixel in the image to be identified are obtained, and the RGB component differences of each pixel in the image to be identified are calculated based on the RGB component values to obtain the set of differences corresponding to the image to be identified. Based on the set of differences, dark light regions are identified in the image to be identified to obtain dark light region information of the image to be identified. When the number of dark light pixels in the dark light region information is greater than a preset dark light pixel threshold, the image to be identified is determined to be a dark light image. The step of obtaining the RGB component values of each pixel in the image to be recognized according to the size parameters, and calculating the RGB component differences of each pixel in the image to be recognized based on the RGB component values to obtain the difference set corresponding to the image to be recognized, includes: extracting the RGB component values of each pixel in the image to be recognized according to the number of horizontal and vertical pixels in the size parameters, wherein the RGB component values include red component values, green component values, and blue component values; subtracting the red component values, green component values, and blue component values from each other in the RGB component values to obtain the RGB component differences of each pixel in the image to be recognized, wherein the RGB component differences include red-green component differences, red-blue component differences, and green-blue component differences; and combining the RGB component differences of each pixel in the image to be recognized to obtain the difference set corresponding to the image to be recognized. The step of identifying dark areas in the image to be identified based on the difference set to obtain dark area information of the image to be identified includes: constructing a component difference map of the image to be identified based on the difference set, wherein the component difference map includes a red-green component difference map, a red-blue component difference map, and a green-blue component difference map; calculating dark area pixels by performing dark area pixel calculations on the red-green component difference values of each pixel in the image to be identified using the red-green component difference map, and performing dark area pixel calculations on the red-blue component difference values of each pixel in the image to be identified using the red-blue component difference map, and performing dark area pixel calculations on the green-blue component difference values of each pixel in the image to be identified using the green-blue component difference map, thereby obtaining dark area information of the image to be identified.
2. The low-light image recognition method according to claim 1, characterized in that, The process of receiving the image to be identified and parsing the image to obtain its size parameters includes: Receive the image to be identified and read the image to be identified using a preset image processing tool; The preset image processing tool is used to traverse the pixels of the image to be identified to obtain the size parameters of the image to be identified, including the number of horizontal pixels and the number of vertical pixels.
3. The low-light image recognition method according to claim 1, characterized in that, The step of calculating dark-light pixels in the image to be identified by performing dark-light pixel calculations on the red-green component difference value of each pixel in the image to be identified using the red-green component difference map, the red-blue component difference map, and the green-blue component difference map, to obtain dark-light pixel information of the image to be identified, includes: The red-green component difference map is used to determine whether the red-green component difference corresponding to each pixel in the image to be identified is less than a preset red-green component threshold. The red-blue component difference map is used to determine whether the red-blue component difference corresponding to each pixel in the image to be identified is less than a preset red-blue component threshold. The green-blue component difference map is used to determine whether the green-blue component difference corresponding to each pixel in the image to be identified is less than a preset green-blue component threshold. If the difference between the red and green components is less than a preset red and green component threshold, the difference between the red and blue components is less than a preset red and blue component threshold, and the difference between the green and blue components is less than a preset green and blue component threshold, then the corresponding pixel is determined to be a dark-light pixel. The dark-light pixel includes the coordinate information of the dark-light pixel in the component difference map. The number of adjacent dark-light pixels and the image region are obtained. When the number of targets is greater than or equal to a preset dark-light region number threshold, the corresponding image region is determined as a dark-light region, and the dark-light region information of the image to be identified is obtained.
4. The low-light image recognition method according to claim 1 or 3, characterized in that, After determining that the image to be identified is a dark image when the number of dark-light pixels in the dark-light region information is greater than a preset dark-light pixel threshold, the dark-light image recognition method further includes: Obtain the dark light pixels in the dark light region information and the coordinate information of the dark light pixels in the component difference map, and determine the position information of the dark light pixels in the image to be identified through the coordinate information; Based on the location information, the dark areas corresponding to the dark area information are marked in the image to be identified, and the brightness information of the dark areas is output.
5. The low-light image recognition method according to claim 1, characterized in that, The step of determining the image to be identified as a dark image when the number of dark-light pixels in the dark-light region information is greater than a preset dark-light pixel threshold includes: Determine whether the number of dark light pixels in the dark light area information is greater than a preset dark light pixel threshold; If the number of dark-light pixels is greater than or equal to a preset dark-light pixel threshold, then the image to be identified is determined to be a dark-light image. If the number of dark-light pixels is less than a preset dark-light pixel threshold, then the image to be identified is determined to be a non-dark-light image.
6. A low-light image recognition device, characterized in that, The low-light image recognition device includes: A receiving module is used to receive an image to be recognized and parse the image to be recognized to obtain the size parameters of the image to be recognized; The calculation module is used to obtain the RGB component values of each pixel in the image to be recognized according to the size parameters, and calculate the RGB component differences of each pixel in the image to be recognized according to the RGB component values to obtain the difference set corresponding to the image to be recognized. The recognition module is used to identify dark areas of the image to be recognized based on the set of differences, and to obtain dark area information of the image to be recognized. The determination module is used to determine that the image to be identified is a dark image when the number of dark pixels in the dark area information is greater than a preset dark pixel threshold. The step of obtaining the RGB component values of each pixel in the image to be recognized according to the size parameters, and calculating the RGB component differences of each pixel in the image to be recognized based on the RGB component values to obtain the difference set corresponding to the image to be recognized, includes: extracting the RGB component values of each pixel in the image to be recognized according to the number of horizontal and vertical pixels in the size parameters, wherein the RGB component values include red component values, green component values, and blue component values; subtracting the red component values, green component values, and blue component values from each other in the RGB component values to obtain the RGB component differences of each pixel in the image to be recognized, wherein the RGB component differences include red-green component differences, red-blue component differences, and green-blue component differences; and combining the RGB component differences of each pixel in the image to be recognized to obtain the difference set corresponding to the image to be recognized. The step of identifying dark areas in the image to be identified based on the difference set to obtain dark area information of the image to be identified includes: constructing a component difference map of the image to be identified based on the difference set, wherein the component difference map includes a red-green component difference map, a red-blue component difference map, and a green-blue component difference map; calculating dark area pixels by performing dark area pixel calculations on the red-green component difference values of each pixel in the image to be identified using the red-green component difference map, and performing dark area pixel calculations on the red-blue component difference values of each pixel in the image to be identified using the red-blue component difference map, and performing dark area pixel calculations on the green-blue component difference values of each pixel in the image to be identified using the green-blue component difference map, thereby obtaining dark area information of the image to be identified.
7. A low-light image recognition device, characterized in that, The low-light image recognition device includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor invokes the instructions in the memory to cause the low-light image recognition device to perform the low-light image recognition method as described in any one of claims 1-5.
8. A computer-readable storage medium storing instructions thereon, characterized in that, When the instructions are executed by the processor, they implement the low-light image recognition method as described in any one of claims 1-5.
Citation Information
Patent Citations
Method and system for judging whether image is too dark or too bright
CN104700426A
Shadow zone cutting method of two-dimensional color scene
CN1818928A