Image analysis method, device, computer equipment and readable storage medium
By acquiring saturation channel images and analyzing the contour parameters after HSV image segmentation, the problem of insufficient recognition of non-working areas by intelligent devices is solved, thereby improving the working efficiency and security of the devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU CLEVA PRECISION MACHINERY & TECH CO LTD
- Filing Date
- 2022-07-19
- Publication Date
- 2026-07-14
AI Technical Summary
Existing image analysis technologies cannot effectively identify non-working areas, causing intelligent devices to misidentify non-lawn areas, reducing work efficiency and potentially damaging the equipment.
By acquiring saturation channel images, extracting contours and determining target parameter values, and combining HSV image segmentation and features from multiple channel images, the differences in contour parameters are analyzed to identify non-working areas.
This improves the accuracy of intelligent devices in identifying non-working areas, thereby enhancing work efficiency and security.
Smart Images

Figure CN117094935B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image analysis method, apparatus, computer device, and readable storage medium. Background Technology
[0002] With the development of technology, current intelligent devices can integrate image analysis technology to improve their intelligence and ease of use.
[0003] Taking intelligent lawnmowers as an example, they collect real-time images of the ground during operation, then analyze and process these images to identify grassy areas and non-grass areas (such as concrete), allowing them to accurately move to and clean the grassy areas. However, current image analysis technology is not yet perfect and often fails to effectively identify non-grass areas. This can cause the intelligent lawnmower to wander into non-grass areas, reducing its efficiency and even leading to collisions and damage.
[0004] Similarly, other intelligent devices with image acquisition and analysis capabilities may also encounter the problem of failing to effectively identify non-working areas when in operation. Summary of the Invention
[0005] Therefore, it is necessary to provide an image analysis method, an image analysis device, a computer device, and a computer-readable storage medium to address the above problems.
[0006] An image analysis method, comprising:
[0007] Obtain the saturation channel image from the original image;
[0008] Extract several contours from the saturation channel image;
[0009] Determine the target parameter values corresponding to each of the aforementioned contours;
[0010] Based on the analysis results of the target parameter values corresponding to each contour, it is determined whether there are non-working areas in the original image.
[0011] In one embodiment, the target parameter values include any combination of the following: contour width, contour height, number of pixels contained in the contour, percentage of effective pixel values, average saturation, average luminance roughness, average luminance value, average chrominance value, number of overly bright pixels, peak number of chrominance pixels, number of unexposed white pixels, and average chrominance roughness.
[0012] In one embodiment, the step of determining the target parameter values corresponding to each of the contours includes:
[0013] Convert the original image into an HSV image;
[0014] The target image is obtained by combining the chroma channel threshold, saturation channel threshold, and brightness channel threshold to perform color segmentation on the HSV image.
[0015] Obtain the amount of green pixels in the target image;
[0016] The percentage of effective pixel values is determined by combining the amount of green pixels in the target image and the amount of pixels contained in the contour.
[0017] In one embodiment, the image analysis method further includes the step of obtaining a brightness channel image based on the original image;
[0018] The step of determining the target parameter values corresponding to each contour includes:
[0019] The amount of overly bright pixels is determined based on the brightness channel image;
[0020] The brightness channel image is preprocessed, including filtering and normalization.
[0021] The brightness value is determined based on the preprocessed image, and the average brightness value is determined based on the brightness value and the number of pixels contained in the contour.
[0022] Edge extraction is performed on the preprocessed image to obtain an edge image;
[0023] The brightness roughness is determined based on the edge image, and the average brightness roughness is determined based on the brightness roughness and the number of pixels contained in the contour.
[0024] And / or,
[0025] The image analysis method further includes the step of obtaining a chroma channel image based on the original image;
[0026] The step of determining the target parameter values corresponding to each contour includes:
[0027] Chromaticity values are determined based on the chroma channel image, and the average chroma value is determined based on the chroma values and the number of pixels contained in the contour.
[0028] Obtain the histogram corresponding to the chroma channel image, and determine the peak value of the chroma pixel quantity based on the histogram;
[0029] The chroma channel image is preprocessed, and edge extraction is performed on the preprocessed image to obtain an edge image. The chroma roughness is determined based on the edge image, and the average chroma roughness is determined based on the chroma roughness and the number of pixels contained in the contour.
[0030] The amount of unexposed white pixels is determined by combining the lightness channel image and the chroma channel image.
[0031] In one embodiment, the step of extracting several contours from the saturation channel image includes:
[0032] Threshold segmentation is performed on the saturation channel image;
[0033] The first image is obtained by performing opening and closing operations on the image obtained after threshold segmentation.
[0034] The second image is obtained by performing the inverse operation on the first image;
[0035] Several first contours from the first image and several second contours from the second image are extracted respectively.
[0036] In one embodiment, the step of determining whether there are non-working regions in the original image based on the analysis results of the target parameter values corresponding to each of the contours includes:
[0037] If any target parameter value corresponding to the first contour satisfies the first preset condition, or if any target parameter value corresponding to the second contour satisfies the second preset condition, then it is determined that there is a non-working area in the original image.
[0038] In one embodiment, the first preset conditions include: the proportion of effective pixel values is less than a first preset proportion, the average brightness roughness is less than a first brightness roughness, the average brightness value is greater than a first preset brightness value, the number of pixels contained in the outline is within a preset range, the peak value of the chromaticity pixel count is greater than a first peak value, and the average chromaticity value is greater than a first preset chromaticity value.
[0039] The second preset conditions include: the number of overly bright pixels is greater than the number of first pixels, the number of unexposed white pixels is greater than the number of second pixels, the percentage of effective pixel values is less than the second preset percentage, the average brightness roughness is less than the second brightness roughness, and the average brightness value is less than the second preset brightness value.
[0040] In one embodiment, the step of determining whether there are non-working regions in the original image based on the analysis results of the target parameter values corresponding to each of the contours includes:
[0041] If the difference between any target parameter value corresponding to the first contour and any target parameter value corresponding to the second contour satisfies the third preset condition, then it is determined that there is a non-working area in the original image.
[0042] In one embodiment, the third preset condition includes:
[0043] The difference in average saturation between the first contour and the second contour is greater than a first difference value; the ratio of average chromatic roughness between the first contour and the second contour is less than a preset ratio value; the average brightness roughness of the first contour is less than a third brightness roughness value; the average brightness roughness of the second contour is less than a fourth brightness roughness value; the average brightness value of the first contour is greater than a third preset brightness value; the average brightness value of the second contour is less than a fourth preset brightness value; the effective pixel value ratio of the second contour is less than a third preset ratio; the peak value of the chromatic pixel quantity is greater than a second peak value; and the number of pixels contained in the contour of the second contour is greater than the number of pixels in the third contour.
[0044] Alternatively, the third preset condition includes:
[0045] The difference in average saturation between the first contour and the second contour is greater than the second difference; the absolute value of the difference in average brightness between the first contour and the second contour is less than the third difference; the average brightness roughness of the second contour is less than the fifth brightness roughness; the effective pixel value ratio of the second contour is less than the fourth preset ratio; and the number of pixels contained in the contour of the second contour is greater than the fourth pixel number.
[0046] Alternatively, the third preset condition includes:
[0047] The average chromaticity value of the first contour is less than the second preset chromaticity value, the average chromaticity value of the second contour is greater than the third preset chromaticity value, the effective pixel value ratio of the second contour is less than the fifth preset ratio, the average brightness roughness of the second contour is greater than the sixth brightness roughness, the average chromaticity roughness of the second contour is greater than the preset chromaticity roughness, the amount of overly bright pixels is greater than the fifth pixel amount, the average brightness value of the second contour is greater than the fifth preset brightness value, and the number of pixels contained in the contour of the second contour is greater than the sixth pixel amount.
[0048] An image analysis device, comprising:
[0049] The acquisition module is used to obtain the saturation channel image from the original image;
[0050] The extraction module is used to extract several contours from the saturation channel image;
[0051] The first determining module is used to determine the target parameter values corresponding to each of the contours;
[0052] The second determining module is used to determine whether there are non-working areas in the original image based on the analysis results of the target parameter values corresponding to each contour.
[0053] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the image analysis method described above.
[0054] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described image analysis method.
[0055] The aforementioned image analysis method, apparatus, computer equipment, and readable storage medium first acquire a saturation channel image from the original image, then extract several contours from the saturation channel image, determine the target parameter values corresponding to each contour, and finally analyze the target parameter values corresponding to each contour. Based on the analysis results, it is determined whether there are non-working regions in the original image. That is, the saturation channel image can be pre-segmented using the saturation difference characteristics of different types of ground regions. Then, combined with the characteristics or differences between working and non-working regions, further parameter analysis is performed on each segmented contour. This allows for the identification of non-working regions within each contour, effectively reducing the missed detection of non-working regions in the image, more accurately identifying non-working regions, and improving the working efficiency and security of intelligent equipment. Attached Figure Description
[0056] Figure 1 A flowchart illustrating an image analysis method provided in an embodiment of this application;
[0057] Figure 2 A flowchart of step S400 of an image analysis method provided in an embodiment of this application;
[0058] Figure 3 A flowchart illustrating an image analysis method provided in another embodiment of this application;
[0059] Figure 4 Here is a flowchart of a specific example of this application;
[0060] Figure 5 This is a schematic diagram of the images obtained in a specific example of this application;
[0061] Figure 6 A flowchart illustrating an image analysis method provided in yet another embodiment of this application;
[0062] Figure 7 A flowchart for another specific example of this application;
[0063] Figure 8 This is a schematic diagram of the images obtained in another specific example of this application;
[0064] Figure 9This is a schematic diagram of the structure of an image analysis device provided in an embodiment of this application;
[0065] Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0066] To facilitate understanding of this application, a more complete description will be provided below with reference to the accompanying drawings. Preferred embodiments of this application are shown in the drawings. However, this application can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the disclosure of this application.
[0067] In this application, unless otherwise expressly specified and limited, the terms "installation," "connection," "joining," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components, unless otherwise expressly limited. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0068] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0069] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the specification of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0070] As described in the background section, image analysis technology, as a key technology, is widely used in various smart devices. Taking a smart lawnmower as an example, it can collect and analyze ground image information in real time while moving, thereby identifying lawn areas and non-lawn areas (such as concrete or stone surfaces) to proceed to the lawn area to perform the mowing task.
[0071] However, current image analysis technology is not yet perfect and often fails to accurately identify non-lawn areas, misidentifying them as lawn areas. This causes intelligent lawnmowers to attempt cleaning in non-lawn areas, reducing their efficiency and potentially damaging themselves if obstacles are present. Similarly, other intelligent devices with image acquisition and analysis capabilities also face the problem of failing to effectively identify non-working areas.
[0072] Therefore, embodiments of this application provide an image analysis method, an image analysis device, a computer device, and a computer-readable storage medium to effectively identify non-working areas in an image and improve the working efficiency and security of intelligent devices.
[0073] In one embodiment, an image analysis method is provided that can be used to identify non-working areas from acquired images. In the following explanation, a lawnmower will be used as an example, where the working area is the lawn area and the non-working area is the non-lawn area.
[0074] Reference Figure 1 The image analysis method provided in this embodiment includes the following steps:
[0075] Step S200: Obtain the saturation channel image based on the original image.
[0076] Images are acquired using an acquisition device. When an image is acquired, it is obtained from the acquisition device. In this embodiment, the image is defined as the original image, which may include grass areas and non-grass areas. Images have various characteristics, such as saturation, chroma, and brightness. Each characteristic has a corresponding image channel. In this embodiment, the original image can be processed accordingly to obtain a saturation channel image for subsequent processing.
[0077] Step S400: Extract several contours from the saturation channel image.
[0078] After obtaining the saturation channel image, in order to more accurately identify whether there are non-grass areas in the image, the saturation channel image can be further processed. That is, by combining the saturation difference characteristics of different types of ground areas, the saturation channel image can be pre-segmented to extract several contours, so that subsequent screening analysis can be performed on whether there are non-grass areas in each contour.
[0079] Step S600: Determine the target parameter values corresponding to each contour.
[0080] After extracting each contour, the target parameter value for each contour can be determined one by one. The target parameter value can be a parameter value reflecting the presence of non-grass areas within the contour, such as the proportion of green pixels or brightness-related values. The target parameters can be determined according to actual needs, and their values can be obtained. The target parameters selected in this embodiment can be referred to in the subsequent detailed description. In this embodiment, the target parameter values for each contour can be determined by combining the luminance channel image and the chroma channel image, that is, by integrating the features of saturation, luminance, and chroma to determine the target parameter values for each contour. This makes the subsequent determination of non-grass areas based on the target parameter values more accurate.
[0081] Step S800: Based on the analysis results of the target parameter values corresponding to each contour, determine whether there are non-working areas in the original image.
[0082] After determining the target parameter values of each contour, these values can be analyzed to determine whether non-working areas exist in the image. There are various methods for analyzing the target parameter values of each contour. For example, the target parameter values of a single contour can be analyzed individually to determine if they conform to the characteristics of a non-grassland area. Alternatively, the differences between non-grassland and grassland areas can be analyzed to determine if the differences between the target parameter values of any two contours conform to the differences between grassland and non-grassland areas. Other analytical methods can also be used for the target parameter values of each contour. Any method that ultimately determines whether non-grassland areas exist in the image falls within the scope of this application's concept.
[0083] In practical applications, each extracted contour may contain non-grass areas. Therefore, as long as any contour contains a non-grass area, it can be considered that there is a non-grass area in the image, and the location of the non-grass area in the image can be determined so that the lawnmower can avoid the non-grass area during its movement.
[0084] The aforementioned image analysis method first obtains a saturation channel image from the original image, then extracts several contours from the saturation channel image, determines the target parameter values corresponding to each contour, and finally analyzes the target parameter values corresponding to each contour. Based on the analysis results, it determines whether there are non-working regions in the original image. That is, the saturation channel image can be pre-segmented using the saturation difference characteristics of different types of ground regions. Then, combined with the characteristics or differences between working and non-working regions, further parameter analysis is performed on each segmented contour. This allows for the identification of non-working regions within each contour, effectively reducing the missed detection of non-working regions in the image, more accurately identifying non-working regions, and improving the working efficiency and security of intelligent devices.
[0085] In this embodiment, the original image acquired by the acquisition device such as a camera is usually an RGB format image. In step S200, the RGB format image can be converted into an HSV format image (hereinafter referred to as HSV image) first, and then the HSV image can be segmented to obtain a saturation channel image.
[0086] HSV format is a color space that includes chroma (H), saturation (S), and lightness (V). Chroma (H) is measured in degrees, ranging from 0° to 180°. Saturation (S) represents how closely a color approximates a spectral color; the greater the proportion of spectral colors, the closer the color is to a spectral color, and the higher the saturation. Its value ranges from 0% to 100%. Lightness (V) represents the brightness of a color. For object colors, the lightness value V is related to the object's transmittance or reflectance, ranging from 0% to 100%, where 0% is black and 100% is white. In this embodiment, after segmenting the HSV image, saturation channel images, lightness channel images, and chroma channel images can be obtained simultaneously. In the current step, the saturation channel image is obtained.
[0087] Reference Figure 2 In one embodiment, step S400, namely the step of extracting several contours from the saturation channel image, includes:
[0088] Step S420: Threshold segmentation is performed on the saturation channel image.
[0089] In this embodiment, the saturation channel image can be segmented into foreground and background. Specifically, the Otsu thresholding method can be used for segmentation, or other algorithms that can achieve the same function can be used for threshold segmentation.
[0090] Before segmenting the saturation channel image, it can be preprocessed, including filtering and normalization.
[0091] Step S440: Perform opening and closing operations on the image obtained after threshold segmentation to obtain the first image.
[0092] Opening operations generally refer to smoothing the contours of an object, breaking narrow necks, and eliminating small protrusions. Closing operations also generally smooth the contours of an object, but they can bridge narrow gaps and long, thin grooves, eliminate small spaces, and fill breaks in the contour lines. In this embodiment, after performing opening and closing operations on the image obtained after threshold segmentation, the contours in the image can be smoothed, narrow necks can be broken, small protrusions can be eliminated, and narrow gaps and long, thin grooves can be bridged, small spaces can be eliminated, and breaks in the contour lines can be filled, resulting in a smoother first image, which facilitates better contour extraction in subsequent steps.
[0093] Step S460: Perform the inverse operation on the first image to obtain the second image.
[0094] After obtaining the first image, the first image can be inverted, that is, the pixels in the image are turned into inverted colors, and the inverted image is used as the second image for subsequent contour extraction from the second image.
[0095] Step S480: Extract several first contours from the first image and several second contours from the second image.
[0096] Once the first image and the second image are obtained, contour detection can be performed on the first image and the second image respectively, thereby extracting several first contours from the first image and several second contours from the second image.
[0097] Simultaneous analysis of the first and second image contours can further improve the comprehensiveness of subsequent recognition and reduce the omission of non-lawn areas.
[0098] In one embodiment, the target parameter values include any combination of the following: contour width, contour height, number of pixels contained in the contour, percentage of effective pixel values, average saturation, average luminance roughness, average luminance value, average chrominance value, number of overly bright pixels, peak number of chrominance pixels, number of unexposed white pixels, and average chrominance roughness.
[0099] In practical applications, any number of the above target parameters can be selected as the judgment parameters according to actual needs. Furthermore, the target parameters used may differ depending on the analysis method employed.
[0100] In one embodiment, step S600, which is the step of determining the target parameter values corresponding to each contour, includes:
[0101] Step S610a: Convert the original image into an HSV image.
[0102] Step S620a: Combine the chroma channel threshold, saturation channel threshold and brightness channel threshold to perform color segmentation on the HSV image to obtain the target image.
[0103] Step S630a: Obtain the amount of green pixels in the target image.
[0104] Step S640a: Combine the amount of green pixels in the target image with the amount of pixels contained in the outline to determine the proportion of effective pixel values.
[0105] The above process describes the specific steps for determining the proportion of effective pixel values. After obtaining the target image, the amount of green pixels can be acquired. In this embodiment, green pixels are considered effective pixels. By combining the amount of green pixels with the amount of pixels contained in each image contour, the proportion of effective pixel values in each image contour can be determined. Generally, when there are non-grass areas, the proportion of effective pixel values is relatively low. Therefore, the proportion of effective pixel values can be used as an important factor in determining whether non-grass areas exist.
[0106] In one embodiment, the image analysis method provided in this embodiment further includes the step of obtaining a brightness channel image based on the original image, wherein the acquisition of the brightness channel image can be performed simultaneously with the acquisition of the saturation channel image.
[0107] Step S600, which is the step of determining the target parameter values corresponding to each contour, includes:
[0108] Step S610b: Determine the amount of overly bright pixels based on the brightness channel image.
[0109] The brightness channel image is a grayscale image with a pixel value range of 0 to 255. In this embodiment, the case with a pixel value of 255 can be defined as overly bright. That is, the number of pixels with a pixel value of 255 is determined and used as the overly bright pixel quantity.
[0110] Step S620b: Preprocess the brightness channel image, including filtering and normalization. This reduces interference signals in the brightness channel image, thereby improving the accuracy of subsequent analysis processes.
[0111] Step S630b: Determine the brightness value based on the preprocessed image, and determine the average brightness value based on the brightness value and the number of pixels contained in the contour.
[0112] The preprocessed image is a grayscale image with pixel values ranging from 0 to 255. In this embodiment, the cumulative pixel value of each pixel in the image is used as the brightness value. The average brightness value of each contour is obtained by dividing the brightness value by the number of pixels contained in each contour.
[0113] Step S640b: Extract edges from the preprocessed image to obtain an edge image.
[0114] Edge extraction can be performed on the preprocessed image, specifically using the Canny edge detection operator, etc.
[0115] Step S650b: Determine the brightness roughness based on the edge image, and determine the average brightness roughness based on the brightness roughness and the number of pixels contained in the contour.
[0116] The edge image is a binary image, with pixel values that are either 0 or 255. The brightness roughness is the sum of the number of edge pixels. The average brightness roughness of each contour can be calculated by dividing the brightness roughness by the number of pixels contained in each contour.
[0117] In summary, by combining the features of the brightness channel image and the features of each contour, the relevant target parameter values such as the amount of overly bright pixels, average brightness roughness, and average brightness value of each contour can be determined.
[0118] In one embodiment, the image analysis method provided in this embodiment further includes the step of obtaining a chroma channel image based on the original image, wherein the acquisition of the chroma channel image can be performed simultaneously with the acquisition of the saturation channel image.
[0119] Step S600, which is the step of determining the target parameter values corresponding to each contour, further includes:
[0120] Step S610c: Determine the chromaticity value based on the chromaticity channel image, and determine the average chromaticity value based on the chromaticity value and the number of pixels contained in the contour.
[0121] The chroma channel image is a grayscale image with pixel values ranging from 0 to 180. In this embodiment, pixel values less than 165 can be filtered out, and the sum of all pixel values less than 165 can be used as the chroma value. The average chroma value of each contour can be calculated by dividing the chroma value by the number of pixels contained in each contour.
[0122] Step S620c: Obtain the histogram corresponding to the chroma channel image, and determine the peak value of the chroma pixel quantity based on the histogram.
[0123] Once the chroma channel image is obtained, its corresponding histogram can be calculated, namely the chroma histogram. The horizontal axis of the chroma histogram represents the chroma distribution range, and the vertical axis represents the number of pixels contained in each chroma, i.e., the pixel count. The maximum pixel count, i.e., the peak chroma pixel count, can be determined through the chroma histogram.
[0124] Step S630c: Preprocess the chroma channel image, extract the edge image from the preprocessed image to obtain the edge image, determine the chroma roughness based on the edge image, and determine the average chroma roughness based on the chroma roughness and the number of pixels contained in the contour.
[0125] The preprocessing includes filtering and normalization. Edge extraction can be performed using the Canny edge detection operator. The edge image is a binary image with pixel values that are either 0 or 255. The chromatic roughness is the sum of the number of edge pixels, and the average chromatic roughness of each contour can be calculated by dividing the chromatic roughness by the number of pixels contained in each contour.
[0126] Step S640c: Combine the lightness channel image and the chroma channel image to determine the amount of unexposed white pixels.
[0127] Both the luminance channel image and the chroma channel image are grayscale images, and the pixel values range from 0 to 255. The cumulative number of pixels that simultaneously satisfy the condition that the pixel value in the luminance channel image is not equal to 255 and the pixel value in the chroma channel image is equal to 0 can be used as the amount of unexposed white pixels.
[0128] In addition, saturation can be determined based on the preprocessed saturation channel image, and then the average saturation of each contour can be determined by combining the saturation and the number of pixels contained in each contour. Specifically, the average saturation of each contour can be obtained by dividing the saturation by the number of pixels contained in each contour.
[0129] In summary, by combining the features of the chroma channel image, the luminance channel image, the saturation channel image, and the features of each contour, the relevant target parameter values of each contour can be determined.
[0130] Reference Figure 3 In one embodiment, step S800, which is to determine whether there are non-working regions in the original image based on the analysis results of the target parameter values corresponding to each contour, includes:
[0131] Step S810: If the target parameter value corresponding to any first contour satisfies the first preset condition, or the target parameter value corresponding to any second contour satisfies the second preset condition, then it is determined that there is a non-working area in the original image.
[0132] Since the first contour is obtained from the first image, and the second contour is obtained from the second image (which is the inversion of the first image), the image features of the first and second contours are different. Based on this, in this embodiment, a first preset condition is set for the first contour, and a second preset condition is set for the second contour. The first preset condition is a determination condition indicating the presence of a non-grass region in the first contour, and the second preset condition is a determination condition indicating the presence of a non-grass region in the second contour. If the target parameter value corresponding to the first contour satisfies the first preset condition, it indicates that a non-grass region exists in the current first contour; if the target parameter value corresponding to the second contour satisfies the second preset condition, it indicates that a non-grass region exists in the current second contour. Regardless of which contour is used to identify the non-grass region, it can be determined that a non-grass region exists in the image.
[0133] In one embodiment, the first preset conditions include: the proportion of effective pixel values is less than a first preset proportion, the average brightness roughness is less than a first brightness roughness, the average brightness value is greater than a first preset brightness value, the number of pixels contained in the outline is within a preset range, the peak value of the chromaticity pixel count is greater than a first peak value, and the average chromaticity value is greater than a first preset chromaticity value.
[0134] The second preset conditions include: the number of overly bright pixels is greater than the number of first pixels, the number of unexposed white pixels is greater than the number of second pixels, the percentage of effective pixel values is less than the second preset percentage, the average brightness roughness is less than the second brightness roughness, and the average brightness value is less than the second preset brightness value.
[0135] Using a large number of collected images as the basis for data analysis, image features of contours containing non-lawn areas can be obtained, such as a low percentage of effective pixels and low average brightness roughness. Based on this, the characteristics (i.e., preset conditions) for the two types of contours can be summarized. If any contour meets its corresponding characteristics, it can be considered that a non-lawn area exists in the original image. The above preset conditions are set quite accurately, which helps intelligent lawnmowers effectively identify and avoid non-lawn areas.
[0136] In one embodiment, the first preset condition includes a first preset percentage of 0.7, a first preset roughness of 0.24, a first preset brightness value of 60, a preset range of 1100 to 13000, a first peak value of 800, and a first preset chromaticity value of 60.
[0137] In the second preset conditions, the first pixel quantity includes 200, the second pixel quantity includes 10, the second preset ratio includes 0.49, the second brightness roughness includes 0.26, and the second preset brightness value includes 245.
[0138] That is, in a specific example, the first preset condition is: the effective pixel value ratio is less than 0.7, the average brightness roughness is less than 0.24, the average brightness value is greater than 60, the number of pixels contained in the outline is within 1100 to 13000, the peak value of the chromaticity pixel number is greater than 800, and the average chromaticity value is greater than 60.
[0139] The second preset conditions are: the number of overly bright pixels is greater than 200, the number of unexposed white pixels is greater than 10, the effective pixel value ratio is less than 0.49, the average brightness roughness is less than 0.26, and the average brightness value is less than 245.
[0140] Of course, the selection of the above thresholds is not unique and can be determined according to the actual situation, as long as the above preset conditions meet the characteristics of the non-lawn area in the outline.
[0141] Additionally, it should be noted that both the first and second preset conditions include limitations on the contour width or contour height. That is, before determining whether the aforementioned target parameters meet the conditions, it is first determined whether the contour width or contour height meets a certain standard. If it does, the analysis of other target parameters can proceed; otherwise, the image contour can be ignored. For example, if a contour's width is greater than 85 or its height is greater than 70, the contour is considered valid and can be analyzed further. If the contour width does not reach 85 and the contour height does not reach 70, the contour is considered invalid and is ignored.
[0142] The following is combined Figure 4 and Figure 5 The image analysis method provided in this embodiment will be illustrated with a specific example:
[0143] First, obtain the original image orgMat, convert it to an HSV image hsvMat, and then segment it into saturation channel image sMat, chroma channel image hMat, and brightness channel image vMat (refer to...). Figure 5 (a) and (b)).
[0144] Color segmentation of the HSV image is performed using chroma channel thresholding, lightness channel thresholding, and saturation channel thresholding to obtain the target image prevObstacleMat (refer to...). Figure 5 (b)
[0145] Reference Figure 5 In (a) and (c), the saturation channel image sMat is filtered and normalized to obtain the image normSMat. The image normSMat is segmented using the Otsu thresholding method to obtain the image otsuSMat. The image otsuSMat is opened and closed to obtain the image unObstSMat. The image unObstSMat is inversely operated to obtain the image obstSMat. Contour detection is performed on the images unObstSMat and obstSMat to extract the corresponding first and second contours, respectively. The width boundRect.width, height boundRect.height, and number of pixels pxN of each image contour are then calculated.
[0146] The number of pixels with a value of 255 in the brightness channel image vMat is counted, which is the overbright pixel count.
[0147] Reference Figure 5In (b), the brightness channel image vMat is filtered and normalized to obtain the image normVMat. The brightness value bright is obtained from the image normVMat and then divided by the number of pixels pxN in each contour to calculate the average brightness value avgBright of each contour.
[0148] Reference Figure 5 In (b), the Canny operator is used to extract the edges of the image normVMat to obtain the edge image cannyVMat. The brightness roughness canV is obtained from the edge image cannyVMat, and then divided by the number of pixels pxN contained in each contour to calculate the average brightness roughness avgCanV of each contour.
[0149] The histogram corresponding to the chroma channel image is obtained, and the peak value of the chroma pixel quantity maxColor is determined. At the same time, the pixel values less than 165 are accumulated to obtain the chroma value hValue. Then, the average chroma value avgHValue of each contour is calculated by dividing by the number of pixels pxN contained in each contour.
[0150] The number of pixels that simultaneously satisfy the condition that the pixel value in the luminance channel image is not equal to 255 and the pixel value in the chroma channel image is equal to 0 is accumulated to obtain the amount of unexposed white pixels, labels0.
[0151] The amount of green pixels vldpxN is determined based on the target image prevObstacleMat, and then divided by the amount of pixels pxN contained in each contour to calculate the effective pixel value ratio avgVldpxN of each contour.
[0152] In this example, for the first contour extracted from the image unObstSMat, the first preset condition is: the effective pixel value ratio avgVldpxN < 0.7, the average brightness roughness avgCanV < 0.24, the average brightness value avgBright > 60, and 1100 < the number of pixels boundRect.pxN. <13000 and peak colorimetric pixel count maxColor> 800 and the average chromaticity value avgHValue>60.
[0153] For the second contour extracted from the image obstSMat, the second preset conditions are: the number of overbright pixels overbrightPix>200, the number of unexposed white pixels labels0>10, the percentage of effective pixel values avgVldpxN<0.49, the average brightness roughness avgCanV<0.26, and the average brightness value avgBright<245.
[0154] At the same time, the first and second contours also need to satisfy the following conditions: contour width boundRect.width > 85 or contour height boundRect.height > 70.
[0155] Reference Figure 5 In section (c), the analysis results are as follows: there are 3 first contours and 12 second contours. Among them, the 6th second contour satisfies the second preset condition, and the target parameter value corresponding to the 6th second contour is:
[0156] Contour height boundRect.height = 85 > 70; contour width boundRect.width = 160 > 85; overbright pixels = 5137 > 200; unexposed white pixels labels0 = 40 > 10 and effective pixel value percentage avgVldpxN = 0.296 < 0.49 and average brightness roughness avgCanV = 0.129 < 0.26 and average brightness value avgBright = 206.2 < 245.
[0157] Therefore, it can be assumed that there are non-grass areas in the sixth second contour, and that there are non-grass areas in the currently acquired original image.
[0158] Reference Figure 6 In one embodiment, step S800, which is to determine whether there are non-working regions in the original image based on the analysis results of the target parameter values corresponding to each contour, includes:
[0159] Step S810': If the difference between the target parameter value corresponding to any first contour and the target parameter value corresponding to any second contour satisfies the third preset condition, then it is determined that there is a non-working area in the original image.
[0160] Since the contours are divided based on differences in saturation, if non-grass areas exist in the image, the contours have already preliminarily distinguished the grass from the non-grass areas. Based on this, the differences between the contours are used to further identify non-grass areas. If a non-grass area exists, the difference between the target parameter values of the contour containing the non-grass area and the target parameter values of other contours containing only grass areas theoretically follows a certain pattern. In this embodiment, preset conditions can be set in advance based on this difference pattern. If, when comparing the target parameter values of each contour, the difference between the target parameter values of two different contours meets the preset conditions, then it can be determined that a non-grass area exists in one of the contours.
[0161] In practical applications, each contour can be compared in pairs. If the difference between the target parameter values of two contours meets the preset conditions, it can be determined that one of the two contours contains a non-lawn area. Furthermore, the approximate location of the non-lawn area in the original image can be determined, which helps to control the lawnmower to avoid working in the non-lawn area.
[0162] Using a large number of collected images as the basis for data analysis, image features of contours with and without non-lawn areas can be obtained, along with the differences between the two. In this embodiment, preset conditions can be determined in advance based on the obtained image features and differences, serving as a reference for the presence of non-lawn areas in actual application scenarios.
[0163] In one embodiment, the third preset condition includes:
[0164] The difference in average saturation between the first contour and the second contour is greater than the first difference value; the ratio of average chromatic roughness between the first contour and the second contour is less than the preset ratio value; the average luminance roughness of the first contour is less than the third luminance roughness value; the average luminance roughness of the second contour is less than the fourth luminance roughness value; the average luminance value of the first contour is greater than the third preset luminance value; the average luminance value of the second contour is less than the fourth preset luminance value; the proportion of effective pixel values in the second contour is less than the third preset proportion; the peak value of chromatic pixel quantity is greater than the second peak value; and the number of pixels contained in the contour of the second contour is greater than the number of pixels in the third contour.
[0165] The first difference can include 60, the preset ratio can include 0.32, the third brightness roughness can include 0.2, the fourth brightness roughness can include 0.24, the third preset brightness value can include 40, the fourth preset brightness value can include 245, the third preset percentage can include 0.8, the second peak value can include 830, and the third pixel count can include 2500.
[0166] In an alternative embodiment, the third preset condition includes:
[0167] The difference in average saturation between the first contour and the second contour is greater than the second difference; the absolute value of the difference in average brightness between the first contour and the second contour is less than the third difference; the average brightness roughness of the second contour is less than the fifth brightness roughness; the proportion of effective pixel values in the second contour is less than the fourth preset proportion; and the number of pixels contained in the second contour is greater than the number of pixels in the fourth contour.
[0168] The second difference can include 90, the third difference can include 30, the fifth brightness roughness can include 0.27, the fourth preset ratio can include 0.78, and the fourth pixel quantity can include 2500.
[0169] In another alternative embodiment, the third preset condition includes:
[0170] The average chromaticity value of the first contour is less than the second preset chromaticity value, the average chromaticity value of the second contour is greater than the third preset chromaticity value, the effective pixel value ratio of the second contour is less than the fifth preset ratio, the average brightness roughness of the second contour is greater than the sixth brightness roughness, the average chromaticity roughness of the second contour is greater than the preset chromaticity roughness, the number of overly bright pixels is greater than the fifth pixel number, the average brightness value of the second contour is greater than the fifth preset brightness value, and the number of pixels contained in the contour of the second contour is greater than the sixth pixel number.
[0171] The second preset chromaticity value may include 80, the third preset chromaticity value may include 52, the fifth preset percentage may include 0.38, the sixth luminance roughness may include 0.265, the preset chromaticity roughness may include 0.2, the fifth pixel quantity may include 190, the fifth preset luminance value may include 110, and the sixth pixel quantity may include 3000.
[0172] The above lists three sets of third preset conditions. In actual comparison, as long as any one of the above preset conditions is met, it can be considered that there is a non-turf.
[0173] Of course, the selection of the above thresholds is not unique and can be determined according to the actual situation, as long as the above preset conditions are conducive to the identification of non-lawn areas.
[0174] The following is combined Figure 7 and 8 The image analysis method provided in this embodiment will be illustrated with a specific example:
[0175] First, obtain the original image orgMat, convert it to an HSV image hsvMat, and then segment it into a saturation channel image sMat, a chroma channel image hMat, and a brightness channel image vMat.
[0176] The target image, prevObstacleMat, is obtained by color segmentation of the HSV image using chroma channel thresholding, lightness channel thresholding, and saturation channel thresholding.
[0177] The saturation channel image sMat is filtered and normalized to obtain the image normSMat. The normSMat image is then segmented using the Otsu thresholding method to obtain the image otsuSMat. The otsuSMat image is then opened and closed to obtain the image unObstSMat. The unObstSMat image is then inverted to obtain the image obstSMat. Contour detection is performed on the unObstSMat and obstSMat images to extract the corresponding first and second contours, respectively. The width boundRect.width, height boundRect.height, and number of pixels pxN of each image contour are then calculated.
[0178] The number of pixels with a value of 255 in the brightness channel image vMat is counted, which is the overbright pixel count.
[0179] The brightness channel image vMat is filtered and normalized to obtain the image normVMat. The brightness value bright is obtained from the image normVMat and then divided by the number of pixels pxN in each contour to calculate the average brightness value avgBright of each contour.
[0180] The Canny operator is used to extract the edges of the image normVMat to obtain the edge image cannyVMat. The brightness roughness canV is obtained from the edge image cannyVMat. Then, it is divided by the number of pixels pxN of each contour to calculate the average brightness roughness avgCanV of each contour.
[0181] The histogram corresponding to the chroma channel image is obtained, and the peak value of the chroma pixel quantity maxColor is determined. At the same time, the pixel values less than 165 are accumulated to obtain the chroma value hValue. Then, the average chroma value avgHValue of each contour is calculated by dividing by the number of pixels pxN contained in each contour.
[0182] After filtering and normalizing the chroma channel image, the image normHMat is obtained. The Canny operator is used to extract the edges of the image normHMat to obtain the edge image cannyHMat. The chroma roughness canH is obtained from the edge image cannyHMat. Then, it is divided by the number of pixels pxN contained in each contour to calculate the average chroma roughness avgCanH of each contour.
[0183] The amount of green pixels vldpxN is determined based on the target image prevObstacleMat, and then divided by the amount of pixels pxN contained in each contour to calculate the effective pixel value ratio avgVldpxN of each contour.
[0184] The saturation sat is obtained from the image normSMat, and then divided by the number of pixels pxN in each contour to calculate the average saturation avgSat of each contour.
[0185] In this example, the third preset condition includes any one of the following three groups:
[0186] A. The difference in average saturation between the first and second contours is greater than 60, the ratio of average chromatic roughness between the first and second contours is less than 0.32, the average luminance roughness of the first contour is less than 0.2, the average luminance roughness of the second contour is less than 0.24, the average luminance value of the first contour is greater than 40, the average luminance value of the second contour is less than 245, the effective pixel value ratio of the second contour is less than 0.8, the peak value of chromatic pixel quantity is greater than 830, and the number of pixels contained in the contour of the second contour is greater than 2500.
[0187] B. The difference in average saturation between the first contour and the second contour is greater than 90, the absolute value of the difference in average brightness between the first contour and the second contour is less than 30, the average brightness roughness of the second contour is less than 0.27, the effective pixel value ratio of the second contour is less than 0.78, and the number of pixels contained in the second contour is greater than 2500.
[0188] C. The average chromaticity value of the first contour is less than 80, the average chromaticity value of the second contour is greater than 52, the effective pixel value ratio of the second contour is less than 0.38, the average luminance roughness of the second contour is greater than 0.265, the average chromaticity roughness of the second contour is greater than 0.2, the number of overly bright pixels is greater than 190, the average luminance value of the second contour is greater than 110, and the number of pixels contained in the contour of the second contour is greater than 3000.
[0189] Reference Figure 8 The analysis results show that there are 4 first contours and 7 second contours. Among them:
[0190] Regarding the first outline:
[0191] The average saturation value avgSat = 193, and the average brightness value avgBright = 153.10.
[0192] Regarding the 7th second outline:
[0193] Average saturation avgSat = 91, average brightness avgBright = 160.18, average brightness roughness avgCanV = 0.255, effective pixel percentage avgVldpxN = 0.774, and number of pixels contained in the outline boundRect.pxN = 4030.
[0194] Analysis reveals that the image features of the first contour and the seventh contour, as well as their differences, satisfy condition B above, indicating that there is a non-grassland area in the currently acquired original image.
[0195] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0196] Based on the same inventive concept, another embodiment of this application provides an image analysis apparatus for implementing the image analysis method described above. The solution provided by this image analysis apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more image analysis apparatus embodiments provided below can be found in the limitations of the image analysis method described above, and will not be repeated here.
[0197] Reference Figure 9 The image analysis device provided in this embodiment includes an acquisition module 200, an extraction module 400, a first determination module 600, and a second determination module 800. Wherein:
[0198] The acquisition module 200 is used to acquire the saturation channel image based on the original image;
[0199] Extraction module 400 is used to extract several contours from the saturation channel image;
[0200] The first determining module 600 is used to determine the target parameter values corresponding to each contour;
[0201] The second determining module 800 is used to determine whether there are non-working areas in the original image based on the analysis results of the target parameter values corresponding to each contour.
[0202] The image analysis device provided in this embodiment first acquires a saturation channel image from the original image, then extracts several contours from the saturation channel image, determines the target parameter values corresponding to each contour, and finally analyzes the target parameter values corresponding to each contour. Based on the analysis results, it determines whether there are non-working areas in the original image. That is, the saturation channel image can be pre-segmented using the saturation difference characteristics of different types of ground regions. Then, combined with the characteristics or differences between working and non-working areas, further parameter analysis is performed on each segmented contour. This allows for the identification of non-working areas in each contour, effectively reducing the missed detection of non-working areas in the image, more accurately identifying non-working areas in the image, and improving the working efficiency and security of intelligent devices.
[0203] In one embodiment, the target parameter values include any combination of the following: contour width, contour height, number of pixels contained in the contour, percentage of effective pixel values, average saturation, average luminance roughness, average luminance value, average chrominance value, number of overly bright pixels, peak number of chrominance pixels, number of unexposed white pixels, and average chrominance roughness.
[0204] In one embodiment, the first determining module 600 is used to:
[0205] Convert the original image to an HSV image;
[0206] The target image is obtained by combining the chroma channel threshold, saturation channel threshold, and brightness channel threshold to perform color segmentation on the HSV image;
[0207] Obtain the amount of green pixels in the target image;
[0208] The percentage of effective pixel values is determined by combining the amount of green pixels in the target image and the amount of pixels contained in the outline.
[0209] In one embodiment, the acquisition module 200 can also be used to acquire a brightness channel image based on the original image; the first determination module 600 is used to:
[0210] Determine the amount of overly bright pixels based on the brightness channel image;
[0211] The brightness channel image is preprocessed, including filtering and normalization.
[0212] The brightness value is determined based on the preprocessed image, and the average brightness value is determined based on the brightness value and the number of pixels contained in the contour.
[0213] Edge extraction is performed on the preprocessed image to obtain an edge image;
[0214] The brightness roughness is determined based on the edge image, and the average brightness roughness is determined based on the brightness roughness and the number of pixels contained in the contour.
[0215] In one embodiment, the acquisition module 200 can also be used to acquire a chroma channel image based on the original image; the first determination module 600 is used to:
[0216] Chromaticity values are determined based on the chroma channel image, and the average chroma value is determined based on the chroma values and the number of pixels contained in the contour.
[0217] Obtain the histogram corresponding to the chroma channel image, and determine the peak value of the chroma pixel quantity based on the histogram;
[0218] The chroma channel image is preprocessed, and edge extraction is performed on the preprocessed image to obtain the edge image. The chroma roughness is determined based on the edge image, and the average chroma roughness is determined based on the chroma roughness and the number of pixels contained in the contour.
[0219] By combining the luminance channel image and the chroma channel image, the amount of unexposed white pixels is determined.
[0220] In one embodiment, the extraction module 400 is used for:
[0221] Thresholding segmentation is performed on the saturation channel image;
[0222] The first image is obtained by performing opening and closing operations on the image obtained after threshold segmentation.
[0223] The second image is obtained by performing the inverse operation on the first image;
[0224] Several first contours from the first image and several second contours from the second image are extracted respectively.
[0225] In one embodiment, the second determining module 800 is used to: determine that there is a non-working area in the original image if the target parameter value corresponding to any first contour satisfies a first preset condition, or if the target parameter value corresponding to any second contour satisfies a second preset condition.
[0226] In one embodiment, the first preset conditions include: the proportion of effective pixel values is less than a first preset proportion, the average brightness roughness is less than a first brightness roughness, the average brightness value is greater than a first preset brightness value, the number of pixels contained in the outline is within a preset range, the peak value of the chromaticity pixel count is greater than a first peak value, and the average chromaticity value is greater than a first preset chromaticity value.
[0227] The second preset conditions include: the number of overly bright pixels is greater than the number of first pixels, the number of unexposed white pixels is greater than the number of second pixels, the percentage of effective pixel values is less than the second preset percentage, the average brightness roughness is less than the second brightness roughness, and the average brightness value is less than the second preset brightness value.
[0228] In one embodiment, the second determining module 800 is used to: determine that there is a non-working area in the original image if the difference between the target parameter value corresponding to any first contour and the target parameter value corresponding to any second contour satisfies a third preset condition.
[0229] In one embodiment, the third preset condition includes:
[0230] The difference in average saturation between the first contour and the second contour is greater than the first difference value; the ratio of average chromatic roughness between the first contour and the second contour is less than the preset ratio value; the average luminance roughness of the first contour is less than the third luminance roughness value; the average luminance roughness of the second contour is less than the fourth luminance roughness value; the average luminance value of the first contour is greater than the third preset luminance value; the average luminance value of the second contour is less than the fourth preset luminance value; the effective pixel value ratio of the second contour is less than the third preset ratio; the peak value of chromatic pixel quantity is greater than the second peak value; and the number of pixels contained in the contour of the second contour is greater than the number of pixels in the third contour.
[0231] Alternatively, the third preset condition includes:
[0232] The difference in average saturation between the first contour and the second contour is greater than the second difference; the absolute value of the difference in average brightness between the first contour and the second contour is less than the third difference; the average brightness roughness of the second contour is less than the fifth brightness roughness; the effective pixel value ratio of the second contour is less than the fourth preset ratio; and the number of pixels contained in the contour of the second contour is greater than the number of pixels in the fourth contour.
[0233] Alternatively, the third preset condition includes:
[0234] The average chromaticity value of the first contour is less than the second preset chromaticity value, the average chromaticity value of the second contour is greater than the third preset chromaticity value, the effective pixel value ratio of the second contour is less than the fifth preset ratio, the average brightness roughness of the second contour is greater than the sixth brightness roughness, the average chromaticity roughness of the second contour is greater than the preset chromaticity roughness, the number of overly bright pixels is greater than the fifth pixel number, the average brightness value of the second contour is greater than the fifth preset brightness value, and the number of pixels contained in the contour of the second contour is greater than the sixth pixel number.
[0235] Each module in the aforementioned image analysis device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0236] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps in the above method embodiments.
[0237] Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device may be a server, and its internal structure diagram may be as follows: Figure 10 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores various types of data related to the image analysis method. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements an image analysis method.
[0238] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0239] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0240] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0241] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0242] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. An image analysis method, characterized in that, include: Obtain the saturation channel image, brightness channel image, and chroma channel image from the original image; Extracting several contours from the saturation channel image includes: performing threshold segmentation on the saturation channel image; performing opening and closing operations on the image obtained after threshold segmentation to obtain a first image; performing the inverse operation on the first image to obtain a second image; and extracting several first contours from the first image and several second contours from the second image. Determine the target parameter values corresponding to each of the contours; the target parameter values include any combination of contour width, contour height, number of pixels contained in the contour, percentage of effective pixel values, average saturation, average luminance roughness, average luminance value, average chrominance value, number of overly bright pixels corresponding to the luminance channel image, peak number of chrominance pixels corresponding to the chrominance channel image, number of unexposed white pixels, and average chrominance roughness. Based on the analysis results of the target parameter values corresponding to each of the contours, it is determined whether there is a non-working region in the original image; this includes: if the difference between any target parameter value corresponding to any of the first contours and any target parameter value corresponding to any of the second contours satisfies a third preset condition, then it is determined that there is a non-working region in the original image; the third preset condition includes: The difference in average saturation between the first contour and the second contour is greater than a first difference value; the ratio of average chromatic roughness between the first contour and the second contour is less than a preset ratio value; the average luminance roughness of the first contour is less than a third luminance roughness value; the average luminance roughness of the second contour is less than a fourth luminance roughness value; the average luminance value of the first contour is greater than a third preset luminance value; the average luminance value of the second contour is less than a fourth preset luminance value; the proportion of effective pixel values in the second contour is less than a third preset proportion; the peak value of the chromatic pixel count is greater than a second peak value; and the number of pixels contained in the contour of the second contour is greater than the number of pixels in the third contour. Alternatively... The difference in average saturation between the first contour and the second contour is greater than a second difference; the absolute value of the difference in average brightness between the first contour and the second contour is less than a third difference; the average brightness roughness of the second contour is less than a fifth brightness roughness; the effective pixel value ratio of the second contour is less than a fourth preset ratio; and the number of pixels contained in the contour of the second contour is greater than the fourth pixel number; or... The average chromaticity value of the first contour is less than the second preset chromaticity value, the average chromaticity value of the second contour is greater than the third preset chromaticity value, the effective pixel value ratio of the second contour is less than the fifth preset ratio, the average brightness roughness of the second contour is greater than the sixth brightness roughness, the average chromaticity roughness of the second contour is greater than the preset chromaticity roughness, the amount of overly bright pixels is greater than the fifth pixel amount, the average brightness value of the second contour is greater than the fifth preset brightness value, and the number of pixels contained in the contour of the second contour is greater than the sixth pixel amount.
2. The image analysis method according to claim 1, characterized in that, The step of determining the target parameter values corresponding to each contour includes: Convert the original image into an HSV image; The target image is obtained by combining the chroma channel threshold, saturation channel threshold, and brightness channel threshold to perform color segmentation on the HSV image. Obtain the amount of green pixels in the target image; The percentage of effective pixel values is determined by combining the amount of green pixels in the target image and the amount of pixels contained in the contour.
3. The image analysis method according to claim 2, characterized in that, The step of determining the target parameter values corresponding to each contour includes: The amount of overly bright pixels is determined based on the brightness channel image; The brightness channel image is preprocessed, including filtering and normalization. The brightness value is determined based on the preprocessed image, and the average brightness value is determined based on the brightness value and the number of pixels contained in the contour. Edge extraction is performed on the preprocessed image to obtain an edge image; The brightness roughness is determined based on the edge image, and the average brightness roughness is determined based on the brightness roughness and the number of pixels contained in the contour. And / or, The step of determining the target parameter values corresponding to each contour includes: Chromaticity values are determined based on the chroma channel image, and the average chroma value is determined based on the chroma values and the number of pixels contained in the contour. Obtain the histogram corresponding to the chroma channel image, and determine the peak value of the chroma pixel quantity based on the histogram; The chroma channel image is preprocessed, and edge extraction is performed on the preprocessed image to obtain an edge image. The chroma roughness is determined based on the edge image, and the average chroma roughness is determined based on the chroma roughness and the number of pixels contained in the contour. The amount of unexposed white pixels is determined by combining the lightness channel image and the chroma channel image.
4. An image analysis device, characterized in that, include: The acquisition module is used to acquire saturation channel images, brightness channel images, and chroma channel images from the original image; An extraction module is used to extract several contours from the saturation channel image; including: performing threshold segmentation on the saturation channel image; performing opening and closing operations on the image obtained after threshold segmentation to obtain a first image; performing inverse operations on the first image to obtain a second image; and extracting several first contours from the first image and several second contours from the second image, respectively. The first determining module is used to determine the target parameter values corresponding to each of the contours; the target parameter values include any multiple of the following: contour width, contour height, number of pixels contained in the contour, percentage of effective pixel values, average saturation, average brightness roughness, average brightness value, average chroma value, number of overly bright pixels corresponding to the brightness channel image, peak number of chroma pixels corresponding to the chroma channel image, number of unexposed white pixels, and average chroma roughness. The second determining module is used to determine whether there is a non-working region in the original image based on the analysis results of the target parameter values corresponding to each of the contours; including: if the difference between any target parameter value corresponding to any of the first contours and any target parameter value corresponding to any of the second contours satisfies a third preset condition, then it is determined that there is a non-working region in the original image; the third preset condition includes: The difference in average saturation between the first contour and the second contour is greater than a first difference value; the ratio of average chromatic roughness between the first contour and the second contour is less than a preset ratio value; the average luminance roughness of the first contour is less than a third luminance roughness value; the average luminance roughness of the second contour is less than a fourth luminance roughness value; the average luminance value of the first contour is greater than a third preset luminance value; the average luminance value of the second contour is less than a fourth preset luminance value; the proportion of effective pixel values in the second contour is less than a third preset proportion; the peak value of the chromatic pixel count is greater than a second peak value; and the number of pixels contained in the contour of the second contour is greater than the number of pixels in the third contour. Alternatively... The difference in average saturation between the first contour and the second contour is greater than a second difference; the absolute value of the difference in average brightness between the first contour and the second contour is less than a third difference; the average brightness roughness of the second contour is less than a fifth brightness roughness; the effective pixel value ratio of the second contour is less than a fourth preset ratio; and the number of pixels contained in the contour of the second contour is greater than the fourth pixel number; or... The average chromaticity value of the first contour is less than the second preset chromaticity value, the average chromaticity value of the second contour is greater than the third preset chromaticity value, the effective pixel value ratio of the second contour is less than the fifth preset ratio, the average brightness roughness of the second contour is greater than the sixth brightness roughness, the average chromaticity roughness of the second contour is greater than the preset chromaticity roughness, the amount of overly bright pixels is greater than the fifth pixel amount, the average brightness value of the second contour is greater than the fifth preset brightness value, and the number of pixels contained in the contour of the second contour is greater than the sixth pixel amount.
5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the image analysis method according to any one of claims 1-3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the image analysis method according to any one of claims 1-3.
Citation Information
Patent Citations
Image recognition method and device, storage medium and electronic device
CN111860533A
Image recognition method and system applied to self-walking equipment, self-walking equipment and readable storage medium
CN114387500A