A method, device, medium and equipment for road spillage recognition
Through the adaptive grayscale based on color and step-by-step adjustment of pixel values in the background area, the problem of inaccurate recognition of sprinkles under light changes is solved, and accurate and rapid recognition is achieved in outdoor environments.
Patent Information
- Application Number
- CN202411835677.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2044-12-13
AI Technical Summary
In the prior art, the identification effect of road sprinklers is poor, especially under the influence of changes in light intensity in outdoor environments, reflections or shadows often appear on the target object or around the image, making it difficult to accurately identify the outline of the sprinklers in threshold segmentation.
The original image is processed using color-based adaptive grayscale processing, adjusting the pixel value of the background area, and threshold segmentation is performed by stepping the pixel value of the background area until the matching similarity reaches the threshold, and the identification of the thrown object is completed.
Under the influence of light, accurate and rapid identification of sprinkled objects is achieved, and the identification effect of sprinkled objects on the road is improved.
Smart Images

Figure CN119741659B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of road monitoring, and specifically relates to a method, device, medium, and equipment for identifying road spills. Background Technique
[0002] Road monitoring mainly relies on dome cameras. The monitoring points are distributed on the road, and the road traffic conditions are uploaded to the road monitoring command center in real time through the image transmission channel. The center duty officers can thus timely understand the road conditions in each area. An important aspect is the identification of road spills. Especially for main roads and highways, accurately and timely identifying the presence of road spills and the types of spills can greatly improve the safety management of the road.
[0003] The existing mainstream identification method is to use an image-based object detection algorithm. The contour features of the spill are obtained through threshold segmentation, and then the specific type of the spill is identified based on the contour features. However, in the outdoor environment, affected by many factors related to the light intensity such as streetlight illumination, vehicle headlight illumination, and weather, there are often reflections or shadows on the target object or its surroundings in the image, resulting in difficulty in directly and accurately dividing the target object contour by threshold segmentation, leading to poor identification effects, and often cases of failed or incorrect spill identification. Summary of the Invention
[0004] The main purpose of this application is to provide a method, device, medium, and equipment for identifying road spills, aiming to solve the problem of poor identification effect of road spills in the prior art.
[0005] To achieve the above objective, the technical solutions adopted in the embodiments of this application are as follows:
[0006] In a first aspect, an embodiment of this application provides a method for identifying road spills, including the following steps:
[0007] Perform color-based adaptive grayscale conversion on the original image to obtain an image of the road to be identified;
[0008] Adjust the pixel values of the background area of the image of the road to be identified to an extreme value of the pixels on the image of the road to be identified, and update the image of the road to be identified to obtain a target identification image;
[0009] Perform threshold segmentation based on the target identification image to obtain a feature image;
[0010] Perform object matching based on the feature image. When the similarity of the matching is less than the similarity threshold, stepwise adjust the pixel values of the background region according to the selection of extreme values, and return the step of performing threshold segmentation on the target recognition image to obtain the feature image until the similarity of the matching is not less than the similarity threshold, so as to obtain the target spillage and complete the recognition.
[0011] In a possible implementation manner of the first aspect, perform color-based adaptive grayscale conversion on the original image to obtain the road image to be recognized, including:
[0012] Perform color recognition on the original image to obtain color distribution and intensity information;
[0013] Adjust the weights of the RGB three channels respectively according to the color distribution and intensity information for grayscale conversion to obtain the road image to be recognized.
[0014] In a possible implementation manner of the first aspect, before adjusting the pixel values of the background region of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, the method further includes:
[0015] Based on the position of the target spillage, mark the region to be recognized and the background region on the road image to be recognized.
[0016] In a possible implementation manner of the first aspect, based on the position of the target spillage, marking the region to be recognized and the background region on the road image to be recognized includes:
[0017] Based on the position of the target spillage, mark the first region to be recognized on the road image to be recognized;
[0018] Expand the contour of the first region to be recognized by the target pixel unit to obtain the region to be recognized;
[0019] Based on the region on the road image to be recognized other than the region to be recognized, obtain the background region.
[0020] In a possible implementation manner of the first aspect, after performing threshold segmentation on the target recognition image to obtain the feature image, the method further includes:
[0021] Subtract the feature image from the background image to obtain the target feature image; wherein, the background image is an image with the same size as the feature image, and the pixels of the background image are the same as the pixels of the background region.
[0022] In a possible implementation manner of the first aspect, according to the selection of extreme values, stepwise adjust the pixel values of the background region, including:
[0023] Based on the selection of the extreme value as the maximum value, the pixel values of the background area are adjusted step by step to decrease, or, based on the selection of the extreme value as the minimum value, the pixel values of the background area are adjusted step by step to increase.
[0024] In a possible implementation manner of the first aspect, before performing the target object matching based on the feature image, the method further includes:
[0025] Establish a target object recognition library; wherein, the target object recognition library contains a number of target objects and their feature information, and the feature information includes the feature information extracted from different directions for recognizing the target object;
[0026] Performing target object matching based on the feature image includes:
[0027] Based on the feature image, perform target object matching in the target object recognition library.
[0028] In a second aspect, an embodiment of the present application provides a road spillage recognition device, including:
[0029] A grayscale module, which is used to perform color-based adaptive grayscaling on the original image to obtain a road image to be recognized;
[0030] An adjustment module, which is used to adjust the pixel values of the background area of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, and update the road image to be recognized to obtain a target recognition image;
[0031] A segmentation module, which is used to perform threshold segmentation based on the target recognition image to obtain a feature image;
[0032] A recognition module, which is used to perform target object matching based on the feature image. When the similarity of the matching is less than the similarity threshold, according to the selection situation of the extreme value, step by step adjust the pixel values of the background area, and return to perform threshold segmentation based on the target recognition image to obtain a feature image until the similarity of the matching is not less than the similarity threshold, and obtain the target spillage to complete the recognition.
[0033] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, storing a computer program, which when loaded and executed by a processor, implements the road spillage recognition method provided in any one of the above first aspects.
[0034] In a fourth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein,
[0035] The memory is used to store a computer program;
[0036] The processor is used to load and execute the computer program so that the electronic device executes the road spillage recognition method provided in any one of the above first aspects.
[0037] Compared with the prior art, the beneficial effects of the present application are as follows:
[0038] A road spillage recognition method, device, medium and equipment proposed in an embodiment of the present application. The method includes: performing color-based adaptive grayscale conversion on an original image to obtain a road image to be recognized; adjusting pixel values of a background region of the road image to be recognized to an extreme value of pixels on the road image to be recognized, and updating the road image to be recognized to obtain a target recognition image; performing threshold segmentation based on the target recognition image to obtain a feature image; performing target object matching based on the feature image. When the similarity of the matching is less than a similarity threshold, according to the selection of the extreme value, stepwise adjust the pixel values of the background region, and return to the step of performing threshold segmentation based on the target recognition image to obtain a feature image until the similarity of the matching is not less than the similarity threshold, and obtain a target spillage to complete the recognition. First, the present application reduces the data dimension of the original image through grayscale conversion. Since the grayscale conversion method is a color-based adaptive method, it can retain the pixel distribution of the real image and is more in line with the visual perception of the human eye. Affected by the light intensity, the threshold segmentation cannot directly and accurately identify the contour features of the spillage. Therefore, an extreme value of a pixel on the grayscale image is selected and used as the pixel value of the background region to make the contrast with the recognition region where the spillage is located more obvious, so that the feature image obtained by the threshold segmentation can be used to represent where the spillage is located. Then, the feature image is used for target object matching recognition. If the similarity is low, it means that the real contour of the spillage has not been segmented yet. The pixel values of the background region can be stepwise adjusted and the threshold segmentation is performed again. In this way, a part of the region where the spillage is located can be divided into the background region. Repeating the above operations can gradually approximate the feature image to the real contour of the spillage until the feature image is sufficient to complete the target object matching recognition, realizing accurate and fast recognition of the spillage under the influence of light, and improving the effect of road spillage recognition. Description of the Drawings
[0039] Figure 1 It is a schematic structural diagram of an electronic device for the hardware operating environment involved in an embodiment of the present application;
[0040] Figure 2 It is a schematic flowchart of the road spillage recognition method provided by an embodiment of the present application;
[0041] Figure 3 It is a schematic module diagram of the road spillage recognition device provided by an embodiment of the present application;
[0042] Markings in the figure: 101 - Processor, 102 - Communication bus, 103 - Network interface, 104 - User interface, 105 - Memory. Detailed Embodiments
[0043] It should be understood that the specific embodiments described herein are merely for explaining the present application and are not used to limit the present application.
[0044] Referring to the attached Figure 1 , the attached Figure 1 is a schematic structural diagram of an electronic device for the hardware operating environment involved in the solution of the embodiment of the present application. The electronic device may include: a processor 101, such as a Central Processing Unit (CPU), a communication bus 102, a user interface 104, a network interface 103, and a memory 105. Among them, the communication bus 102 is used to realize the connection and communication between these components. The user interface 104 may include a display screen (Display) and an input unit such as a keyboard (Keyboard). Optionally, the user interface 104 may further include a standard wired interface and a wireless interface. The network interface 103 may optionally include a standard wired interface and a wireless interface (such as a Wireless-Fidelity (WI-FI) interface). The memory 105 may optionally be a storage device independent of the aforementioned processor 101. The memory 105 may be a high-speed Random Access Memory (RAM) memory or a stable non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory; the processor 101 may be a general-purpose processor, including a central processor, a network processor, etc., and may also be a digital signal processor, an application-specific integrated circuit, a field-programmable gate array, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0045] Those skilled in the art can understand that the structure shown in the attached Figure 1 does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0046] As shown in the attached Figure 1 , the memory 105, as a storage medium, may include an operating system, a network communication module, a user interface module, and a road spillage recognition device.
[0047] In the electronic device shown in the attached Figure 1 , the network interface 103 is mainly used for data communication with a network server; the user interface 104 is mainly used for data interaction with a user; the processor 101 and the memory 105 in the present application may be provided in the electronic device. The electronic device calls the road spillage recognition device stored in the memory 105 through the processor 101 and executes the road spillage recognition method provided in the embodiment of the present application.
[0048] Referring to the attached Figure 2, based on the hardware device of the foregoing embodiments, an embodiment of the present application provides a method for identifying road spills, including the following steps:
[0049] S10: Perform color-based adaptive grayscaling on the original image to obtain the road image to be recognized.
[0050] In the specific implementation process, the original image is a road image captured by a road monitoring camera, which can be a frame image segmented from a monitoring video, usually an image with color retained. In order to reduce the data dimension, the original image is grayscaled. Usually, grayscaling means setting the values of the RGB three channels to be equal, and this equal value is the grayscale value of the image. However, considering that the processed image not only needs to adapt to software processing but also needs to be presented to relevant personnel, color-based adaptive grayscaling is performed on it to improve the grayscaling effect. Specifically:
[0051] Performing color-based adaptive grayscaling on the original image to obtain the road image to be recognized includes:
[0052] Perform color recognition on the original image to obtain color distribution and intensity information;
[0053] According to the color distribution and intensity information, adjust the weights of the RGB three channels respectively for grayscaling to obtain the road image to be recognized.
[0054] In the specific implementation process, through weighted average based on color sensitivity, according to the distribution and intensity of different color components in the image, the weights of the RGB three components are dynamically adjusted to obtain a better grayscaling effect. This not only helps to improve the quality and applicability of the grayscale image, providing a better basis for subsequent image processing operations, but also can obtain a grayscale image that is more in line with the visual characteristics of the human eye. During the grayscaling process, the calculation of the grayscale value of the image is expressed as:
[0055] Grayscale value = wR×R + wG×G + wB×B
[0056] Where: wR, wG, and wB represent the weights of the red (R), green (G), and blue (B) channels respectively; R, G, and B represent the pixel values of the red, green, and blue channels respectively, and the value range is usually from 0 to 255. Further, the weights are adjusted according to the distribution and intensity of the color components. For example, assuming the initial state can be evenly distributed, wG = a*wG + b*wG, where a and b are adjustment coefficients based on distribution and intensity. In the initial state, a = b = 0.5. If the green component in the image accounts for a relatively large proportion and has a high intensity, then the weight of the green component can be appropriately increased. The specific operation is to amplify the values of a and b. For example, a = 0.55 and b = 0.6, and then the new weight is 1.15wG, so the weight of the green channel is amplified.
[0057] S20: Adjust the pixel values of the background region of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, and update the road image to be recognized to obtain a target recognition image.
[0058] In the specific implementation process, the segmentation of the spill actually separates the target from the background. Considering the influence of light irradiation, the spill itself or its vicinity usually shows reflection or shadow, making it difficult to specifically identify its boundary contour with the background. Therefore, in the embodiments of the present application, the background is considered to be processed to continuously optimize and obtain the contour. Considering the adaptive grayscale conversion based on color in the foregoing steps, the grayscale value of the image will vary according to different color representations on the original image. Therefore, starting from the extreme values of the pixels on the image, the recognition of the background region is continuously adjusted to gradually approach the true contour. And to cooperate with this asymptotic process, the pixel values of the background region can start from the extreme values, for example, gradually decrease from the maximum value or gradually increase from the minimum value.
[0059] For the initial road image to be recognized, it is necessary to determine the initial background region and the region of the spill, usually determined according to the spill on the image, that is: before adjusting the pixel values of the background region of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, the method further includes:
[0060] Based on the position of the target spill, mark the region to be recognized and the background region on the road image to be recognized. Specifically: Based on the position of the target spill, marking the region to be recognized and the background region on the road image to be recognized includes:
[0061] Based on the position of the target spill, mark the first region to be recognized on the road image to be recognized;
[0062] Expand the contour of the first region to be recognized by the target pixel unit to obtain the region to be recognized;
[0063] Based on the region on the road image to be recognized other than the region to be recognized, obtain the background region.
[0064] In the specific implementation process, the region to be recognized is the region where the spill is located. Expanding the contour of the spill is on the one hand to ensure that it can be completely extracted, making the size of the region to be recognized slightly larger than the real size, and on the other hand, due to the influence of shadow or reflection, the target range under visual detection usually becomes larger; the marking of the first region to be recognized can be manual annotation or machine annotation. Since the annotation does not directly recognize the true contour of the spill, the difficulty of this rough annotation is relatively low and it does not consume too many resources to implement.
[0065] S30: Perform threshold segmentation based on the target recognition image to obtain a feature image.
[0066] In the specific implementation process, threshold segmentation is a basic method in image processing, which divides an image into different regions or objects based on the gray level or color features of the image. Since only the spillage needs to be separated from the background in the embodiments of the present application, only one threshold needs to be selected for each threshold segmentation, and this threshold can be the pixel value of the background region, with the direct goal of separating the background to obtain the spillage. Since the marked background region in the foregoing steps is not the real background and there is also a background region in the marked region to be recognized, then this part of the region will be divided during threshold segmentation, resulting in a region with pixel values the same as the set threshold, and the region outside this part is the feature region, that is, the feature image representing the spillage.
[0067] The effect of threshold segmentation is affected by the selection of the threshold. An excellent threshold setting can more accurately and quickly segment the feature information. The entropy sum of the foreground and background is used to represent the threshold::
[0068] max H(T)=-∑[i=1,k]p i log2(p i )
[0069] where H(T) represents the entropy after image segmentation, p i represents the probability of the gray level appearance, k represents the number of gray levels. By traversing all possible thresholds T, the T value that maximizes the entropy sum H(T) of the foreground and background is found, which is the optimal threshold.
[0070] In one embodiment, after threshold segmentation is performed based on the target recognition image to obtain the feature image, the method further includes:
[0071] Subtracting the feature image from the background image to obtain the target feature image; where the background image is an image with the same size as the feature image, and the pixels of the background image are the same as the pixels of the background region.
[0072] In the specific implementation process, in order to improve the quality of the feature image and thus enhance the feature information of the spillage carried thereon, the feature image is subtracted from the background image to remove some background noise interference on the image and enhance the contrast. The pixels of the background image are set to be the same as the pixels of the background region. It can be considered that the background image is the image of the background region. The difference is that the size of the background image needs to be the same as the size of the feature image to facilitate directly performing the subtraction operation on the corresponding pixel points. The subtraction operation is implemented according to the following formula:
[0073] g(x,y)=f1(x,y)-f2(x,y)
[0074] Where g(x, y) represents the pixel value of the target feature image at the coordinate (x, y), f1(x, y) represents the pixel value of the feature image at the coordinate (x, y), and f2(x, y) represents the pixel value of the background image at the coordinate (x, y). The pixel value is usually non - negative, within the range of 0 - 255. To avoid negative values during the subtraction process, the absolute value of the result is taken or truncation processing is performed. It is also possible to assign values to negative values according to the pixel value distribution on the feature image. In short, the purpose is to ensure that the pixel value is within the valid range.
[0075] S40: Perform target object matching based on the feature image. When the similarity of the match is less than the similarity threshold, step - by - step adjust the pixel values of the background area according to the selection of extreme values, and return to the step of performing threshold segmentation on the target recognition image to obtain the feature image until the similarity of the match is not less than the similarity threshold, so as to complete the recognition of the target spill.
[0076] In the specific implementation process, after the feature image is segmented, target object matching is performed on it. The target object matching can be based on the target object recognition library, that is: before performing target object matching based on the feature image, the method further includes:
[0077] Establish a target object recognition library; where the target object recognition library contains several target objects and their feature information, and the feature information includes the feature information extracted from different directions for recognizing the target object;
[0078] Performing target object matching based on the feature image includes:
[0079] Based on the feature image, perform target object matching in the target object recognition library.
[0080] By establishing a target object recognition library, images of information about some common road spills are saved. Since many spills fall from vehicles or other places, they usually do not present a general state. For example, a cone - shaped barrel is usually placed vertically for use, but due to the influence of vehicle flow, it may be toppled on the road. Therefore, the target object recognition library can store the target object and its feature information under multi - direction recognition to ensure that the spill cannot be recognized due to a change in posture. Compared with the prior art that uses more complex algorithms to extract features, correct postures, and perform recognition and judgment, the present application directly realizes target object matching through the comparison of features and poses, which can save computing power.
[0081] The result of the matching verification is characterized by the similarity. The quantification of the similarity can be achieved by directly comparing image pixel values, feature matching algorithms, Euclidean distance, etc. For example, using a feature matching algorithm (such as nearest neighbor search) to find similar features in two images, and evaluating the similarity of the images by calculating the number or quality of the matching features, or adopting a hashing algorithm to convert the image into a hash value and evaluating the similarity of the images by comparing the similarity of the hash values.
[0082] Set a similarity threshold. If the similarity reaches the similarity threshold, it can be considered that the recognition of the spill is successful, and the specific category of the spill can be determined according to the matching object. If the similarity is less than the similarity threshold, it is considered that the matching is not successful, indicating that the true contour of the spill represented by the feature image obtained by threshold segmentation is not sufficient to meet the recognition requirements, and the influence on the image is still large, and further segmentation is required. Then, after stepping and adjusting the pixel values of the background area, threshold segmentation is performed again, which is equivalent to further expanding the background area to approach the true position of the spill. The step value of the adjustment can be set to several pixel units based on the actual situation, and the direction of the step adjustment is determined according to the selection of the extreme value. If the extreme value is selected as the maximum value, the step adjustment decreases; if the extreme value is selected as the minimum value, the step adjustment increases.
[0083] Of course, there may also be a special case where the information of the current category of spill may not be pre-set in the target object recognition library. For this situation, a loop count can be set. For example, if the step adjustment reaches 10 times and still does not meet the requirements of similarity matching, at this time, the contour is actually sufficient for recognition, but it cannot be recognized because there is no relevant object in the library. Then, it is determined as a new spill. At this time, manual intervention is used to identify the spill, and the information of the new spill is updated to the target object recognition library to continuously expand its recognition range.
[0084] In this embodiment, first, the data dimension of the original image is reduced through grayscale conversion. Since the grayscale conversion method is an adaptive method based on color, it can retain the pixel distribution of the real image and is more in line with the visual perception of the human eye. Affected by the light intensity, the threshold segmentation cannot directly and accurately identify the contour features of the spill. Therefore, a pixel extreme value on the grayscale-converted image is selected and used as the pixel value of the background area, making the contrast with the recognition area where the spill is located more obvious, so that the feature image obtained by threshold segmentation can be used to represent the location of the spill. Then, the target object matching recognition is performed on the feature image. If the similarity is low, it means that the real contour of the spill has not been segmented yet. The pixel value of the background area can be adjusted step by step, and the threshold segmentation is performed again. In this way, a part of the area where the spill is located can be divided into the background area. Repeating the above operations can gradually approximate the feature image to the real contour of the spill until the feature image is sufficient to complete the target object matching recognition, realizing the accurate and rapid recognition of the spill under the influence of light and improving the effect of road spill recognition.
[0085] Referring to the attached Figure 3 , based on the same inventive concept as in the foregoing embodiment, the embodiment of the present application further provides a road spill recognition device, including:
[0086] A grayscale module, which is used to perform adaptive grayscale conversion based on color on the original image to obtain a road image to be recognized;
[0087] An adjustment module, which is used to adjust the pixel value of the background area of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, and update the road image to be recognized to obtain a target recognition image;
[0088] A segmentation module, which is used to perform threshold segmentation based on the target recognition image to obtain a feature image;
[0089] A recognition module, which is used to perform target object matching based on the feature image. When the similarity of the matching is less than the similarity threshold, according to the selection situation of the extreme value, the pixel value of the background area is adjusted step by step, and the threshold segmentation is returned based on the target recognition image to obtain a feature image until the similarity of the matching is not less than the similarity threshold, and the target spill is obtained to complete the recognition.
[0090] Those skilled in the art should understand that the division of each module in the embodiments is only a division of logical functions. In actual applications, they can be fully or partially integrated into one or more actual carriers, and these modules can all be implemented in the form of software called by a processing unit, or all be implemented in the form of hardware, or be implemented in the form of a combination of software and hardware. It should be noted that each module in the road spillage recognition device in this embodiment corresponds one by one to each step in the road spillage recognition method in the foregoing embodiment. Therefore, the specific implementation manners of this embodiment can refer to the implementation manners of the foregoing road spillage recognition method, which will not be elaborated here.
[0091] Based on the same inventive concept as in the foregoing embodiment, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which when loaded and executed by a processor, implements the road spillage recognition method provided by the embodiment of the present application.
[0092] Based on the same inventive concept as in the foregoing embodiment, an embodiment of the present application further provides an electronic device, including a processor and a memory, wherein,
[0093] The memory is used to store a computer program;
[0094] The processor is used to load and execute the computer program so that the electronic device executes the road spillage recognition method provided by the embodiment of the present application.
[0095] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disc, or CD-ROM; or may be various devices including one or any combination of the foregoing memories. The computer may be various computing devices including intelligent terminals and servers.
[0096] In some embodiments, the executable instructions may be in the form of a program, software, software module, script, or code, and may be written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including being deployed as an independent program or being deployed as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0097] As an example, the executable instructions may or may not correspond to files in the file system, and may be stored as part of a file that stores other programs or data, for example, stored in one or more scripts in a Hyper Text Markup Language (HTML) document, stored in a single file dedicated to the program being discussed, or stored in multiple cooperating files (for example, files that store one or more modules, subroutines, or code portions).
[0098] As an example, the executable instructions may be deployed to execute on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed across multiple locations and interconnected by a communication network.
[0099] It should be noted that, in this document, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or system comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "comprising a..." does not exclude the presence of additional identical elements in the process, method, article or system comprising such element.
[0100] The serial numbers of the embodiments of the present application described above are for description purposes only and do not represent the superiority or inferiority of the embodiments.
[0101] From the description of the above embodiments, those skilled in the art can clearly understand that the above-described embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as a read-only memory / random access memory, magnetic disk, optical disk), and includes several instructions for causing a multimedia terminal device (which may be a mobile phone, a computer, a television receiver, or a network device, etc.) to execute the methods described in the various embodiments of the present application.
[0102] In summary, a method, device, medium, and equipment for road spillage recognition provided by the present application include: performing color-based adaptive grayscale conversion on an original image to obtain a road image to be recognized; adjusting the pixel values of the background region of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, and updating the road image to be recognized to obtain a target recognition image; performing threshold segmentation based on the target recognition image to obtain a feature image; performing target object matching based on the feature image. When the similarity of the matching is less than the similarity threshold, according to the selection of the extreme value, stepwise adjust the pixel values of the background region, and return to the step of performing threshold segmentation based on the target recognition image to obtain a feature image until the similarity of the matching is not less than the similarity threshold, and obtain the target spillage to complete the recognition. The present application first reduces the data dimension of the original image through grayscale conversion. Since the grayscale conversion method is a color-based adaptive method, it can retain the pixel distribution of the real image and is more in line with the visual perception of the human eye. Affected by the light intensity, the threshold segmentation cannot directly and accurately identify the contour features of the spillage. Therefore, an extreme value of a pixel on the grayscale image is selected and used as the pixel value of the background region to make the contrast with the recognition region where the spillage is located more obvious, so that the feature image obtained by the threshold segmentation can be used to represent the location of the spillage. Then, the feature image is used for target object matching recognition. If the similarity is low, it means that the real contour of the spillage has not been segmented yet. The pixel values of the background region can be stepwise adjusted and the threshold segmentation is performed again. In this way, a part of the region where the spillage is located can be divided into the background region. Repeating the above operations can gradually approximate the feature image to the real contour of the spillage until the feature image is sufficient to complete the target object matching recognition, realizing accurate and fast recognition of the spillage under the influence of light and improving the effect of road spillage recognition.
[0103] The foregoing are only the preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for identifying road spillage, characterized in that, Including the following steps: Perform color-based adaptive grayscale conversion on the original image to obtain a road image to be recognized; Adjust the pixel values of the background region of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, and update the road image to be recognized to obtain a target recognition image; Before adjusting the pixel values of the background region of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, the method further includes: Based on the position of the initial target spill, mark the region to be recognized and the background region on the road image to be recognized; The marking of the region to be recognized and the background region on the road image to be recognized based on the position of the initial target spill includes: Based on the position of the initial target spill, mark a first region to be recognized on the road image to be recognized; Expand the contour of the first region to be recognized by a target pixel unit to obtain the region to be recognized; Based on the region other than the region to be recognized on the road image to be recognized, obtain the background region; Perform threshold segmentation on the target recognition image to obtain a feature image; Based on the feature image, perform target object matching. When the matching similarity is less than the similarity threshold, stepwise adjust the pixel values of the background region according to the selection of the extreme value, and return to the step of performing threshold segmentation on the target recognition image to obtain a feature image until the matching similarity is not less than the similarity threshold to obtain the target spill and complete the recognition.
2. The road spillage recognition method according to claim 1, wherein The performing color-based adaptive grayscale conversion on the original image to obtain a road image to be recognized includes: Perform color recognition on the original image to obtain color distribution and intensity information; According to the color distribution and intensity information, adjust the weights of the RGB three channels respectively for grayscale conversion to obtain a road image to be recognized.
3. The road spillage recognition method according to claim 1, characterized in that After performing threshold segmentation on the target recognition image to obtain a feature image, the method further includes: Subtract the feature image from the background image to obtain a target feature image; wherein, the background image is an image with the same size as the feature image, and the pixels of the background image are the same as the pixels of the background region.
4. The road spillage identification method according to claim 1, wherein The stepwise adjustment of the pixel values of the background region according to the selection of the extreme value includes: According to the selection of the extreme value as the maximum value, stepwise adjust the pixel values of the background region to decrease, or, according to the selection of the extreme value as the minimum value, stepwise adjust the pixel values of the background region to increase.
5. The road spillage recognition method according to claim 1, characterized in that, Before performing target object matching based on the feature image, the method further includes: Establish a target object recognition library; wherein, the target object recognition library contains several target objects and their feature information, and the feature information includes the feature information extracted from recognizing the target object from different directions; The performing target object matching based on the feature image includes: Based on the feature image, perform target object matching in the target object recognition library.
6. A road spillage identification device, characterized in that, Including: A grayscale module for performing color-based adaptive grayscale conversion on the original image to obtain a road image to be recognized; An adjustment module, which is used to adjust the pixel values of the background area of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, and update the road image to be recognized to obtain a target recognition image; before adjusting the pixel values of the background area of the road image to be recognized to an extreme value of the pixels on the road image to be recognized, it further includes: Based on the position of the initial target spill, mark the area to be recognized and the background area on the road image to be recognized; The marking of the area to be recognized and the background area on the road image to be recognized based on the position of the initial target spill includes: Based on the position of the initial target spill, mark the first area to be recognized on the road image to be recognized; Expand the contour of the first area to be recognized by a target pixel unit to obtain the area to be recognized; Based on the area on the road image to be recognized other than the area to be recognized, obtain the background area; A segmentation module, which is used to perform threshold segmentation based on the target recognition image to obtain a feature image; An identification module, which is used to perform target object matching based on the feature image. When the matching similarity is less than the similarity threshold, stepwise adjust the pixel values of the background area according to the selection of the extreme value, and return to perform threshold segmentation based on the target recognition image to obtain a feature image until the matching similarity is not less than the similarity threshold, and obtain the target spill to complete the recognition.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is loaded and executed by a processor, it implements the road spill recognition method according to any one of claims 1-5.
8. An electronic device, characterized in that, Including a processor and a memory, wherein, The memory is used to store a computer program; The processor is used to load and execute the computer program so that the electronic device executes the road spill recognition method according to any one of claims 1-5.
Citation Information
Patent Citations
Highway thrown object detection method and device based on background model and tracking
CN116434160A
Computer-implemented method of detecting foreign object on background object in an image, apparatus for detecting foreign object on background object in an image, and computer-program product
US20210233245A1