Image analysis method, device, computer equipment and readable storage medium
By acquiring saturation and brightness channel images, calculating relative deviation values, and extracting and analyzing contour parameters, the problem of insufficient recognition of non-working areas by intelligent devices is solved, thereby improving the working efficiency and safety of the devices.
Patent Information
- Application Number
- CN202210846907.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-05-12
- Filing Date
- 2022-07-19
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2042-07-19
AI Technical Summary
Existing image analysis technologies cannot effectively identify non-working areas, causing intelligent devices to misidentify and redirect to non-working areas, thus reducing the efficiency and security of intelligent devices.
By acquiring saturation and brightness channel images, calculating relative deviation values, extracting contours, and determining target parameter values, the non-working areas in the image are identified by combining the analysis results of these parameter values.
It improves the accuracy of intelligent devices in recognizing non-working areas, reduces the false negative rate, and enhances the working efficiency and security of the devices.
Smart Images

Figure CN117094934B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to an image analysis method and device, computer equipment and a readable storage medium. BACKGROUND
[0002] With the development of science and technology, the current intelligent device can integrate image analysis technology to improve the intelligence and convenience of the intelligent device.
[0003] For example, the intelligent mower will collect image information of the ground in real time during the travel process, and then analyze and process the collected image to identify the lawn area and non-lawn area (such as cement ground), so as to accurately move to the lawn area and clean the lawn area. However, the existing image analysis technology is not perfect enough, often cannot effectively identify the non-lawn area, and thus the intelligent mower may move to the non-lawn area, reducing the working efficiency of the intelligent mower, and even causing the mower to be damaged by colliding with obstacles.
[0004] Similarly, other intelligent devices with image collection and analysis functions may also have the problem of being unable to effectively identify the non-working area during work. SUMMARY
[0005] Therefore, it is necessary to provide an image analysis method, image analysis device, computer equipment and computer readable storage medium to solve the above problems.
[0006] According to a first aspect of the embodiments of the present application, an image analysis method is provided, comprising:
[0007] obtaining a saturation channel image and a lightness channel image from the original image;
[0008] obtaining a relative deviation value image based on the saturation channel image and the lightness channel image, the relative deviation value image representing the relative deviation between the saturation and the lightness;
[0009] extracting a plurality of contours from the relative deviation value image;
[0010] determining target parameter values corresponding to each contour;
[0011] determining whether there is a non-working area in the original image according to the analysis result of the target parameter values corresponding to each contour.
[0012] In one of the embodiments, the relative deviation value image is obtained by using the following formula based on the saturation channel image and the lightness channel image:
[0013]
[0014] wherein dMat is the relative deviation value image, sMat is the saturation channel image, and vMat is the lightness channel image.
[0015] In one embodiment, the target parameter values include any of contour width, contour height, contour diagonal, contour pixel amount, contour coordinates, effective pixel value proportion, average saturation, average relative deviation value, low saturation pixel amount, average brightness roughness, average brightness value, average chroma value, average chroma roughness, and pixel amount peak value.
[0016] In one embodiment, the step of determining the target parameter values corresponding to each of the contours includes:
[0017] converting the original image into an HSV image;
[0018] color segmenting the HSV image in combination with a chroma channel threshold value, a saturation channel threshold value, and a lightness channel threshold value to obtain a target image;
[0019] obtaining a green pixel amount in the target image;
[0020] determining the effective pixel value proportion in combination with the green pixel amount in the target image and the contour pixel amount.
[0021] In one embodiment, the step of determining the target parameter values corresponding to each of the contours further includes:
[0022] determining the low saturation pixel amount according to the saturation channel image;
[0023] preprocessing the saturation channel image;
[0024] determining saturation according to the preprocessed image;
[0025] determining the average saturation in combination with the saturation and the contour pixel amount.
[0026] In one embodiment, the step of determining the target parameter values corresponding to each of the contours further includes:
[0027] preprocessing the relative deviation value image;
[0028] determining relative deviation value according to the preprocessed image;
[0029] determining the average relative deviation value according to the relative deviation value and the contour pixel amount.
[0030] In one of the embodiments, the step of determining the target parameter value corresponding to each of the contours further comprises:
[0031] preprocessing the luminance channel image;
[0032] determining a luminance value according to the preprocessed image, and determining the average luminance value according to the luminance value and the pixel amount contained in the contour;
[0033] performing edge extraction on the preprocessed image to obtain an edge image, determining a luminance roughness according to the edge image, and determining the average luminance roughness according to the luminance roughness and the pixel amount contained in the contour.
[0034] In one of the embodiments, the image analysis method further comprises a step of obtaining a chroma channel image according to the original image;
[0035] the step of determining the target parameter value corresponding to each of the contours further comprises:
[0036] determining a pixel amount peak value and a chroma value according to the chroma channel image;
[0037] determining the average chroma value according to the chroma value and the pixel amount contained in the contour;
[0038] preprocessing the chroma channel image;
[0039] performing edge extraction on the preprocessed image to obtain an edge image, determining a chroma roughness according to the edge image, and determining the average chroma roughness according to the chroma roughness and the pixel amount contained in the contour.
[0040] In one of the embodiments, the step of extracting a plurality of contours from the relative deviation value image comprises:
[0041] performing threshold segmentation on the relative deviation value image;
[0042] performing opening operation and closing operation on the threshold segmented image to obtain a first image;
[0043] extracting a plurality of first contours from the first image.
[0044] In one of the embodiments, the step of determining whether there is a non-working area in the original image according to the analysis result of the target parameter value corresponding to each of the contours comprises:
[0045] if the target parameter value corresponding to any of the first contours meets a first preset condition, it is determined that there is a non-working area in the original image;
[0046] wherein, the first preset condition comprises:
[0047] The average chroma value is greater than a first chroma value, the average chroma roughness is less than a preset chroma roughness, the average brightness roughness is less than a first brightness roughness, the effective pixel value proportion is less than a first proportion, the average brightness value is greater than a first brightness value, the pixel amount peak value is greater than a first pixel amount, a right lower vertex horizontal coordinate in the contour coordinate is greater than a first horizontal coordinate value, and a pixel amount contained in the contour is less than a second pixel amount.
[0048] In one of the embodiments, after the step of obtaining the first image, the image analysis method further comprises:
[0049] performing an inverse operation on the first image to obtain a second image;
[0050] extracting a plurality of second contours from the second image;
[0051] The step of determining whether the non-working area exists in the original image according to the analysis result of the target parameter value corresponding to each contour comprises:
[0052] If the difference between the target parameter value corresponding to any one of the first contours and the target parameter value corresponding to any one of the second contours satisfies a second preset condition, it is determined that the non-working area exists in the original image.
[0053] In one of the embodiments, the second preset condition comprises:
[0054] The contour diagonal of the first contour is greater than a preset value, the right lower vertex vertical coordinate of the first contour is greater than a first vertical coordinate value, the left upper vertex vertical coordinate of the first contour is less than a second vertical coordinate value, the effective pixel value proportion of the first contour is less than a second proportion, the average brightness roughness of the first contour is greater than a second brightness roughness, the average brightness value of the first contour is greater than a second brightness value, the average brightness value of the second contour is greater than a third brightness value, the difference between the average relative deviation values of the first contour and the second contour is greater than a first difference value, the difference between the average saturation degrees of the second contour and the first contour is greater than a preset saturation difference value, and the low saturation pixel amount is within a preset pixel amount range.
[0055] Alternatively, the second preset condition comprises:
[0056] The average chroma value of the first contour is greater than a second chroma value, the difference between the average chroma values of the first contour and the second contour is greater than a first chroma difference value, the pixel amount peak value is greater than a third pixel amount, the ratio of the average brightness roughness of the first contour to the second contour is less than a first preset ratio value, and the difference between the average brightness values of the first contour and the second contour is greater than a first brightness difference value.
[0057] Alternatively, the second preset condition comprises:
[0058] the profile height of the first profile is greater than a preset height, the right lower vertex abscissa of the first profile is greater than a second abscissa value, the pixel amount of the first profile is greater than a fourth pixel amount, the effective pixel value ratio of the first profile is less than a third ratio, the average brightness roughness of the first profile is less than a third brightness roughness, the average brightness value of the first profile is within a preset brightness range, the difference between the average brightness value of the first profile and the second profile is less than a second brightness difference value, the average brightness value of the second profile is less than a fourth brightness value, the average relative deviation value between the first profile and the second profile is greater than a second difference value, the absolute value of the difference between the average chroma value of the first profile and the second profile is greater than a second chroma difference value, and the pixel amount peak value is greater than a fifth pixel amount;
[0059] Alternatively, the second preset condition comprises:
[0060] the difference between the average brightness value of the first profile and the second profile is greater than a third brightness difference value, the average brightness roughness of the first profile and the second profile is less than a fourth brightness roughness, the pixel amount peak value is greater than a sixth pixel amount, the effective pixel value ratio of the first profile is less than a fourth ratio, the difference between the average chroma value of the first profile and the second profile is greater than a third chroma difference value, and the ratio of the average brightness roughness of the first profile and the second profile is less than a second preset ratio.
[0061] According to a second aspect of the embodiments of the present application, an image analysis device is provided, comprising:
[0062] a first acquisition module configured to acquire a saturation channel image and a lightness channel image according to an original image;
[0063] a second acquisition module configured to obtain a relative deviation value image based on the saturation channel image and the lightness channel image, the relative deviation value image representing the relative deviation between saturation and lightness;
[0064] a profile extraction module configured to extract a plurality of profiles from the relative deviation value image;
[0065] a first determination module configured to determine target parameter values corresponding to the profiles;
[0066] a second determination module configured to determine whether a non-working area exists in the original image according to the analysis results of the target parameter values corresponding to the profiles.
[0067] According to a third aspect of the embodiments of the present application, a computer device is provided, comprising a memory and a processor, the memory stores a computer program, and the processor implements the image analysis method described above when executing the computer program.
[0068] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the image analysis method described above.
[0069] The image analysis method, device, computer device and readable storage medium provided by the embodiments of the present application first acquire a saturation channel image and a lightness channel image according to an original image, then obtain a relative deviation value image based on the saturation channel image and the lightness channel image, extract a plurality of contours from the relative deviation value image and determine target parameter values corresponding to the contours, and finally determine whether a non-working area exists in the original image according to an analysis result of the target parameter values corresponding to the contours. Since the relative deviation values of the saturation and the lightness of the working area and the non-working area are different, the embodiments can segment a plurality of contours from the relative deviation value image, analyze the parameters of the contours in combination with the characteristics or differences between the working area and the non-working area, and then identify whether a non-working area exists in each contour, thereby effectively reducing the missed judgment of the non-working area in the image, more accurately identifying the non-working area in the image, and improving the working efficiency and safety of intelligent devices. BRIEF DESCRIPTION OF DRAWINGS
[0070] Figure 1 a flowchart of the image analysis method provided by an embodiment of the present application;
[0071] Figure 2 a flowchart of the image analysis method provided by another embodiment of the present application;
[0072] Figure 3 a flowchart of a specific example of the present application;
[0073] Figure 4 a schematic diagram of the images obtained in a specific example of the present application;
[0074] Figure 5 a flowchart of the image analysis method provided by another embodiment of the present application;
[0075] Figure 6 a flowchart of another specific example of the present application;
[0076] Figure 7 a schematic diagram of the images obtained in another specific example of the present application;
[0077] Figure 8A structural schematic diagram of an image analysis device provided by an embodiment of the present application is shown in FIG. 1.
[0078] Figure 9 A structural schematic diagram of a computer device provided by an embodiment of the present application is shown in FIG. 2. DETAILED DESCRIPTION
[0079] In order to facilitate the understanding of the present application, the present application will be described in more detail below with reference to the relevant drawings. The preferred embodiments of the present application are shown in the drawings. However, the present application can be implemented in many different forms, and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0080] In the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connecting", "fixing" and the like should be understood in a broad sense, for example, it can be fixedly connected, or it can be detachably connected, or it can be integrated; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium; it can be the internal communication of two elements or the interaction relationship between two elements, unless otherwise explicitly limited. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0081] The terms "first", "second" are only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise explicitly specified.
[0082] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as understood by those skilled in the art to which the present application belongs. The terms used in the specification of the present application are only for the purpose of describing the specific embodiments, and are not intended to limit the present application. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0083] As described in the background, image analysis technology, as a key technology, is widely used in various intelligent devices. For example, an intelligent mower can collect image information of the ground in real time during its travel and analyze and process the image information, so as to identify the lawn area and the non-lawn area (such as cement ground or stone ground, etc.), so as to go to the lawn area to perform the cleaning task.
[0084] However, the current image analysis technology is not perfect enough, and often cannot effectively and accurately identify non-lawn areas, that is, misidentifies non-lawn areas as lawn areas, which causes the intelligent mower to go to the non-lawn area to perform a cleaning task, on the one hand, reduces the working efficiency of the intelligent mower, and on the other hand, if there are obstacles in the non-lawn area, the intelligent mower may also be damaged due to collision with the obstacles. Similarly, other intelligent devices with image acquisition and analysis functions may also have the problem of being unable to effectively identify non-working areas during work.
[0085] To this end, the embodiments of the present 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 safety of intelligent devices.
[0086] In one embodiment, an image analysis method is provided, which can be used to identify non-working areas from an acquired image. Hereinafter, a mower is taken as an example for illustration, that is, the working area is the lawn area, and the non-working area is the non-lawn area.
[0087] Reference Figure 1 The image analysis method provided by the embodiments includes the following steps:
[0088] Step S100, obtaining a saturation channel image and a lightness channel image according to an original image.
[0089] An image is acquired by an acquisition device, and when the image is acquired, the acquired image is obtained from the acquisition device. In the embodiments of the present application, the image is defined as an original image, which can include a lawn area and a non-lawn area. An image has multiple characteristics, such as saturation, chroma, lightness, etc., and each characteristic has a corresponding channel image. In the embodiments, after the original image is processed accordingly, a saturation channel image and a lightness channel image are obtained for subsequent processing.
[0090] Step S300, obtaining a relative deviation value image based on the saturation channel image and the lightness channel image, the relative deviation value image representing the relative deviation between the saturation and the lightness.
[0091] After obtaining the saturation channel image and the lightness channel image, the deviation value between the saturation and the lightness at each position in the image can be calculated, and then an image representing the relative deviation value is obtained, which is defined as a relative deviation value image in the embodiments.
[0092] Step S500, extracting a plurality of contours from the relative deviation value image.
[0093] Since there is a certain difference between the relative deviation value of the lawn area and the relative deviation value of the non-lawn area, the relative deviation value image can be segmented by using this characteristic, and then a plurality of contours can be extracted therefrom.
[0094] In step S700, the target parameter value corresponding to each contour is determined.
[0095] After each contour is extracted, the target parameter value of each contour can be determined one by one. The target parameter value can be the value of a parameter that reflects whether there is a non-lawn area in the contour, such as the proportion of effective pixel value, the brightness-related value, the average relative deviation value, etc. Moreover, since there is a large difference between the lawn and the non-lawn, if the image contains both the lawn and the non-lawn, the characteristics of the target parameter value corresponding to each contour and the difference between the target parameter values of each contour can be used as an important criterion for whether there is a non-lawn area, such as the average chroma value, the proportion of effective pixel value, the average brightness value of a single contour, or the difference between the average relative deviation values of two contours, the difference between the average chroma values of two contours, the difference between the average brightness values of two contours, etc. In actual application, the target parameter can be determined according to actual needs, and the value of the target parameter can be obtained. The target parameter selected in this embodiment can be referred to in the subsequent specific description.
[0096] In this embodiment, the relative deviation value image, the saturation channel image, the lightness channel image, and the chroma channel image can be combined to determine the target parameter value corresponding to each contour, that is, the target parameter value of each contour is determined by comprehensively considering the characteristics of multiple dimensions such as saturation, lightness, chroma, and the relative deviation between saturation and lightness, thereby improving the accuracy of determining the non-lawn area based on the target parameter value.
[0097] In step S900, whether there is a non-working area in the original image is determined according to the analysis result of the target parameter value corresponding to each contour.
[0098] Since each contour is divided according to the difference in the relative deviation value between saturation and lightness, if there is a non-lawn area in the image, each contour has actually preliminarily distinguished the lawn area from the non-lawn area. On this basis, the non-lawn area can be further identified by combining the characteristics or differences of the target parameter values corresponding to each contour. If there is a non-lawn area, the target parameter value of the contour where the non-lawn area is located conforms to a certain rule, or the difference between the target parameter values of the contour and other contours containing only the lawn area theoretically conforms to a certain rule. In this embodiment, the target parameter values of each contour can be analyzed according to the above rule to determine whether there is a non-lawn area in the original image.
[0099] Since the contours of the relative deviation value image are divided according to the difference between the relative deviation values of the saturation and the lightness, the lawn area and the non-lawn area that may exist are preliminarily divided, and the parameters of the contours are further analyzed according to the characteristics or differences of the contours, so that the recognition accuracy of the non-lawn area is improved, and the non-lawn area is avoided from being missed.
[0100] In actual application, the non-lawn area may exist in each contour extracted, and as long as the non-lawn area exists in any contour, it is considered that the non-lawn area exists in the image, and the position of the non-lawn area in the image is determined, so that the lawn mower avoids the non-lawn area during the travel.
[0101] The image analysis method provided in the embodiment first acquires the saturation channel image and the lightness channel image according to the original image, then obtains the relative deviation value image based on the saturation channel image and the lightness channel image, extracts a plurality of contours from the relative deviation value image and determines the target parameter values corresponding to the contours, and finally determines whether the non-working area exists in the original image according to the analysis result of the target parameter values corresponding to the contours. Since the relative deviation values of the saturation and the lightness of the working area and the non-working area are different, the plurality of contours are segmented from the relative deviation value image, the parameters of the contours are analyzed according to the characteristics or differences of the working area and the non-working area, and then whether the non-working area exists in each contour is identified, so that the missed judgment of the non-working area in the image is effectively reduced, the non-lawn area in the image is more accurately recognized, and the working efficiency and safety of the intelligent equipment are improved.
[0102] In the embodiment, the original image collected by the camera or other collection device is usually an RGB format image, and in step S100, the RGB format image can be first converted into an HSV format image (referred to as HSV image), and then the HSV image is separated to obtain the saturation channel image and the lightness channel image.
[0103] The HSV format is a color space, which includes chroma H, saturation S, and brightness V. The chroma H is measured by an angle, and the value range is 0°-180°. The saturation S represents the degree of color close to the spectral color. The greater the proportion of the spectral color, the higher the degree of color close to the spectral color, and the higher the saturation of the color. The value range is 0%-100%. The brightness V represents the degree of color brightness. For object color, the brightness value V is related to the transmission ratio or reflectivity of the object. The value range is 0%-100%, 0% is black, and 100% is white. In the embodiment, after the HSV image is separated and processed, the saturation channel image, the brightness channel image, and the chroma channel image can be obtained at the same time. In the current step, the saturation channel image and the brightness channel image are obtained.
[0104] In one of the embodiments, in the step S300, i.e., the step of obtaining the relative deviation value image based on the saturation channel image and the brightness channel image, the following formula is used to obtain the relative deviation value image:
[0105]
[0106] In the formula, dMat is the relative deviation value image, sMat is the saturation channel image, and vMat is the brightness channel image.
[0107] The relative deviation value between the saturation and the brightness at each position can be calculated by the formula. Since the relative deviation value of the lawn is different from the relative deviation value of the non-lawn, the relative deviation value image can be segmented according to the difference in the subsequent step. If there is a non-lawn region, the non-lawn and the lawn can be segmented in advance.
[0108] In one of the embodiments, the target parameter value includes any one or more of the following: the contour width, the contour height, the contour diagonal, the pixel amount contained in the contour, the contour coordinates, the proportion of effective pixel values, the average saturation, the average relative deviation value, the low saturation pixel amount, the average brightness roughness, the average brightness value, the average chroma value, the average chroma roughness, and the pixel amount peak value.
[0109] In actual application, any one or more of the above target parameters can be selected as the determination parameter according to the requirement. In addition, the target parameters used may be different when different analysis methods are used.
[0110] In one of the embodiments, the step S700, i.e., the step of determining the target parameter value corresponding to each contour, includes:
[0111] The step S710a, i.e., the step of converting the original image into an HSV image.
[0112] Step S720a, color segmentation is performed on the HSV image in combination with the hue channel threshold, the saturation channel threshold and the lightness channel threshold to obtain a target image;
[0113] Step S730a, the amount of green pixels in the target image is obtained;
[0114] Step S740a, the proportion of effective pixel values is determined in combination with the amount of green pixels in the target image and the amount of pixels contained in the contour.
[0115] The above process is a specific process for determining the proportion of effective pixel values. After obtaining the target image, the amount of green pixels therein can be obtained. In this embodiment, the green pixels are effective pixels. In combination with the amount of green pixels and the amount of pixels contained in each image contour, the proportion of effective pixel values in each image contour can be determined. Generally, when a non-lawn area is contained, the proportion of effective pixel values is relatively low. Therefore, the proportion of effective pixel values can be an important factor for determining whether a non-lawn area exists.
[0116] In one embodiment, step S700, i.e., the step of determining the target parameter value corresponding to each contour, further includes:
[0117] Step S710b, the amount of low-saturation pixels is determined according to the saturation channel image.
[0118] In this embodiment, pixels with a pixel value lower than a certain value are defined as low-saturation pixels. For example, pixels with a pixel value less than 38 can be defined as low-saturation pixels. That is, the number of pixel points with a pixel value less than 38 in the saturation channel image, i.e., the amount of low-saturation pixels, can be determined.
[0119] Step S720b, the saturation channel image is preprocessed.
[0120] The preprocessing includes filtering processing and normalization processing, so as to reduce the interference signals in the saturation channel image, so as to improve the accuracy of the subsequent analysis process.
[0121] Step S730b, the saturation is determined according to the preprocessed image.
[0122] The preprocessed image is a grayscale image, and the pixel value range is 0-255. In this embodiment, the cumulative value of the pixel values of each pixel in the image is taken as the overall saturation.
[0123] Step S740b, the average saturation is determined in combination with the saturation and the amount of pixels contained in the contour.
[0124] In this embodiment, the saturation is divided by the amount of pixels contained in each contour to obtain the average saturation of each contour.
[0125] In one of the embodiments, the step S700 of determining the target parameter value corresponding to each contour further comprises:
[0126] The step S710c of pre-processing the relative deviation value image.
[0127] The pre-processing includes filtering and normalization.
[0128] The step S720c of determining the relative deviation value according to the pre-processed image.
[0129] The pre-processed image is a gray image with pixel value ranging from 0 to 255. In this embodiment, the accumulated value of the pixel value of each pixel in the image is taken as the relative deviation value.
[0130] The step S730c of determining the average relative deviation value according to the relative deviation value and the pixel amount contained in each contour.
[0131] In this embodiment, the average relative deviation value of each contour can be obtained by dividing the relative deviation value by the pixel amount contained in each contour.
[0132] In one of the embodiments, the step S700 of determining the target parameter value corresponding to each contour further comprises:
[0133] The step S710d of pre-processing the luminance channel image.
[0134] The pre-processing includes filtering and normalization. Thus, the interference signal in the luminance channel image can be reduced to improve the accuracy of the subsequent analysis process.
[0135] The step S720d of determining the brightness value according to the pre-processed image, and determining the average brightness value according to the brightness value and the pixel amount contained in each contour.
[0136] The pre-processed image is a gray image with pixel value ranging from 0 to 255. In this embodiment, the accumulated value of the pixel value of each pixel in the image is taken as the brightness value, and the average brightness value of each contour can be obtained by dividing the brightness value by the pixel amount contained in each contour.
[0137] The step S730d of performing edge extraction on the pre-processed image to obtain an edge image, determining the brightness roughness according to the edge image, and determining the average brightness roughness according to the brightness roughness and the pixel amount contained in each contour.
[0138] The pre-processed image can also be subjected to edge extraction, which can be performed by using a canny edge detection operator, etc. The edge image is a binary image with pixel value being either 0 or 255. The brightness roughness is the accumulation of the number of edge pixels, and the average brightness roughness of each contour can be obtained by dividing the brightness roughness by the pixel amount contained in each contour.
[0139] In one of the embodiments, the image analysis method provided by the embodiment further comprises a step of obtaining a chroma channel image according to the original image. In this embodiment, the chroma channel image can be obtained synchronously with the saturation channel image and the lightness channel image.
[0140] The step S700 of determining the target parameter value corresponding to each contour further comprises:
[0141] The step S710e of determining the pixel quantity peak value and the chroma value according to the chroma channel image.
[0142] The step S720e of determining the average chroma value according to the chroma value and the pixel quantity of the contour.
[0143] When the chroma channel image is obtained, a histogram corresponding to the chroma channel image, i.e., a chroma histogram, can be counted. The horizontal axis of the chroma histogram is the chroma distribution range, and the vertical axis is the pixel quantity of each chroma, i.e., the pixel quantity. The pixel quantity peak value can be determined by the chroma histogram.
[0144] The chroma channel image is a gray image, and the pixel value range is 0-180. In this embodiment, the pixel value less than 165 can be filtered out, and the accumulated result of all pixel values less than 165 is taken as the chroma value. The average chroma value of each contour can be calculated by dividing the chroma value by the pixel quantity of each contour.
[0145] The step S730e of pre-processing the chroma channel image.
[0146] The pre-processing includes filtering processing and normalization processing, so as to reduce the interference signal in the chroma channel image, and improve the accuracy of the subsequent analysis process.
[0147] The step S740e of performing edge extraction on the pre-processed image to obtain an edge image, determining the chroma roughness according to the edge image, and determining the average chroma roughness according to the chroma roughness and the pixel quantity of the contour.
[0148] The pre-processed image can also be subjected to edge extraction, which can be performed by using a canny edge detection operator. The edge image is a binary image, and the pixel value is either 0 or 255. The chroma roughness is the accumulation of the edge pixel number, and the average chroma roughness of each contour can be calculated by dividing the chroma roughness by the pixel quantity of each contour.
[0149] Based on the large amount of images collected as data analysis, the image features of the contour of the non-lawn area and the image features of the contour of the non-lawn area can be obtained, and the difference between the two. In this embodiment, the preset condition can be determined in advance according to the image features and the difference obtained above, so as to serve as a reference for the existence of non-lawn area in the actual application scene.
[0150] Referring to Figure 2 In one embodiment, step S500, i.e. extracting a plurality of contours from the relative deviation value image, includes:
[0151] Step S510, threshold segmentation is performed on the relative deviation value image.
[0152] In this embodiment, the foreground and background of the relative deviation value image can be segmented. Specifically, Otsu threshold segmentation can be used, or other algorithms that can achieve the same function can be used for threshold segmentation.
[0153] In actual application, before threshold segmentation is performed on the relative deviation value image, the relative deviation value image can be preprocessed, including filtering and normalization. In this way, the interference signal in the relative deviation value image can be reduced, so as to improve the accuracy of the subsequent analysis process.
[0154] Step S530, open operation and close operation are performed on the threshold segmented image to obtain a first image.
[0155] The open operation generally refers to smoothing the object contour, disconnecting the narrow neck, and eliminating small protrusions. The close operation generally also smooths the object contour, but it can bridge the narrow discontinuity and the long ditch, eliminate small spaces, and fill the broken contour line. In this embodiment, after the open operation and the close operation are performed on the image obtained after threshold segmentation, the contour in the image can be smoothed, the narrow neck can be disconnected, and small protrusions can be eliminated. At the same time, the narrow discontinuity and the long ditch can be bridged, small spaces can be eliminated, and the broken contour line can be filled, so that a smoother first image is obtained, which facilitates better extraction of the contour from the first image.
[0156] Step S550, a plurality of first contours in the first image are extracted.
[0157] When the first image is obtained, contour detection can be performed on the first image, and then a plurality of first contours can be extracted from the first image.
[0158] In one embodiment, step S900, i.e. determining whether the non-working area exists in the original image according to the analysis result of the target parameter value corresponding to each contour, includes:
[0159] In step S910, if the target parameter value corresponding to any first contour satisfies a first preset condition, it is determined that the non-working area exists in the original image.
[0160] The first preset condition is a determination condition representing that the non-lawn area exists in the first contour, and can be a numerical distribution feature of the target parameter value corresponding to the non-lawn area. After obtaining a plurality of first contours, the target parameter values corresponding to the first contours can be analyzed iteratively to determine whether the first preset condition is satisfied. If the target parameter value corresponding to a first contour satisfies the first preset condition, it is determined that the non-lawn area exists in the first contour, that is, the non-lawn area exists in the image.
[0161] In one of the embodiments, the first preset condition includes:
[0162] The average chroma value is greater than the first chroma value, the average chroma roughness is less than the preset chroma roughness, the average brightness roughness is less than the first brightness roughness, the effective pixel value proportion is less than the first proportion, the average brightness value is greater than the first brightness value, the pixel amount peak value is greater than the first pixel amount, the right lower vertex horizontal coordinate in the contour coordinates is greater than the first horizontal coordinate value, and the pixel amount contained in the contour is less than the second pixel amount.
[0163] Based on a large number of images collected as data analysis basis, the image features of the contours in which the non-lawn area exists can be obtained, such as the low effective pixel value proportion and the low average brightness roughness, and the above-mentioned first preset condition set on this basis is relatively accurate.
[0164] In one of the embodiments, in the first preset condition, the first chroma value includes 80, the preset chroma roughness includes 0.1, the first brightness roughness includes 0.11, the first proportion includes 0.85, the first brightness value includes 80, the first pixel amount includes 600, the first horizontal coordinate value includes 157, and the second pixel amount includes 8500.
[0165] Of course, the selection of the above-mentioned threshold values is not unique, and can be determined according to the actual situation, as long as the above-mentioned preset condition conforms to the features of the non-lawn area in the contour.
[0166] In addition, it should be noted that the first preset condition also includes the limitation of the contour width or the contour height. That is, before determining whether the above-mentioned target parameter meets the condition, it is first determined whether the contour width or the contour height meets a certain standard. If it meets, the analysis of other target parameters can be performed, otherwise, the subsequent analysis of the image contour can be ignored. For example, when the contour width is greater than 85 or the contour height is greater than 70, it is considered that the contour is valid and the subsequent analysis can be performed. If the contour width does not reach 85 and the contour height also does not reach 70, it is considered that the contour is invalid and the contour is ignored.
[0167] The following is combined Figure 3 and Figure 4 The image analysis method provided in this embodiment will be illustrated with a specific example:
[0168] First, obtain the original image orgMat, convert it to an HSV image hsvMat, and then separate the saturation channel image sMat, the chroma channel image hMat, and the brightness channel image vMat (refer to...). Figure 4 (a)
[0169] HSV images are segmented using chroma channel thresholding, lightness channel thresholding, and saturation channel thresholding to obtain the target image prevObstacleMat (refer to...). Figure 4 (a)
[0170] The relative deviation image dMat is obtained from the saturation channel image sMat and the brightness channel image vMat (refer to...). Figure 4 (a)
[0171] Reference Figure 4 In (a) and (b), the relative deviation value image dMat is filtered and normalized to obtain the image normDMat. The image normDMat is then segmented using the Otsu threshold to obtain the image otsuDMat. The image otsuDMat is then subjected to opening and closing operations to obtain the image unObstDMat. The image unObstDMat is then subjected to contour detection to extract several first contours. The width boundRect.width, height boundRect.height, diagonal boundRect.diagonal, coordinates, and number of pixels pxN of each first contour are then calculated.
[0172] Reference Figure 4 In (a), the brightness channel image vMat is filtered and normalized to obtain the image normVMat. Edge extraction is performed on the image normVMat to obtain the image cannyVMat. The brightness value bright is determined based on the image normVMat, and then divided by the number of pixels pxN in each first contour to calculate the average brightness value avgBright for each first contour. The brightness roughness canV is determined based on the image cannyVMat, and then divided by the number of pixels pxN in each contour to calculate the average brightness roughness avgCanV for each first contour.
[0173] According to the chroma histogram corresponding to the chroma channel image hMat, a pixel amount peak value maxColor is determined, and pixel values less than 165 are accumulated to obtain a chroma value hValue, and then divided by the pixel amount pxN of each contour to calculate the average chroma value avgHValue of each first contour.
[0174] The chroma channel image hMat is filtered and normalized to obtain an image normHMat, and the image normHMat is edge extracted to obtain an image cannyHMat, and then the chroma roughness canH is determined according to the image cannyHMat, and then divided by the pixel amount pxN contained in each contour to calculate the average chroma roughness avgCanH of each first contour.
[0175] According to the target image prevObstacleMat, the green pixel amount vldpxN is determined, and then divided by the pixel amount pxN contained in each contour to calculate the effective pixel value ratio avgVldpxN of each first contour.
[0176] In this example, the first preset condition is that the average chroma value is greater than 80, the average chroma roughness is less than 0.1, the average brightness roughness is less than 0.11, the effective pixel value ratio is less than 0.85, the average brightness value is greater than 80, the pixel amount peak value is greater than 600, the right lower vertex horizontal coordinate in the contour coordinate is greater than 157, and the pixel amount contained in the contour is less than 8500.
[0177] Referring to Figure 4 In (b), the analysis result is that the number of first contours is 8. Among them:
[0178] Regarding the eighth first contour:
[0179] The average chroma value avgHValue is 84.05, the average chroma roughness avgCanH is 0.069, the average brightness roughness avgCanV is 0.102, the effective pixel value ratio avgVldpxN is 0.795, the average brightness value avgBright is 239.03, the pixel amount peak value maxColor is 1149, the right lower vertex horizontal coordinate boundRect.br.x in the contour coordinate is 160, the pixel amount boundRect.pxN contained in the contour is 4344, the contour width boundRect.width is 160, and the contour height boundRect.height is 79.
[0180] According to the analysis, it can be determined that the target parameter value of the eighth first contour meets the first preset condition, and there is a non-lawn area in the eighth first contour, and there is a non-lawn area in the currently obtained original image.
[0181] Referring to Figure 5In one of the embodiments, after the step S530, i.e. the step of obtaining the first image, the step S500, i.e. the step of extracting the contours from the relative deviation value image, further comprises:
[0182] The step S540, i.e. the step of performing the inverse operation on the first image to obtain the second image.
[0183] After obtaining the first image, the inverse operation can be performed on the first image, i.e. the color of the pixels in the image is changed to the inverse color, and the image after the inverse operation is taken as the second image, which is used for subsequent extraction of the contours from the second image.
[0184] The step S560, i.e. the step of extracting the second contours from the second image.
[0185] After obtaining the second image, the contour detection can be performed on the second image, and then the second contours are extracted from the second image. Thus, the first contours and the second contours can be obtained, and the first contours and the second contours can be compared and analyzed, and the non-lawn area can be identified by using the difference between the first contours and the second contours and the image features of the first contours and the second contours.
[0186] In one of the embodiments, the step S900, i.e. the step of determining whether the non-working area exists in the original image according to the analysis result of the target parameter values corresponding to the contours, comprises:
[0187] The step S910’, i.e. the step of determining that the non-working area exists in the original image if the difference between the target parameter value corresponding to any one of the first contours and the target parameter value corresponding to any one of the second contours satisfies the second preset condition.
[0188] In actual application, the first contours and the second contours can be compared two by two, and if the difference between the target parameter values corresponding to two contours is found to satisfy the second preset condition, it is determined that one of the two contours contains the non-lawn area, and the approximate position of the non-lawn area in the original image is determined, which is beneficial to control the lawn mower to avoid working in the non-lawn area.
[0189] In the embodiment, the second preset condition can include that the difference between the average relative deviation values of different two contours exceeds a certain value, or the difference between the average chroma values of different two contours exceeds a certain value, etc., as long as the preset condition can reflect the difference between the non-lawn area and the lawn area. Meanwhile, the characteristics of the contours themselves can be used for identification, such as the average chroma value, the average brightness value, the average brightness roughness, etc., so as to improve the accuracy of identification.
[0190] In one of the embodiments, the second preset condition can include:
[0191] The profile diagonal of the first profile is greater than a preset value, the lower-right vertex longitudinal coordinate of the first profile is greater than a first longitudinal coordinate value, the upper-left vertex longitudinal coordinate of the first profile is less than a second longitudinal coordinate value, the effective pixel value proportion of the first profile is less than a second proportion, the average brightness roughness of the first profile is greater than a second brightness roughness, the average brightness value of the first profile is greater than a second brightness value, the average brightness value of the second profile is greater than a third brightness value, the difference between the average relative deviation values of the first profile and the second profile is greater than a first difference value, the difference between the average saturation degrees of the second profile and the first profile is greater than a preset saturation difference value, and the low-saturation pixel amount is within a preset pixel amount range.
[0192] The preset value can include 110, the first longitudinal coordinate value can include 65, the second longitudinal coordinate value can include 10, the second proportion can include 0.35, the second brightness roughness can include 0.17, the second brightness value can include 105, the third brightness value can include 95, the first difference value can include 70, the preset saturation difference value can include 28, and the preset pixel amount range can include 1800-4000.
[0193] Alternatively, the second preset condition includes:
[0194] The average chroma value of the first profile is greater than a second chroma value, the difference between the average chroma values of the first profile and the second profile is greater than a first chroma difference value, the pixel amount peak value is greater than a third pixel amount, the ratio of the average brightness roughnesses of the first profile and the second profile is less than a first preset ratio value, and the difference between the average brightness values of the first profile and the second profile is greater than a first brightness difference value.
[0195] The second chroma value can include 65, the first chroma difference value can include 23, the third pixel amount can include 600, the first preset ratio value can include 0.5, and the first brightness difference value can include 10.
[0196] Alternatively, the second preset condition includes:
[0197] The profile height of the first profile is greater than a preset height, the lower-right vertex horizontal coordinate of the first profile is greater than a second horizontal coordinate value, the pixel amount contained in the profile of the first profile is greater than a fourth pixel amount, the effective pixel value proportion of the first profile is less than a third proportion, the average brightness roughness of the first profile is less than a third brightness roughness, the average brightness value of the first profile is within a preset brightness range, the difference between the average brightness values of the second profile and the first profile is less than a second brightness difference value, the average brightness value of the second profile is less than a fourth brightness value, the average relative deviation value of the first profile and the second profile is greater than a second difference value, the absolute value of the difference between the average chroma values of the second profile and the first profile is greater than a second chroma difference value, and the pixel amount peak value is greater than a fifth pixel amount.
[0198] The preset height can include 65, the second horizontal coordinate value can include 157, the fourth pixel amount can include 1500, the third proportion can include 0.71, the third brightness roughness can include 0.252, the preset brightness range can include 70-230, the second brightness difference value can include 70, the fourth brightness value can include 200, the second difference value can include 70, the second chroma difference value can include 17, and the fifth pixel amount can include 1400.
[0199] Alternatively, the second preset condition includes:
[0200] The difference between the average brightness values of the second profile and the first profile is greater than the third brightness difference value, the average brightness roughnesses of the first profile and the second profile are both less than the fourth brightness roughness, the pixel amount peak value is greater than the sixth pixel amount, the proportion of the effective pixel value of the first profile is less than the fourth proportion, the difference between the average chroma values of the first profile and the second profile is greater than the third chroma difference value, and the ratio of the average brightness roughnesses of the first profile and the second profile is less than the second preset ratio.
[0201] The third brightness difference value can include 50, the fourth brightness roughness can include 0.26, the sixth pixel amount can include 400, the fourth proportion can include 0.895, the third chroma difference value can include 20, and the second preset ratio can include 0.5.
[0202] The above lists four groups of 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-lawn area.
[0203] Of course, the selection of the above-mentioned thresholds is not unique and can be determined according to actual conditions, as long as the above-mentioned preset conditions are beneficial to the identification of non-lawn areas.
[0204] The image analysis method provided by the embodiment will be described below in combination with Figure 6 and Figure 7 a specific example:
[0205] First, an original image orgMat is obtained, which is converted into an HSV image hsvMat, and then a saturation channel image sMat, a chroma channel image hMat and a lightness channel image vMat are separated out (see Figure 7 (a)).
[0206] The HSV image is subjected to s color segmentation through a chroma channel threshold, a lightness channel threshold and a saturation channel threshold, to obtain a target image prevObstacleMat (see Figure 7 (a)).
[0207] A relative deviation value image dMat is obtained according to the saturation channel image sMat and the lightness channel image vMat (seeFigure 7 In (a).
[0208] Referring to Figure 7 In (a) and (b), the relative deviation value image dMat is filtered and normalized to obtain an image normDMat, the image normDMat is subjected to Otsu threshold segmentation to obtain an image otsuDMat, the image otsuDMat is subjected to opening and closing operations to obtain an image unObstDMat, the image unObstDMat is subjected to inversion to obtain an image obstDMat, the image unObstDMat and the image obstDMat are subjected to contour detection to extract a first contour and a second contour, respectively, and the width boundRect.width, the height boundRect.height, the diagonal boundRect.diagonal, the coordinates, and the pixel amount pxN of each contour are counted.
[0209] The pixel amount of the pixel value less than 38 in the saturation channel image sMat, i.e., the low saturation pixel amount satInvalid, is counted.
[0210] Referring to Figure 7 In (a), the saturation channel image sMat is filtered and normalized to obtain an image normSMat, the saturation Sat is obtained according to the image normSMat, and then divided by the pixel amount pxN in each contour to calculate the average saturation avgSat of each contour.
[0211] The relative deviation value diffSatV is obtained according to the image normDMat, and then divided by the pixel amount pxN in each contour to calculate the average relative deviation value avgDiffSatV of each contour.
[0212] Referring to Figure 7 In (a), the luminance channel image vMat is filtered and normalized to obtain an image normVMat, and the image normVMat is subjected to edge extraction to obtain an image cannyVMat. The brightness value bright is determined according to the image normVMat, and then divided by the pixel amount pxN in each contour to calculate the average brightness value avgBright of each contour. The brightness roughness canV is determined according to the image cannyVMat, and then divided by the pixel amount pxN in each contour to calculate the average brightness roughness avgCanV of each contour.
[0213] According to the chroma histogram corresponding to the chroma channel image hMat, a pixel amount peak value maxColor is determined, and pixel values less than 165 are accumulated to obtain a chroma value hValue, and then divided by the pixel amount pxN of each contour to calculate the average chroma value avgHValue of each contour.
[0214] According to the target image prevObstacleMat, a green pixel amount vldpxN is determined, and then divided by the pixel amount pxN of each contour to calculate the effective pixel value ratio avgVldpxN of each contour.
[0215] In the present example, the second preset condition is that the contour diagonal of the first contour is greater than 110, the lower right vertex ordinate of the first contour is greater than 65, the upper left vertex ordinate of the first contour is less than 10, the effective pixel value ratio of the first contour is less than 0.35, the average brightness roughness of the first contour is greater than 0.17, the average brightness value of the first contour is greater than 105, the average brightness value of the second contour is greater than 95, the difference between the average relative deviation value of the first contour and the second contour is greater than 70, the difference between the average saturation of the second contour and the first contour is greater than 28, and the low saturation pixel amount is within 1800-4000.
[0216] Referring to Figure 7 In (b), the analysis result is that the number of first contours is 11, and the number of second contours is 12. Among them:
[0217] Regarding the second first contour:
[0218] The low saturation pixel amount satInvalid is 3874, the contour diagonal boundRect.diagonal is 165.32, the lower right vertex ordinate boundRect.br.y is 94, the upper left vertex ordinate boundRect.tl.y is 0, the effective pixel value ratio avgVldpxN is 0.313, the average brightness roughness avgCanV is 0.279, the average brightness value avgBright is 198.95, the average relative deviation value avgDiffSatV is 180, and the average saturation avgSat is 46.
[0219] Regarding the twelfth second contour:
[0220] The average brightness value avgBright is 127.19, the average relative deviation value avgDiffSatV is 90, and the average saturation avgSat is 202.
[0221] According to the analysis, it can be determined that the image features of the second first contour and the twelfth second contour and the difference between the two satisfy the preset condition, and there is a non-lawn area in the currently obtained original image.
[0222] It should be understood that although the steps in the flowcharts involved in the above embodiments are shown in sequence according to the arrows, the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, the execution of the steps is not strictly limited in sequence, and the steps can be executed in other sequences. Moreover, at least some of the steps in the flowcharts involved in the above embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of the steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or steps or stages in other steps.
[0223] Based on the same inventive concept, another embodiment of the present application also provides an image analysis device for implementing the above-mentioned image analysis method. The implementation scheme for solving the problem provided by the image analysis device is similar to the implementation scheme described in the above method, so the specific limitations in one or more image analysis device embodiments provided below can refer to the limitations of the image analysis method in the above text, which will not be repeated here.
[0224] Referring to Figure 8 The image segmentation device provided by the embodiment includes a first acquisition module 100, a second acquisition module 300, a contour extraction module 500, a first determination module 700, and a second determination module 900. Among them:
[0225] The first acquisition module 100 is configured to acquire a saturation channel image and a lightness channel image according to an original image;
[0226] The second acquisition module 300 is configured to obtain a relative deviation value image based on the saturation channel image and the lightness channel image, the relative deviation value image representing the relative deviation between the saturation and the lightness;
[0227] The contour extraction module 500 is configured to extract a plurality of contours from the relative deviation value image;
[0228] The first determination module 700 is configured to determine a target parameter value corresponding to each contour;
[0229] The second determination module 900 is configured to determine whether a non-working area exists in the original image according to an analysis result of the target parameter value corresponding to each contour.
[0230] The image analysis provided by the embodiments of the present application first acquires a saturation channel image and a lightness channel image according to an original image, then obtains a relative deviation value image based on the saturation channel image and the lightness channel image, extracts a plurality of contours from the relative deviation value image and determines target parameter values corresponding to the contours, and finally determines whether a non-working area exists in the original image according to an analysis result of the target parameter values corresponding to the contours. Since the relative deviation values of the saturation and the lightness of the working area and the non-working area are different, the embodiments can segment a plurality of contours from the relative deviation value image, analyze the parameters of the contours in combination with the characteristics or differences between the working area and the non-working area, and then identify whether the non-working area exists in each contour, thereby effectively reducing the missed judgment of the non-working area in the image, more accurately identifying the non-working area in the image, and improving the working efficiency and safety of intelligent equipment.
[0231] In one of the embodiments, the second acquisition module 300 obtains the relative deviation value image by using the following formula:
[0232]
[0233] wherein dMat is the relative deviation value image, sMat is the saturation channel image, and vMat is the lightness channel image.
[0234] In one of the embodiments, the target parameter values include any one or more of a contour width, a contour height, a contour diagonal, a pixel amount contained in a contour, a contour coordinate, a proportion of effective pixel values, an average saturation, an average relative deviation value, a low saturation pixel amount, an average brightness roughness, an average brightness value, an average chroma value, an average chroma roughness, and a pixel amount peak value.
[0235] In one of the embodiments, the first determination module 700 is configured to:
[0236] convert the original image into an HSV image;
[0237] perform color segmentation on the HSV image in combination with a chroma channel threshold value, a saturation channel threshold value, and a lightness channel threshold value to obtain a target image;
[0238] acquire a green pixel amount in the target image;
[0239] determine the proportion of effective pixel values in combination with the green pixel amount in the target image and the pixel amount contained in the contour.
[0240] In one of the embodiments, the first determination module 700 is further configured to:
[0241] determine a low saturation pixel amount according to the saturation channel image;
[0242] Preprocess the saturation channel image;
[0243] Determine the saturation according to the preprocessed image;
[0244] Determine the average saturation according to the saturation and the pixel amount contained in the contour.
[0245] In one of the embodiments, the first determining module 700 is further configured to:
[0246] Preprocess the relative deviation value image;
[0247] Determine the relative deviation value according to the preprocessed image;
[0248] Determine the average relative deviation value according to the relative deviation value and the pixel amount contained in the contour.
[0249] In one of the embodiments, the first determining module 700 is further configured to:
[0250] Preprocess the luminance channel image;
[0251] Determine the luminance value according to the preprocessed image, and determine the average luminance value according to the luminance value and the pixel amount contained in the contour;
[0252] Perform edge extraction on the preprocessed image to obtain an edge image, determine the luminance roughness according to the edge image, and determine the average luminance roughness according to the luminance roughness and the pixel amount contained in the contour.
[0253] In one of the embodiments, the first obtaining module 100 is configured to obtain the chroma channel image according to the original image; and the first determining module 700 is further configured to:
[0254] Determine the pixel amount peak value and the chroma value according to the chroma channel image;
[0255] Determine the average chroma value according to the chroma value and the pixel amount contained in the contour;
[0256] Preprocess the chroma channel image;
[0257] Perform edge extraction on the preprocessed image to obtain an edge image, determine the chroma roughness according to the edge image, and determine the average chroma roughness according to the chroma roughness and the pixel amount contained in the contour.
[0258] In one of the embodiments, the contour extraction module 500 is configured to:
[0259] Perform threshold segmentation on the relative deviation value image;
[0260] Perform opening operation and closing operation on the threshold segmented image to obtain a first image;
[0261] extract a plurality of first contours in the first image.
[0262] In one of the embodiments, the second determining module 900 is configured to determine that the non-working area exists in the original image when the target parameter value corresponding to any first contour satisfies a first preset condition.
[0263] The first preset condition includes:
[0264] the average chroma value is greater than a first chroma value, the average chroma roughness is less than a preset chroma roughness, the average brightness roughness is less than a first brightness roughness, the proportion of effective pixel values is less than a first proportion, the average brightness value is greater than a first brightness value, the pixel amount peak value is greater than a first pixel amount, the right lower vertex horizontal coordinate in the contour coordinates is greater than a first horizontal coordinate value, and the pixel amount contained in the contour is less than a second pixel amount.
[0265] In one of the embodiments, the contour extraction module 500 is further configured to perform an inverse operation on the first image to obtain a second image, and extract a plurality of second contours in the second image.
[0266] The second determining module 900 is configured to determine that the non-working area exists in the original image when the difference between the target parameter value corresponding to any one of the first contours and the target parameter value corresponding to any one of the second contours satisfies a second preset condition.
[0267] In one of the embodiments, the second preset condition includes:
[0268] the contour diagonal of the first contour is greater than a preset value, the right lower vertex vertical coordinate of the first contour is greater than a first vertical coordinate value, the left upper vertex vertical coordinate of the first contour is less than a second vertical coordinate value, the proportion of effective pixel values of the first contour is less than a second proportion, the average brightness roughness of the first contour is greater than a second brightness roughness, the average brightness value of the first contour is greater than a second brightness value, the average brightness value of the second contour is greater than a third brightness value, the difference between the average relative deviation values of the first contour and the second contour is greater than a first difference value, the difference between the average saturation degrees of the second contour and the first contour is greater than a preset saturation difference value, and the low saturation pixel amount is within a preset pixel amount range.
[0269] Alternatively, the second preset condition includes:
[0270] the average chroma value of the first contour is greater than a second chroma value, the difference between the average chroma values of the first contour and the second contour is greater than a first chroma difference value, the pixel amount peak value is greater than a third pixel amount, the ratio of the average brightness roughness of the first contour to the second contour is less than a first preset ratio, and the difference between the average brightness values of the first contour and the second contour is greater than a first brightness difference value.
[0271] Alternatively, the second preset condition includes:
[0272] The height of the first contour is greater than the preset height; the x-coordinate of the lower right vertex of the first contour is greater than the second x-coordinate value; the number of pixels contained in the first contour is greater than the fourth number of pixels; the effective pixel value ratio of the first contour is less than the third ratio; the average brightness roughness of the first contour is less than the third brightness roughness; the average brightness value of the first contour is within the preset brightness range; the difference between the average brightness values of the second contour and the first contour is less than the second brightness difference; the average brightness value of the second contour is less than the fourth brightness value; the average relative deviation between the first contour and the second contour is greater than the second difference; the absolute value of the difference between the average chromaticity values of the second contour and the first contour is greater than the second chromaticity difference; and the peak pixel count is greater than the fifth number of pixels.
[0273] Alternatively, the second preset condition includes:
[0274] The difference between the average brightness values of the second contour and the first contour is greater than the third brightness difference. The average brightness roughness of the first contour and the second contour is less than the fourth brightness roughness. The peak pixel count is greater than the sixth pixel count. The effective pixel count ratio of the first contour is less than the fourth ratio. The difference between the average chromaticity values of the first contour and the second contour is greater than the third chromaticity difference. The ratio of the average brightness roughness of the first contour and the second contour is less than the second preset ratio.
[0275] 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.
[0276] 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.
[0277] Figure 9 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 9 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.
[0278] Those skilled in the art can understand that Figure 9 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0279] In one embodiment, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the steps in the above method embodiments.
[0280] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided by the present 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 memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM can be in various forms such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0281] Each technical feature of the above-mentioned embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of each technical feature in the above-mentioned embodiments are not described, but as long as the combination of technical features does not exist, it should be considered as the scope of the present application.
[0282] The above-mentioned embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the patent scope. It should be noted that for those skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. An image analysis method characterized by, The method comprises the following steps: obtaining a saturation channel image and a lightness channel image from an original image; obtaining a relative deviation value image based on the saturation channel image and the lightness channel image, the relative deviation value image representing the relative deviation between saturation and lightness; includes deriving the relative deviation value image using the following equation: where dMat is the relative deviation value image, sMat is the saturation channel image, and vMat is the lightness channel image. extracting a plurality of contours from the relative deviation value image; determining target parameter values corresponding to the contours; determining whether there is a non-working area in the original image based on the analysis results of the target parameter values corresponding to the contours.
2. The image analysis method according to claim 1, characterized in that, The target parameter values include any one or more of contour width, contour height, contour diagonal, pixel amount of a contour, contour coordinates, effective pixel value proportion, average saturation, average relative deviation value, low saturation pixel amount, average brightness roughness, average brightness value, average chroma value, average chroma roughness, and pixel amount peak value.
3. The image analysis method according to claim 2, characterized in that, The step of determining the target parameter values corresponding to the contours comprises the following steps: converting the original image into an HSV image; performing color segmentation on the HSV image based on a chroma channel threshold value, a saturation channel threshold value, and a lightness channel threshold value to obtain a target image; obtaining the green pixel amount in the target image; determining the effective pixel value proportion based on the green pixel amount in the target image and the pixel amount of the contour.
4. The image analysis method according to claim 2, characterized by, The step of determining the target parameter values corresponding to the contours further comprises the following steps: determining the low saturation pixel amount based on the saturation channel image; preprocessing the saturation channel image; determining saturation based on the preprocessed image; determining the average saturation based on the saturation and the pixel amount of the contour.
5. The image analysis method according to claim 2, characterized in that, The step of determining the target parameter values corresponding to the contours further comprises the following steps: preprocessing the relative deviation value image; determining the relative deviation value based on the preprocessed image; determining the average relative deviation value based on the relative deviation value and the pixel amount of the contour.
6. The image analysis method according to claim 2, characterized by, The step of determining the target parameter values corresponding to the contours further comprises the following steps: preprocessing the lightness channel image; determining the average brightness value based on the brightness value and the pixel amount of the contour; performing edge extraction on the preprocessed image to obtain an edge image, determining the brightness roughness based on the edge image, and determining the average brightness roughness based on the brightness roughness and the pixel amount of the contour.
7. The image analysis method according to claim 2, characterized by, The image analysis method further comprises the step of obtaining a chroma channel image based on the original image. The step of determining the target parameter values corresponding to the contours further comprises the following steps: determining the pixel amount peak value and the chroma value based on the chroma channel image; determining the average chroma value based on the chroma value and the pixel amount of the contour; preprocessing the chroma channel image; performing edge extraction on the preprocessed image to obtain an edge image, determining the chroma roughness based on the edge image, and determining the average chroma roughness based on the chroma roughness and the pixel amount of the contour.
8. The image analysis method according to claim 2, characterized by, The step of extracting a plurality of contours from the relative deviation value image comprises the following steps: performing threshold segmentation on the relative deviation value image; performing an opening operation and a closing operation on the image after threshold segmentation to obtain a first image; extracting a plurality of first contours in the first image.
9. The image analysis method according to claim 8, characterized in that, The step of determining whether the non-working area exists in the original image according to the analysis result of the target parameter value corresponding to each contour comprises: if the target parameter value corresponding to any first contour meets a first preset condition, it is determined that the non-working area exists in the original image; The first preset condition comprises: the average chroma value is greater than a first chroma value, the average chroma roughness is less than a preset chroma roughness, the average brightness roughness is less than a first brightness roughness, the effective pixel value proportion is less than a first proportion, the average brightness value is greater than a first brightness value, the pixel amount peak value is greater than a first pixel amount, the right lower vertex horizontal coordinate in the contour coordinates is greater than a first horizontal coordinate value, and the pixel amount contained in the contour is less than a second pixel amount.
10. The image analysis method of claim 8, wherein, After the step of obtaining the first image, the image analysis method further comprises: performing an inverse operation on the first image to obtain a second image; extracting a plurality of second contours in the second image; The step of determining whether the non-working area exists in the original image according to the analysis result of the target parameter value corresponding to each contour comprises: if the difference between the target parameter value corresponding to any first contour and the target parameter value corresponding to any second contour meets a second preset condition, it is determined that the non-working area exists in the original image.
11. The image analysis method according to claim 10, characterized in that, The second preset condition comprises: the contour diagonal of the first contour is greater than a preset value, the right lower vertex vertical coordinate of the first contour is greater than a first vertical coordinate value, the left upper vertex vertical coordinate of the first contour is less than a second vertical coordinate value, the effective pixel value proportion of the first contour is less than a second proportion, the average brightness roughness of the first contour is greater than a second brightness roughness, the average brightness value of the first contour is greater than a second brightness value, the average brightness value of the second contour is greater than a third brightness value, the difference between the average relative deviation values of the first contour and the second contour is greater than a first difference value, the difference between the average saturation degrees of the second contour and the first contour is greater than a preset saturation difference value, and the low saturation pixel amount is within a preset pixel amount range; Alternatively, the second preset condition comprises: the average chroma value of the first contour is greater than a second chroma value, the difference between the average chroma values of the first contour and the second contour is greater than a first chroma difference value, the pixel amount peak value is greater than a third pixel amount, the ratio of the average brightness roughness of the first contour to the second contour is less than a first preset ratio value, and the difference between the average brightness values of the first contour and the second contour is greater than a first brightness difference value; Alternatively, the second preset condition comprises: The profile height of the first profile is greater than a preset height, a right lower vertex abscissa of the first profile is greater than a second abscissa value, a pixel amount contained in the profile of the first profile is greater than a fourth pixel amount, the effective pixel value proportion of the first profile is less than a third proportion, the average brightness roughness of the first profile is less than a third brightness roughness, the average brightness value of the first profile is within a preset brightness range, a difference between the average brightness value of the first profile and the second profile is less than a second brightness difference value, the average brightness value of the second profile is less than a fourth brightness value, the average relative deviation value of the first profile and the second profile is greater than a second difference value, an absolute value of a difference between the average chroma value of the first profile and the second profile is greater than a second chroma difference value, and the pixel amount peak value is greater than a fifth pixel amount. Alternatively, the second preset condition comprises: The difference between the average brightness value of the first profile and the second profile is greater than a third brightness difference value, the average brightness roughness of the first profile and the second profile is less than a fourth brightness roughness, the pixel amount peak value is greater than a sixth pixel amount, the effective pixel value proportion of the first profile is less than a fourth proportion, the difference between the average chroma value of the first profile and the second profile is greater than a third chroma difference value, and the ratio of the average brightness roughness of the first profile and the second profile is less than a second preset ratio.
12. An image analysis apparatus characterized by comprising: Comprise: The first acquisition module is used for acquiring a saturation channel image and a lightness channel image according to an original image; The second acquisition module is used for obtaining a relative deviation value image based on the saturation channel image and the lightness channel image, the relative deviation value image representing a relative deviation between saturation and lightness; includes deriving the relative deviation value image using the following equation: where dMat is the relative deviation value image, sMat is the saturation channel image, and vMat is the lightness channel image. The profile extraction module is used for extracting a plurality of profiles from the relative deviation value image; The first determination module is used for determining target parameter values corresponding to each profile; The second determination module is used for determining whether a non-working area exists in the original image according to an analysis result of the target parameter values corresponding to each profile.
13. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to realize the image analysis method in any one of claims 1-11.
14. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the image analysis method in any one of claims 1-11.
Citation Information
Patent Citations
Obstacle identification method applied to self-walking equipment and self-walking equipment
CN114445440A
Image area extraction method and storage program
US20180225543A1