Method and apparatus for image processing
By optimizing the color level or grayscale distribution of the image, the contrast and light and dark contrast of the image are improved, and the problem of insufficient contrast in the image processing in the prior art is solved, thereby achieving clearer image contours and more accurate target recognition.
Patent Information
- Application Number
- PCT/CN2024/121069
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-26
- Filing Date
- 2024-09-25
- Publication Date
- 2025-04-03
AI Technical Summary
The prior art is difficult to effectively improve the contrast of images, resulting in insufficient target detection, which affects the accuracy and efficiency of detection.
By acquiring the color level or grayscale distribution of the image, determining the second range and the third range, stretching the distribution within the second range, setting a threshold to optimize the color level or grayscale distribution, forming the second and third color level or grayscale distributions, and synthesizing the output image.
It improves the contrast of the image and enhances the contrast of light and dark in the image, making the image contour and shape clearer and the colors more vivid, and improves the accuracy and speed of target object recognition.
Smart Images

Figure CN2024121069_03042025_PF_FP_ABST
Abstract
Description
Method and device for image processing Technical Field
[0001] The present disclosure relates to the field of image processing, and more specifically, to a method, apparatus, computer program product, and storage medium for image processing, as well as a method and apparatus for identifying a target object, and a vehicle-assisted driving system and vehicle. Background Art
[0002] Images, as one of the most important sources of information for humans, account for a significant portion of various databases. With the rapid development of computer technology, image processing has been widely applied to various aspects of human life, such as industrial inspection, medicine, and intelligent robotics. Due to their vividness and intuitiveness, images are often used in various fields to describe and express the characteristics and logical relationships of objects. Therefore, the development of image processing technology and its application in various fields are extremely important.
[0003] Image processing technology uses computers to process image information. It primarily includes image object detection, image enhancement and restoration, image data encoding, image segmentation, and image recognition. Image object detection technology is widely used in applications such as security monitoring, autonomous driving, traffic monitoring, drone scene analysis, and robotic vision.
[0004] As target detection application scenarios become more and more complex, how to properly process images so that the difference between the target to be detected and the surrounding environment in the image is more obvious, thereby making target detection easier and more accurate, is one of the important research directions in the field of image processing and target detection.
[0005] Summary of the Invention
[0006] In order to effectively improve the contrast of an image, the present disclosure provides a method for image processing, including: obtaining a first color scale distribution corresponding to an input image, wherein the color scale range of the first color scale distribution is a first range; determining a second range and a third range excluding the second range in the first range, wherein the third range includes a color scale range located on the left and / or right side of the second range; performing distribution stretching on the first color scale distribution within the second range to obtain a second color scale distribution with a minimum color scale value being a first threshold and a maximum color scale value being a second threshold; obtaining a third color scale distribution based on the color scale distribution within the third range, wherein, when the third range includes a color scale range located on the left side of the second range, the color scale value of the color scale distribution within the third range located on the left side of the second range is set to the first threshold, and when the third range includes a color scale range located on the right side of the second range, the color scale value of the color scale distribution within the third range located on the right side of the second range is set to the second threshold; and determining an output image based on the second color scale distribution and the third color scale distribution.
[0007] An embodiment of the present disclosure also provides a method for identifying a target object, comprising: obtaining a first grayscale image containing the target object; obtaining a first grayscale distribution corresponding to the input first grayscale image, wherein the grayscale range of the first grayscale distribution is a first range; determining a second range and a third range excluding the second range in the first range, wherein the third range includes a color scale range located to the left and / or right of the second range; performing distribution stretching on the grayscale distribution within the second range to obtain a second grayscale distribution with a grayscale minimum value being a first threshold and a grayscale maximum value being a second threshold; obtaining a third color scale distribution based on the grayscale distribution within the third range, wherein, when the third range includes a color scale range located to the left of the second range, the color scale value of the grayscale distribution within the third range located to the left of the second range is set to the first threshold, and when the third range includes a color scale range located to the right of the second range, the color scale value of the grayscale distribution within the third range located to the right of the second range is set to the second threshold; determining a second grayscale image based on the second grayscale distribution and the third grayscale distribution; and identifying the target object based on the second grayscale image.
[0008] An embodiment of the present disclosure further provides an image processing device, comprising: a color scale distribution acquisition module, configured to: acquire a first color scale distribution corresponding to an input image, wherein the color scale range of the first color scale distribution is a first range; a range determination module, configured to: determine a second range and a third range other than the second range in the first range, wherein the third range includes a color scale range located on the left and / or right side of the second range; a color scale distribution optimization module, configured to: perform distribution stretching on the color scale distribution within the second range to obtain a second color scale distribution with a minimum color scale value being a first threshold and a maximum color scale value being a second threshold, and obtain a third color scale distribution based on the color scale distribution within the third range, wherein, when the third range includes a color scale range located on the left side of the second range, the color scale value of the color scale distribution within the third range located on the left side of the second range is set to the first threshold, and when the third range includes a color scale range located on the right side of the second range, the color scale value of the color scale distribution within the third range located on the right side of the second range is set to the second threshold; an image output module, configured to: determine an output image based on the second color scale distribution and the third color scale distribution.
[0009] An embodiment of the present disclosure further provides a device for identifying a target object, comprising: an image acquisition module, configured to: acquire a first grayscale image containing the target object; a grayscale distribution acquisition module, configured to: acquire a first grayscale distribution corresponding to the input first grayscale image, wherein the grayscale range of the first grayscale distribution is a first range; a range determination module, configured to: determine a second range and a third range other than the second range in the first range, wherein the third range includes a color scale range located to the left and / or right of the second range; a grayscale distribution optimization module, configured to: perform distribution stretching on the grayscale distribution within the second range to obtain a grayscale minimum value being a first threshold value and a grayscale maximum value being a first threshold value. A second grayscale distribution of the second threshold is obtained based on the grayscale distribution within the third range, wherein, when the third range includes a color scale range located on the left side of the second range, the color scale value of the grayscale distribution within the third range located on the left side of the second range is set to the first threshold, and when the third range includes a color scale range located on the right side of the second range, the color scale value of the grayscale distribution within the third range located on the right side of the second range is set to the second threshold; an image output module is configured to: output a second grayscale image based on the second grayscale distribution and the third grayscale distribution; a target recognition module is configured to: recognize the target object based on the second grayscale image.
[0010] An embodiment of the present disclosure further provides a computer program product, which includes computer software code. When the computer software code is executed by a processor, it provides the above-mentioned method for image processing.
[0011] An embodiment of the present disclosure further provides a computer-readable storage medium having computer-executable instructions stored thereon. When the instructions are executed by a processor, the above-mentioned method for image processing is provided.
[0012] An embodiment of the present disclosure also provides a vehicle assisted driving system, including: an image acquisition module, configured to: acquire images of the vehicle's surroundings and / or interior, and use the images as input images for an image processing module; an image processing module, configured to: process the input images using the above-mentioned method for image processing to obtain an optimized output image; and an image analysis module, configured to: determine the vehicle's assisted driving strategy based on the output image.
[0013] An embodiment of the present disclosure also provides a vehicle, which includes the above-mentioned vehicle assisted driving system.
[0014] The disclosed image processing method can effectively enhance contrast for images with any color distribution and reduce image processing complexity, thereby increasing image processing speed. Processing an image using the disclosed image processing method can improve the image's light-dark contrast, resulting in clearer outlines and shapes, more vivid colors, and a stronger sense of layering. This makes it easier to obtain more accurate results when identifying objects based on the processed image. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] To more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some exemplary embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0016] Herein, in the accompanying drawings:
[0017] FIG1 is a schematic diagram illustrating a method for image processing according to an embodiment of the present disclosure;
[0018] 2A-2D are schematic diagrams illustrating color scale distribution according to an embodiment of the present disclosure;
[0019] FIG3 is a schematic diagram illustrating a method for identifying a target object according to an embodiment of the present disclosure;
[0020] 4A-4B are schematic diagrams showing an image to be processed and its color scale distribution according to an embodiment of the present disclosure;
[0021] 4C-4D are schematic diagrams showing processed images and their color scale distributions for the embodiment shown in FIG. 4A-4B ;
[0022] FIG5 is a schematic diagram showing the composition of an image processing apparatus according to an embodiment of the present disclosure;
[0023] FIG6 is a schematic diagram showing the composition of an apparatus for identifying a target object according to an embodiment of the present disclosure;
[0024] FIG7 is a schematic diagram showing the composition of a vehicle assisted driving system according to an embodiment of the present disclosure; and
[0025] FIG8 illustrates an architecture of a computing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the present disclosure more apparent, the following will describe in detail exemplary embodiments of the present disclosure with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described herein.
[0027] Furthermore, in this specification and the drawings, steps and elements having substantially the same or similar features are denoted by the same or similar reference numerals, and repeated descriptions of these steps and elements will be omitted.
[0028] In addition, in this specification and the drawings, elements are described in singular or plural form, depending on the embodiment. However, the singular and plural forms are appropriately selected for the situations presented merely for convenience of explanation and are not intended to limit the present disclosure thereto. Therefore, the singular form may include the plural form, and the plural form may also include the singular form, unless the context clearly indicates otherwise.
[0029] In addition, in this specification and the drawings, the terms "first / second" are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first / second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein.
[0030] Furthermore, in this specification and the accompanying drawings, terms such as "upper," "lower," "vertical," and "horizontal" that relate to orientation or positional relationships are used merely to facilitate description of the embodiments of the present disclosure and are not intended to limit the present disclosure thereto. Therefore, they should not be construed as limiting the present disclosure.
[0031] Furthermore, in this specification and the drawings, unless expressly stated otherwise, “connection” does not necessarily mean “direct connection” or “direct contact”; here, “connection” may refer to both a fixed function and electrical connectivity.
[0032] To facilitate description of the present disclosure, concepts related to the present disclosure are introduced below.
[0033] Image processing technology is the use of computers to process image information, mainly including image target detection, image enhancement and restoration, image data encoding, image segmentation, and image recognition. Among them, image enhancement methods include: histogram equalization, contrast enhancement, sharpening, noise removal, color enhancement, super-resolution reconstruction, and color correction.
[0034] Object detection is a key application in artificial intelligence. It involves identifying and locating semantic objects (such as people, buildings, or cars) in digital images and videos. Object detection is a crucial task in computer vision, involving techniques such as image segmentation, object tracking, and keypoint detection. It is widely used in many areas of modern life, including security, military, transportation, healthcare, and everyday life. For example, object detection technology can be used to implement security monitoring, intelligent transportation, medical imaging analysis, and autonomous driving.
[0035] The basic process of target detection usually includes the following steps: first, image preprocessing, including noise removal, enhancement and other operations; second, feature extraction, using deep learning or other methods to extract features that can represent the target object from the image; then, classifier design, using training data to train the classifier to achieve recognition of different target objects; finally, target localization and bounding box regression, to determine the position and size of the target object in the image.
[0036] In summary, the present disclosure relates to technologies such as image processing and target detection. The following further describes embodiments of the present disclosure with reference to the accompanying drawings.
[0037] FIG. 1 is a schematic diagram illustrating a method 100 for image processing according to an embodiment of the present disclosure.
[0038] It should be understood that the image processing method 100 disclosed herein can be used to achieve image enhancement in various application scenarios such as security monitoring, autonomous driving, traffic condition monitoring, drone scene analysis, robot vision, and medical image analysis.
[0039] In step S110 , a first color scale distribution corresponding to the input image is obtained, wherein the color scale range of the first color scale distribution is a first range.
[0040] It should be understood that the image processing method 100 disclosed herein can process both grayscale images and color images.
[0041] Specifically, according to an embodiment of the present disclosure, the input image may be a grayscale image, and the first color scale distribution may be a grayscale distribution (eg, a grayscale histogram).
[0042] According to another embodiment of the present disclosure, the input image may also be a color image. In this case, a distribution corresponding to a channel of the input image may be obtained and used as the first color level distribution (e.g., a color level histogram of the channel), where the channel is one of a red channel, a green channel, and a blue channel.
[0043] It should be noted that the color level distribution in the present disclosure can be in the form of a color level histogram (for example, the horizontal axis represents the color level value, and the vertical axis represents the number of pixels corresponding to the color level value), or it can be a color level probability distribution (for example, the horizontal axis represents the color level value, and the vertical axis represents the probability corresponding to the color level value).
[0044] In step S120 , a second range and a third range other than the second range are determined in the first range, wherein the third range includes a color scale range located on the left and / or right of the second range.
[0045] According to an embodiment of the present disclosure, the third range can be determined based on the product of the total number of pixels corresponding to the input image and a predetermined coefficient, wherein the number of pixels corresponding to the color scale distribution within the third range is not greater than the product of the total number of pixels corresponding to the input image and the predetermined coefficient.
[0046] It should be understood that the predetermined coefficients can be determined based on experience. Alternatively, the predetermined coefficients can also be determined based on a neural network model. For example, image samples that display a clearer target object after processing can be used as positive samples to train the neural network model to determine model parameters. Based on the trained neural network model, appropriate values for the predetermined coefficients can be determined to ensure a clearer display of the target object in the processed image.
[0047] Optionally, when the third range includes both color scale ranges located on the left and right sides of the second range, the first number of pixels can be determined based on the product of the total number of pixels corresponding to the input image and a first predetermined coefficient, and the fourth range located on the left side of the second range can be determined based on the first number of pixels, wherein the number of pixels corresponding to the color scale distribution within the fourth range is not greater than the first number of pixels; and / or the second number of pixels can be determined based on the product of the total number of pixels corresponding to the input image and a second predetermined coefficient, and the fifth range located on the right side of the second range can be determined based on the second number of pixels, wherein the number of pixels corresponding to the color scale distribution within the fifth range is not greater than the second number of pixels; wherein the third range includes the fourth range and the fifth range.
[0048] For example, assuming that the input image has M pixels on its long side and N pixels on its wide side, the total number of pixels corresponding to the input image is M*N. A first pixel count, M*N*C1, can be determined based on the product of the total pixel count, M*N, corresponding to the input image and a first predetermined coefficient, C1. The number of pixels in a fourth range, located to the left of the second range, is no greater than the first pixel count, M*N*C1. A second pixel count, M*N*C2, can be determined based on the product of the total pixel count, M*N, corresponding to the input image and a second predetermined coefficient, C2. The number of pixels in a fifth range, located to the right of the second range, is no greater than the second pixel count, M*N*C2.
[0049] Optionally, in the case where the third range only includes the color scale range located to the left of the second range, the third number of pixels can be determined based on the product of the total number of pixels corresponding to the input image and a third predetermined coefficient, and the third range located to the left of the second range can be determined based on the third number of pixels, wherein the number of pixels corresponding to the color scale distribution within the third range is not greater than the third number of pixels. For example, assuming that the long side of the input image has M pixels and the wide side has N pixels, then the total number of pixels corresponding to the input image is M*N. The third number of pixels M*N*C3 can be determined based on the product of the total number of pixels M*N corresponding to the input image and a third predetermined coefficient C3, and the number of pixels in the third range located to the left of the second range is not greater than the third number of pixels M*N*C3.
[0050] Alternatively, in the case where the third range only includes the color scale range located to the right of the second range, a fourth number of pixels can be determined based on the product of the total number of pixels corresponding to the input image and a fourth predetermined coefficient, and the third range located to the right of the second range can be determined based on the fourth number of pixels, wherein the number of pixels corresponding to the color scale distribution within the third range is not greater than the fourth number of pixels. For example, assuming that the long side of the input image has M pixels and the wide side has N pixels, then the total number of pixels corresponding to the input image is M*N. The fourth number of pixels M*N*C4 can be determined based on the product of the total number of pixels M*N corresponding to the input image and a fourth predetermined coefficient C4, and the number of pixels in the third range located to the right of the second range is not greater than the first number of pixels M*N*C4.
[0051] In step S130 , the first color scale distribution within the second range is stretched to obtain a second color scale distribution whose minimum color scale value is a first threshold and whose maximum color scale value is a second threshold.
[0052] According to an embodiment of the present disclosure, the color scale values of the color scale distribution within the second range can be linearly transformed to obtain a second color scale distribution with a minimum color scale value being a first threshold and a maximum color scale value being a second threshold, wherein the first threshold is less than the minimum value of the second range and the second threshold is greater than the maximum value of the second range.
[0053] It should be understood that the distribution stretching based on linear transformation is used as an example here for explanation. In fact, the distribution stretching can also be implemented based on other methods (for example, through various functions that transform the second range into a sixth range, where the minimum value of the sixth range is the first threshold and the maximum value is the second threshold).
[0054] In step S140 , a third color scale distribution is obtained based on the color scale distribution within the third range.
[0055] According to an embodiment of the present disclosure, when the third range includes a color scale range located on the left side of the second range, the color scale value of the color scale distribution within the third range located on the left side of the second range can be set to the first threshold; when the third range includes a color scale range located on the right side of the second range, the color scale value of the color scale distribution within the third range located on the right side of the second range can be set to the second threshold.
[0056] It should be understood that in order to make the image resolution improvement effect as obvious as possible, the first threshold can be set to 0 and the second threshold can be set to 255. However, in practice, the first threshold can be any value less than the minimum value of the second range, and the second threshold can be any value greater than the maximum value of the second range.
[0057] According to an embodiment of the present disclosure, when the third range includes a color scale range located on the left side of the second range, the color scale value of the grayscale distribution within the third range located on the left side of the second range can be set as the third threshold; and when the third range includes a color scale range located on the right side of the second range, the color scale value of the grayscale distribution within the third range located on the right side of the second range can be set as the fourth threshold, wherein the third threshold is smaller than the first threshold and the fourth threshold is larger than the second threshold.
[0058] In step S150 , an output image is determined based on the second color scale distribution and the third color scale distribution.
[0059] According to an embodiment of the present disclosure, if the input image is a color image, the distribution corresponding to the red channel can be used as the first color scale distribution to determine a first output image; the distribution corresponding to the green channel can be used as the first color scale distribution to determine a second output image; and the distribution corresponding to the blue channel can be used as the first color scale distribution to determine a third output image. The first, second, and third output images can then be superimposed to determine an optimized color image.
[0060] According to an embodiment of the present disclosure, a synthesized color scale distribution may be obtained based on the second color scale distribution and the third color scale distribution, and the output image may be determined based on the synthesized color scale distribution.
[0061] Optionally, the synthesized color scale distribution can be further adjusted, and the output image can be determined based on the adjusted color scale distribution. For example, the brightness and darkness range of the synthesized color scale distribution can be adjusted (for example, if the synthesized color scale distribution is concentrated in the dark area (i.e., the corresponding image brightness is low), the synthesized color scale distribution can be adjusted as a whole toward the brighter area to increase the brightness of the image; if the synthesized color scale distribution is concentrated in the bright area (i.e., the corresponding image brightness is high), the synthesized color scale distribution can be adjusted as a whole toward the darker area to prevent the image from being overexposed), the noise of the synthesized color scale distribution can be adjusted (for example, denoising), and so on.
[0062] By processing an image using method 100, the contrast of an image with any color scale distribution can be effectively improved. That is, whether the color scale is distributed in the entire range of 0-255 or in other ranges between 0-255 (for example, the color scale is distributed in the range of 100-200), the contrast can be improved using the method disclosed herein, while the traditional contrast improvement method can only improve the contrast of images with a color scale distribution between 0-255 (for example, the color scale is distributed in the range of 100-200), but cannot improve the contrast of images with a color scale distribution in the entire range of 0-255. The processing using method 100 can make the outline and shape of the image clearer, and the colors more vivid and bright, thereby enhancing the layering of the image. Furthermore, when performing target object recognition based on the processed image, more accurate results can be obtained more easily.
[0063] Since the color scale value of the grayscale distribution within the third range is directly set to a predetermined value (for example, the first threshold or the second threshold) in step S140 of method 100, and there is no need to perform further transformation processing on the color scale value of the grayscale distribution within the third range, method 100 can reduce the complexity of image processing and improve the speed of image processing while improving image contrast.
[0064] FIG2A is a schematic diagram illustrating a first color scale distribution corresponding to an input image according to an embodiment of the present disclosure.
[0065] As shown in FIG2A , the minimum value of the first color scale distribution range of the input image is a, and the maximum value is d. In the first color scale distribution range, there may also be color scale values b and c, and satisfy 0 <a<b<c<d<255。
[0066] Optionally, the range between color levels b and c in the first range can be determined as the second color level range, and the range other than the second range can be determined as the third range (i.e., the third range includes the fourth range between a and b and the fifth range between c and d).
[0067] According to an embodiment of the present disclosure, a first number of pixels M*N*C1 can be determined based on the product of the total number of pixels corresponding to the input image (assuming that the long side of the input image has M pixels and the wide side has N pixels, then the total number of pixels corresponding to the input image is M*N) and a first predetermined coefficient C1 (for example, 4%), and the fourth range can be determined based on the first number of pixels, wherein the number of pixels corresponding to the color scale distribution within the fourth range is not greater than the first number of pixels. A second number of pixels M*N*C2 can be determined based on the product of the total number of pixels M*N corresponding to the input image and a second predetermined coefficient C2 (for example, 5%), and the fifth range can be determined based on the second number of pixels, wherein the number of pixels corresponding to the color scale distribution within the fifth range is not greater than the second number of pixels.
[0068] By stretching the first color scale distribution within the second range, a second color scale distribution with a minimum color scale value of 0 and a maximum color scale value of 255 can be obtained (as shown in FIG. 2B ).
[0069] By stretching the first color level distribution within the second range (for example, it can be achieved through linear transformation, but not limited to this), the color level distribution is no longer concentrated in the range between b and c, but is distributed in a larger range between 0 and 255, thereby achieving contrast stretching.
[0070] At the same time, the color scale value of the color scale distribution within the fourth range can be set to 0, and the color scale value of the color scale distribution within the fifth range can be set to 255. Therefore, the color scale distribution within the third range (including the fourth range and the fifth range) is transformed into the color scale distribution shown in FIG2C.
[0071] That is, the transformation of the first color scale distribution can be achieved by the following formula:
[0072] Wherein, x represents the color scale value before transformation, and f(x) represents the color scale value after transformation.
[0073] By superimposing the color scale distribution shown in FIG2B and the color scale distribution shown in FIG2C, a synthesized color scale distribution as shown in FIG2D can be obtained. Furthermore, an output image can be determined based on the synthesized color scale distribution. Compared with the input image, the contrast of the output image is improved.
[0074] FIG3 is a schematic diagram illustrating a method 300 for identifying a target object according to an embodiment of the present disclosure.
[0075] In step S310, a first grayscale image containing the target object is acquired.
[0076] It should be understood that although target object recognition can be performed based on color images, if the color of the target object is not the key to distinguish, target recognition based on grayscale images can further reduce the complexity of image processing and speed up image processing.
[0077] In step S320, a first grayscale distribution corresponding to the input first grayscale image is obtained, wherein the grayscale range of the first grayscale distribution is a first range.
[0078] According to an embodiment of the present disclosure, the grayscale distribution may be in the form of a grayscale histogram, that is, the abscissa of the grayscale histogram represents the grayscale value (eg, ranging from 0 to 255), and the ordinate represents the number of pixels corresponding to the grayscale value.
[0079] It should be understood that the grayscale distribution of an image may be distributed throughout the entire range of 0-255, or may be distributed within other ranges between 0-255 (e.g., within the range of 100-200). For images with grayscale distributions within any range, the method 300 can effectively improve the image contrast and more accurately identify the target object.
[0080] In step S330 , a second range and a third range other than the second range are determined in the first range, wherein the third range includes a color scale range located on the left and / or right of the second range.
[0081] That is, the second range can be a low brightness range, a high brightness range, or a medium brightness range. In the case where the second range is any of the above three ranges, the method 300 can effectively improve the contrast of the image and more accurately identify the target object.
[0082] In step S340 , the grayscale distribution within the second range is stretched to obtain a second grayscale distribution whose grayscale minimum value is a first threshold and whose grayscale maximum value is a second threshold.
[0083] It should be understood that the first threshold should be smaller than the minimum value of the second range, and the second threshold should be larger than the maximum value of the second range.
[0084] In step S350, a third color scale distribution is obtained based on the grayscale distribution within the third range.
[0085] According to an embodiment of the present disclosure, when the third range includes a color scale range located on the left side of the second range, the color scale value of the grayscale distribution within the third range located on the left side of the second range can be set to the first threshold; when the third range includes a color scale range located on the right side of the second range, the color scale value of the grayscale distribution within the third range located on the right side of the second range can be set to the second threshold.
[0086] In step S360 , a second grayscale image is determined based on the second grayscale distribution and the third grayscale distribution.
[0087] For example, a synthesized grayscale distribution may be obtained based on the second grayscale distribution and the third grayscale distribution, and the second grayscale image may be determined based on the synthesized grayscale distribution.
[0088] It should be understood that the processing of steps S320 to S360 in FIG. 3 may be similar to steps S110 to S150 in FIG. 1 , and thus will not be described in detail herein.
[0089] In step S370, the target object is identified based on the second grayscale image.
[0090] It should be understood that the process of identifying the target object can be implemented based on various target recognition methods. For example, the target recognition method can be implemented based on a neural network model. Alternatively, the target object can be identified based on the second grayscale image based on a trained neural network model, and the recognition result of the target object can be displayed. The result can include the position and size of the target object in the image (for example, it can be represented by a box at the location of the target object).
[0091] FIG4A shows an image to be processed according to an embodiment of the present disclosure (herein, a grayscale image is used as an example for description).
[0092] As shown in FIG4A , the camera on the vehicle captures an image of the garage. However, since the entire image is gray, the garage line is closely distinguished from the surrounding environment. If parking is performed based on FIG4A , the garage line cannot be clearly identified, which can easily lead to misjudgment.
[0093] FIG. 4B is a schematic diagram of the color level distribution corresponding to the image shown in FIG. 4A (herein, a grayscale histogram is used as an example for explanation).
[0094] Since the image shown in FIG. 4A is gray as a whole, it can be seen from FIG. 4B that the grayscale values of the pixels corresponding to the image shown in FIG. 4A are concentrated in the middle.
[0095] By processing the grayscale histogram shown in FIG. 4B using the method shown in FIG. 1 , a processed grayscale histogram (ie, as shown in FIG. 4C ) can be obtained.
[0096] As can be seen in Figure 4C, the grayscale values of the pixels in the processed grayscale histogram are now distributed over a wider range. The processed image obtained based on Figure 4C is shown in Figure 4D. A comparison of Figures 4A and 4D shows that the image contrast is significantly improved after processing, and the clarity of the parking garage lines in the image is significantly increased. Therefore, based on the processed image, parking operations and other operations can be more easily performed, preventing misjudgments and improving driving safety.
[0097] FIG5 is a schematic diagram showing the composition of an image processing apparatus 500 according to an embodiment of the present disclosure.
[0098] According to an embodiment of the present disclosure, the image processing apparatus 500 may include: a tone scale distribution acquisition module 510 , a range determination module 520 , a tone scale distribution optimization module 530 , and an image output module 540 .
[0099] The image processing device 500 can process both grayscale images and color images.
[0100] Specifically, the color scale distribution acquisition module 510 may be configured to: acquire a first color scale distribution corresponding to the input image, wherein the color scale range of the first color scale distribution is a first range.
[0101] The range determination module 520 may be configured to determine a second range and a third range other than the second range in the first range, wherein the third range includes a color scale range located on the left and / or right of the second range.
[0102] The color scale distribution optimization module 530 can be configured to: perform distribution stretching on the color scale distribution within the second range to obtain a second color scale distribution with a minimum color scale value being a first threshold and a maximum color scale value being a second threshold; obtain a third color scale distribution based on the color scale distribution within the third range, wherein, when the third range includes a color scale range located on the left side of the second range, the color scale value of the color scale distribution within the third range located on the left side of the second range is set to the first threshold, and when the third range includes a color scale range located on the right side of the second range, the color scale value of the color scale distribution within the third range located on the right side of the second range is set to the second threshold.
[0103] The image output module 540 may be configured to determine an output image based on the second color scale distribution and the third color scale distribution.
[0104] It should be understood that the image processing apparatus 500 shown in FIG5 can implement the various image processing methods described with respect to FIG1 , and will not be further described herein. The image processing apparatus 500 can be located on a server (e.g., obtaining an input image sent by a user device via a network and sending a processed output image to the user device) or on a user terminal (e.g., obtaining an input image via a camera on the user device or obtaining an image from a memory of the user device as an input image and providing a processed output image to a display of the user device).
[0105] FIG6 is a schematic diagram showing the composition of an apparatus 600 for identifying a target object according to an embodiment of the present disclosure.
[0106] According to an embodiment of the present disclosure, the apparatus 600 for identifying a target object may include: an image acquisition module 610 , a grayscale distribution acquisition module 620 , a range determination module 630 , a grayscale distribution optimization module 640 , an image output module 650 and a target recognition module 660 .
[0107] Specifically, the image acquisition module 610 may be configured to: acquire a first grayscale image containing the target object.
[0108] The grayscale distribution acquisition module 620 may be configured to: acquire a first grayscale distribution corresponding to the input first grayscale image, wherein the grayscale range of the first grayscale distribution is a first range.
[0109] The range determination module 630 may be configured to determine a second range and a third range other than the second range in the first range, wherein the third range includes a color scale range located on the left and / or right of the second range.
[0110] The grayscale distribution optimization module 640 can be configured to: stretch the grayscale distribution within the second range to obtain a second grayscale distribution with a minimum grayscale value of a first threshold and a maximum grayscale value of a second threshold, and obtain a third color scale distribution based on the grayscale distribution within the third range.
[0111] The image output module 650 may be configured to output a second grayscale image based on the second grayscale distribution and the third grayscale distribution.
[0112] The target recognition module 660 may be configured to recognize the target object based on the second grayscale image.
[0113] It should be noted that the target object recognition device 600 shown in FIG6 can implement various image processing methods as described for FIG3, which will not be described in detail here. The target object recognition device 600 can be located on a server or on a user terminal.
[0114] It should be understood that the image processing device 500 and the device for identifying the target object 600 can be deployed in scenarios such as security monitoring, autonomous driving, traffic condition monitoring, drone scene analysis, robot vision, and medical image analysis.
[0115] FIG7 is a schematic diagram showing the composition of a vehicle assisted driving system 700 according to an embodiment of the present disclosure.
[0116] It should be understood that different types of vehicle assistance systems can be used on a vehicle depending on the application scenario. For example, the vehicle assisted driving system 700 in the present disclosure can be either an automatic driving (AD) system or an assisted driving (AP) system for the vehicle, which can be used to implement functions such as automatic tracking, automatic parking, assisted parking, and lane crossing warning.
[0117] According to an embodiment of the present disclosure, the vehicle assisted driving system 700 may include: an image acquisition module 710 , an image processing module 720 and an image analysis module 730 .
[0118] Specifically, the image acquisition module 710 may be configured to acquire images of the surroundings and / or interior of the vehicle and use the images as input images for the image processing module.
[0119] It should be understood that the image acquisition module 710 can use a camera to acquire images of the vehicle's surroundings (e.g., lane markings, vehicles in front and behind, etc.) and / or images of the vehicle's interior (e.g., the driver, the dashboard, etc.). Different cameras with different performance can be selected for low-speed and high-speed application scenarios.
[0120] Depending on the required performance, the image acquired by the image acquisition module 710 can be either a grayscale image or a color image.
[0121] The image processing module 720 may be configured to process the input image to obtain an optimized output image.
[0122] The image processing module 720 may process the image using any of the methods shown in FIG. 1 .
[0123] The image analysis module 730 may be configured to determine an assisted driving strategy for the vehicle based on the output image.
[0124] For example, the image analysis module 730 may provide an automatic parking service if a garage is detected based on the output image. Alternatively, the image analysis module 730 may issue an alarm to alert the driver if a car is detected to have crossed a lane line.
[0125] By applying the method disclosed herein to a vehicle-assisted driving system on a vehicle, images around and / or inside the vehicle can be analyzed more accurately to provide more accurate assisted driving services, thereby making it possible for vehicles to become intelligent.
[0126] In general, various example embodiments of the present disclosure may be implemented in hardware or dedicated circuitry, software, firmware, logic, or any combination thereof. Certain aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device. When various aspects of the embodiments of the present disclosure are illustrated or described as block diagrams, flow charts, or using some other graphical representation, it will be understood that the blocks, devices, systems, techniques, or methods described herein may be implemented, as non-limiting examples, in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or a controller or other computing device, or some combination thereof.
[0127] For example, the method or apparatus according to an embodiment of the present disclosure may also be implemented with the aid of the architecture of the computing device 3000 shown in FIG8 . As shown in FIG8 , the computing device 3000 may include a bus 3010, one or more CPUs 3020, a read-only memory (ROM) 3030, a random access memory (RAM) 3040, a communication port 3050 connected to a network, an input / output component 3060, a hard disk 3070, and the like. The storage device in the computing device 3000, such as the ROM 3030 or the hard disk 3070, may store various data or files used for processing and / or communication of the method provided by the present disclosure, as well as program instructions executed by the CPU. The computing device 3000 may also include a user interface 3080. Of course, the architecture shown in FIG8 is merely exemplary. When implementing different devices, one or more components in the computing device shown in FIG8 may be omitted according to actual needs.
[0128] According to another aspect of the present disclosure, a computer-readable storage medium is also provided. Computer-readable instructions are stored on the computer storage medium. When the computer-readable instructions are executed by a processor, the method according to the embodiment of the present disclosure described with reference to the above figures can be executed. The computer-readable storage medium in the embodiment of the present disclosure can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. The non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that memory of the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory. It should be noted that memory of the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0129] Embodiments of the present disclosure also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform a method according to an embodiment of the present disclosure.
[0130] In summary, an embodiment of the present disclosure provides a method for image processing, including: obtaining a first color scale distribution corresponding to an input image, wherein the color scale range of the first color scale distribution is a first range; determining a second range and a third range other than the second range in the first range, wherein the third range includes a color scale range located on the left and / or right side of the second range; performing distribution stretching on the first color scale distribution within the second range to obtain a second color scale distribution with a minimum color scale value being a first threshold and a maximum color scale value being a second threshold; obtaining a third color scale distribution based on the color scale distribution within the third range, wherein, when the third range includes a color scale range located on the left side of the second range, the color scale value of the color scale distribution within the third range located on the left side of the second range is set to the first threshold, and when the third range includes a color scale range located on the right side of the second range, the color scale value of the color scale distribution within the third range located on the right side of the second range is set to the second threshold; and determining an output image based on the second color scale distribution and the third color scale distribution.
[0131] The disclosed image processing method can effectively improve the contrast of images with any color distribution and reduce the complexity of image processing, thereby increasing the speed of image processing. After processing an image using the disclosed image processing method, the image's light and dark contrast can be improved, making the image's outlines and shapes clearer and the colors more vivid and bright, thereby enhancing the image's layering. This makes it easier to obtain more accurate results when identifying target objects based on the processed image.
[0132] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of the code, and the module, program segment, or a part of the code contains at least one executable instruction for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or can be implemented using a combination of dedicated hardware and computer instructions.
[0133] This disclosure uses specific terms to describe the embodiments of the present disclosure. For example, "first / second embodiment," "one embodiment," and / or "some embodiments" refer to a certain feature, structure, or characteristic associated with at least one embodiment of the present disclosure. Therefore, it should be emphasized and noted that "one embodiment," "an embodiment," or "an alternative embodiment" mentioned two or more times in different locations in this specification does not necessarily refer to the same embodiment. In addition, certain features, structures, or characteristics in one or more embodiments of the present disclosure may be appropriately combined.
[0134] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology and should not be interpreted in an idealized or highly formal sense, unless expressly defined as such herein.
[0135] The above is an illustration of the present invention and should not be considered as limiting thereof. Although several exemplary embodiments of the present invention have been described, it will be readily understood by those skilled in the art that many modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present invention. Therefore, all such modifications are intended to be included within the scope of the present invention as defined by the claims. It should be understood that the above is an illustration of the present invention and should not be considered as being limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present invention is defined by the claims and their equivalents.
Claims
1. A method for image processing, comprising: Obtaining a first color scale distribution corresponding to an input image, wherein a color scale range of the first color scale distribution is a first range; Determine a second range and a third range except the second range in the first range, wherein the third range includes a color scale range located on the left and / or right of the second range; Stretching the first color scale distribution within the second range to obtain a second color scale distribution whose minimum color scale value is a first threshold value and whose maximum color scale value is a second threshold value; A third color scale distribution is obtained based on the color scale distribution within the third range, wherein, when the third range includes a color scale range located on the left side of the second range, the color scale value of the color scale distribution within the third range located on the left side of the second range is set to the first threshold value, and when the third range includes a color scale range located on the right side of the second range, the color scale value of the color scale distribution within the third range located on the right side of the second range is set to the second threshold value; and An output image is determined based on the second color scale distribution and the third color scale distribution.
2. The method of claim 1, wherein: Determining a second range and a third range other than the second range in the first range includes: The third range is determined based on the product of the total number of pixels corresponding to the input image and a predetermined coefficient, wherein the number of pixels corresponding to the color scale distribution within the third range is not greater than the product of the total number of pixels corresponding to the input image and the predetermined coefficient.
3. The method of claim 2, wherein: In the case where the third range includes the color scale ranges located on the left and right sides of the second range, determining that the third range includes based on the product of the total number of pixels corresponding to the input image and a predetermined coefficient: Determine a first pixel number based on the product of the total number of pixels corresponding to the input image and a first predetermined coefficient, and determine a fourth range located on the left side of the second range based on the first pixel number, wherein the number of pixels corresponding to the color scale distribution within the fourth range is not greater than the first pixel number; and / or Determine a second number of pixels based on the product of the total number of pixels corresponding to the input image and a second predetermined coefficient, and determine a fifth range located on the right side of the second range based on the second number of pixels, wherein the number of pixels corresponding to the color scale distribution within the fifth range is not greater than the second number of pixels; Among them, the third range includes the fourth range and the fifth range.
4. The method of claim 1, wherein: Stretching the color scale distribution within the second range to obtain a second color scale distribution with a minimum color scale value of a first threshold and a maximum color scale value of a second threshold includes: Performing a linear transformation on the color scale values of the color scale distribution within the second range to obtain a second color scale distribution whose minimum color scale value is a first threshold value and whose maximum color scale value is a second threshold value, The first threshold is smaller than the minimum value of the second range, and the second threshold is larger than the maximum value of the second range.
5. The method of claim 1, wherein: The input image is a grayscale image, and the first color scale distribution, the second color scale distribution and the third color scale distribution are grayscale distributions.
6. The method of claim 1, wherein: The input image is a color image, Obtaining a first color scale distribution corresponding to the input image includes: A distribution corresponding to a channel is obtained for the input image, and the distribution corresponding to the channel is used as the first color scale distribution, wherein the channel is one of a red channel, a green channel, and a blue channel.
7. The method of claim 6, wherein: Using the distribution corresponding to the red channel as the first color scale distribution to determine a first output image; Using the distribution corresponding to the green channel as the first color scale distribution to determine the second output image; Using the distribution corresponding to the blue channel as the first color scale distribution to determine a third output image; The image processing method further includes: superimposing the first output image, the second output image, and the third output image to determine an optimized color image, The output image includes the first output image, the second output image and the The third output image.
8. The method of claim 1, wherein: Determining an output image based on the second color scale distribution and the third color scale distribution includes: Obtaining a synthesized color scale distribution based on the second color scale distribution and the third color scale distribution; and The output image is determined based on the synthesized color scale distribution, or the synthesized color scale distribution is adjusted and the output image is determined based on the adjusted color scale distribution, wherein adjusting the synthesized color scale distribution includes: adjusting at least one of the light and dark range of the synthesized color scale distribution and adjusting the noise of the synthesized color scale distribution.
9. A method for identifying a target object, comprising: Acquire a first grayscale image containing the target object; Acquire a first grayscale distribution corresponding to the input first grayscale image, wherein a grayscale range of the first grayscale distribution is a first range; Determine a second range and a third range except the second range in the first range, wherein the third range includes a color scale range located on the left and / or right of the second range; Stretching the grayscale distribution within the second range to obtain a second grayscale distribution whose grayscale minimum value is a first threshold and whose grayscale maximum value is a second threshold; A third color scale distribution is obtained based on the grayscale distribution within the third range, wherein, when the third range includes a color scale range located on the left side of the second range, the color scale value of the grayscale distribution within the third range located on the left side of the second range is set to the first threshold value, and when the third range includes a color scale range located on the right side of the second range, the color scale value of the grayscale distribution within the third range located on the right side of the second range is set to the second threshold value; determining a second grayscale image based on the second grayscale distribution and the third grayscale distribution; The target object is identified based on the second grayscale image.
10. The method of claim 9, wherein: Determining a second range and a third range other than the second range in the first range includes: The third range is determined based on the product of the total number of pixels corresponding to the first grayscale image and a predetermined coefficient, wherein the number of pixels corresponding to the color scale distribution within the third range is not greater than the product of the total number of pixels corresponding to the input image and the predetermined coefficient.
11. The method of claim 10, wherein: In the case where the third range includes the color scale ranges located on the left and right of the second range, the third range is determined based on the product of the total number of pixels corresponding to the first grayscale image and a predetermined coefficient: Determine a first pixel number based on the product of the total number of pixels corresponding to the first grayscale image and a first predetermined coefficient, and determine a fourth range located on the left side of the second range based on the first pixel number, wherein the number of pixels corresponding to the color scale distribution within the fourth range is not greater than the first pixel number; Determine a second number of pixels based on the product of the total number of pixels corresponding to the first grayscale image and a second predetermined coefficient, and determine a fifth range located on the right side of the second range based on the second number of pixels, wherein the number of pixels corresponding to the color scale distribution within the fifth range is not greater than the second number of pixels; Among them, the third range includes the fourth range and the fifth range.
12. An image processing device, comprising: The color scale distribution acquisition module is configured to: acquire a first color scale distribution corresponding to the input image, wherein the color scale range of the first color scale distribution is a first range; A range determination module, configured to: determine a second range and a third range other than the second range in the first range, wherein the third range includes a color scale range located on the left and / or right of the second range; The color distribution optimization module is configured as follows: Stretching the color scale distribution within the second range to obtain a second color scale distribution whose minimum color scale value is a first threshold and whose maximum color scale value is a second threshold; A third color scale distribution is obtained based on the color scale distribution within the third range, wherein, when the third range includes a color scale range located on the left side of the second range, the color scale value of the color scale distribution within the third range located on the left side of the second range is set as the first threshold value, and when the third range includes a color scale range located on the right side of the second range, the color scale value of the color scale distribution within the third range located on the right side of the second range is set as the second threshold value; The image output module is configured to determine an output image based on the second color scale distribution and the third color scale distribution.
13. A computer program product, comprising computer software code, which is used to implement the method according to any one of claims 1 to 11 when executed by a processor.
14. A computer-readable storage medium having computer-executable instructions stored thereon, wherein the instructions are used to implement the method according to any one of claims 1 to 11 when executed by a processor.
15. A vehicle assisted driving system, comprising: An image acquisition module is configured to: acquire an image of the surroundings and / or the interior of the vehicle, and use the image as an input image for the image processing module; An image processing module, configured to: process the input image by the method according to any one of claims 1 to 8 to obtain an optimized output image; The image analysis module is configured to determine the assisted driving strategy of the vehicle based on the output image.
16. A vehicle comprising the vehicle assisted driving system as claimed in claim 15.
Citation Information
Patent Citations
Gray scale image fitting enhancement method based on local histogram equalization
CN105654438A
Video image self-adaptive contrast enhancement method and device
CN106570833A
Underwater image enhancement method based on adaptive histogram stretching of different color spaces
CN107507145A
Underwater image enhancement method based on color correction and three-interval histogram stretching
CN112419210A
Image hue restoration type defogging enhancement method based on unmanned aerial vehicle low-altitude visual angle
CN112508814A
Cited By
Self-adaptive image dedusting method, device and equipment
CN120580249A