Roughness compensation method, system, image processing device and readable storage medium

By acquiring and compensating the roughness value and position information of the target area of ​​the image in image processing, dynamically adjusting the segmentation threshold, solving the problem of misjudgment of shadow recognition and improving the accuracy of shadow recognition.

CN114255173BActive Publication Date: 2025-01-03SUZHOU CLEVA PRECISION MACHINERY & TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011013414.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-24
Publication Date
2025-01-03
Estimated Expiration
2040-09-24

AI Technical Summary

Technical Problem

Due to the influence of the shooting angle, pixel loss on the image far away from the shooting device leads to misjudgment of shadow recognition results, and the prior art is difficult to effectively reduce misjudgment.

Method used

By obtaining the roughness value of the target area in the image and the position information of the pixel point in the image, the average position information is calculated, and compensation processing is performed based on whether it is located in the preset compensation area, the segmentation threshold is dynamically adjusted to reduce missegment.

Benefits of technology

It effectively reduces the misjudgment of shadow recognition results, improves the accuracy of shadow recognition, and avoids the missegment problem caused by fixed segmentation thresholds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114255173B_ABST
    Figure CN114255173B_ABST
Patent Text Reader

Abstract

The present invention discloses a roughness compensation method, system, image processing device and readable storage medium, wherein the roughness compensation method comprises the following steps: obtaining the roughness value of a target area in an image and the position information of each pixel in the target area; performing an averaging process according to the position information of each pixel in the target area to obtain the average position information; judging whether the average position information is located in a preset compensation area; when the average position information is located in the preset compensation area, performing compensation process on the roughness value and updating the roughness value; when the average position information is not located in the preset compensation area, not performing compensation process on the roughness value. The present invention uses the judgment result of whether the average position information is located in the preset compensation area as the basis for compensation process, and uses the compensated roughness value for image processing programs such as shadow recognition, which can effectively reduce the misjudgment of shadow recognition results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a roughness compensation method, system, image processing device and readable storage medium, and in particular to a roughness compensation method, system, image processing device and readable storage medium for effectively reducing shadow misjudgment. Background Art

[0002] Currently, the commonly used shadow detection methods are divided into two categories: methods based on geometric models and methods based on shadow features. The method based on geometric models uses the prior information of scenes, moving targets, and lighting conditions to establish a shadow model. This method is usually used in specific scenes. The method based on shadow features uses the geometric characteristics, brightness, color, texture (roughness) and other information of shadows to identify shadow areas, among which color and texture (roughness) are the two most widely used properties.

[0003] Due to the influence of the shooting angle, there will be a certain loss of pixels on the image far away from the end of the shooting device. If the roughness value is obtained based on the image with missing pixels, and shadow recognition is performed based on the obtained roughness value, it will lead to misjudgment of the shadow recognition result. Summary of the invention

[0004] The present invention provides a roughness compensation method, system, image processing equipment and readable storage medium for effectively reducing misjudgment.

[0005] The present invention provides a roughness compensation method; the method comprises the following steps:

[0006] Obtaining the roughness value of the target area in the image and the position information of each pixel in the target area;

[0007] Performing an averaging process according to the position information of each pixel in the target area to obtain average position information;

[0008] Determining whether the average position information is within a preset compensation area;

[0009] When the average position information is within the preset compensation area, the roughness value is compensated and the roughness value is updated;

[0010] When the average position information is not located within the preset compensation area, no compensation processing is performed on the roughness value.

[0011] Optionally, the position information of the pixel point is determined by a preset coordinate system of the image, the preset coordinate system includes an X-coordinate axis and a Y-coordinate axis, the X-coordinate axis and the Y-coordinate axis are respectively parallel to the boundaries of the image, and the position information of the pixel point is the Y-coordinate value of the pixel point, and the Y-coordinate value of the pixel point indicates the distance between the pixel point and the shooting device.

[0012] Optionally, the average position information is an average value of Y coordinate values ​​of each pixel point in the target area, and the preset compensation area is an area in the image far away from the shooting device.

[0013] Optionally, before obtaining the roughness value of the target area in the image and the position information of each pixel in the target area, the method includes: dynamically dividing the image into a plurality of target areas according to the chromaticity component of the image and a preset chromaticity interval, and the target areas include a first area and a second area.

[0014] Optionally, dynamically segmenting the image into a plurality of target areas according to the chromaticity components of the image and a preset chromaticity interval comprises:

[0015] Get the chrominance component of the image;

[0016] Generating a chrominance component histogram according to the chrominance component;

[0017] Determining peaks and valleys in the chroma component histogram according to a preset chroma interval and a preset peak-valley setting condition;

[0018] Obtain segmentation thresholds based on peaks and troughs;

[0019] The image is segmented into a first area and a second area according to the preset chromaticity interval and the segmentation threshold, wherein the chromaticity value corresponding to one of the first area and the second area is within the segmentation threshold range, and the chromaticity value corresponding to the other of the first area and the second area is within the preset chromaticity interval and the chromaticity value is not within the segmentation threshold range.

[0020] Optionally, when the target area is the first area, acquiring the roughness value of the target area in the image and the position information of each pixel in the target area includes acquiring the first roughness value of the first area in the image and the first position information of each pixel in the first area; when the average position information is within the preset compensation area, compensating the first roughness value, and updating the first roughness value includes multiplying the first roughness value with a preset first compensation coefficient for compensation when the first average position information is within the preset compensation area, and updating the first roughness value, wherein the preset first compensation coefficient is a constant.

[0021] Optionally, when the target area is the second area, acquiring the roughness value of the target area in the image and the position information of each pixel in the target area includes acquiring the second roughness value of the second area in the image and the second position information of each pixel in the second area; when the average position information is within the preset compensation area, compensating the roughness value, and updating the roughness value includes multiplying the second roughness value with a preset second compensation coefficient for compensation when the average position information is within the preset compensation area, and updating the second roughness value, wherein the preset second compensation coefficient is a constant.

[0022] The present invention also provides a roughness compensation system, the system comprising:

[0023] An information acquisition module, which is used to acquire the roughness value of a target area in an image and the position information of each pixel in the target area;

[0024] A position information processing module, which is used to perform an average processing according to the position information of each pixel point in the target area to obtain average position information;

[0025] A roughness compensation module is used to determine whether the average position information is located within a preset compensation area; when the average position information is located within the preset compensation area, the roughness value is compensated and the roughness value is updated; when the average position information is not located within the preset compensation area, the roughness value is not compensated.

[0026] The present invention also provides an image processing device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the roughness compensation method when executing the computer program.

[0027] The present invention also provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the roughness compensation method are implemented.

[0028] Compared with the prior art, the present invention uses the judgment result of whether the average position information is located within the preset compensation area as the basis for compensation processing, and uses the compensated roughness value for image processing procedures such as shadow recognition, which can effectively reduce the misjudgment of shadow recognition results. The present invention obtains the segmentation threshold according to the peak and the trough, and the segmentation threshold is dynamically adjusted according to different images, and a fixed segmentation threshold is no longer used, thereby effectively reducing mis-segmentation. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 is a flow chart of a first embodiment of a roughness compensation method of the present invention;

[0030] Figure 2is a flow chart of a second embodiment of the roughness compensation method of the present invention;

[0031] Figure 3 for Figure 2 Flow chart of step S105;

[0032] Figure 4 is a flow chart of a third embodiment of the roughness compensation method of the present invention;

[0033] Figure 5 is a flow chart of a fourth embodiment of the roughness compensation method of the present invention;

[0034] Figure 6 are the edge image, segmentation result image and eigenvalue of the first image;

[0035] Figure 7 are the edge image, segmentation result image and eigenvalue of the second image;

[0036] Figure 8 It is a principle block diagram of the roughness compensation system of the present invention. DETAILED DESCRIPTION

[0037] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0038] See also Figure 1-Figure 8 As shown, the present invention provides a roughness compensation method; the method comprises the following steps:

[0039] Step S10: obtaining the roughness value of the target area in the image and the position information of each pixel in the target area;

[0040] Step S20: performing an averaging process according to the position information of each pixel point in the target area to obtain average position information;

[0041] Step S30: determining whether the average position information is located in a preset compensation area; when the average position information is located in the preset compensation area, executing step S40; when the average position information is not located in the preset compensation area, executing step S50;

[0042] Step S40: performing compensation processing on the roughness value and updating the roughness value;

[0043] Step S50: No compensation processing is performed on the roughness value.

[0044] In another embodiment of the present invention, the position information of the pixel point in step S10 is determined by a preset coordinate system of the image, the preset coordinate system includes an X-coordinate axis and a Y-coordinate axis, the X-coordinate axis and the Y-coordinate axis are respectively parallel to the boundary of the image, the position information of the pixel point is the Y-coordinate value of the pixel point, and the Y-coordinate value of the pixel point indicates the distance between the pixel point and the camera. Assuming that the image is a rectangle, one of the boundary intersections of the image is used as the coordinate origin of the preset coordinate system, the X-coordinate axis and the Y-coordinate axis intersect at the coordinate origin, and the numerical range of the preset compensation area is set according to the extension direction of the X-coordinate axis and the Y-coordinate axis. Different preset coordinate systems correspond to the Y-coordinate value of the pixel point and the numerical range of the preset compensation area.

[0045] In another embodiment of the present invention, the average position information is an average value of Y coordinate values ​​of each pixel in the target area, and the preset compensation area is an area in the image far away from the shooting device.

[0046] In another embodiment of the present invention, the step before step S10 includes: dynamically segmenting the image into a plurality of target areas according to the chromaticity components of the image and a preset chromaticity range, wherein the target areas include a first area and a second area.

[0047] In another embodiment of the present invention, the present invention provides a roughness compensation method comprising the following steps:

[0048] Step S105: dynamically dividing the image into a first area and a second area according to the chromaticity component of the image and a preset chromaticity range;

[0049] Step S110: acquiring a first roughness value of a first area in an image and first position information of each pixel in the first area;

[0050] Step S120: acquiring a second roughness value of a second area in the image and second position information of each pixel in the second area;

[0051] Step S210: performing an averaging process based on the position information of each pixel point in the first area to obtain first average position information i a ;

[0052] Step S220: performing an averaging process based on the position information of each pixel point in the second area to obtain second average position information i b ;

[0053] Step S310: determining whether the first average position information is located in the preset compensation area; when the first average position information is located in the preset compensation area, executing step S410; when the first average position information is not located in the preset compensation area, executing step S510;

[0054] Step S320: determining whether the second average position information is located in the preset compensation area; when the second average position information is located in the preset compensation area, executing step S420; when the second average position information is not located in the preset compensation area, executing step S520;

[0055] Step S410: multiplying the first roughness value by a preset first compensation coefficient to perform compensation processing, and updating the first roughness value; wherein the preset first compensation coefficient is a constant;

[0056] Step S420: multiplying the second roughness value by a preset second compensation coefficient to perform compensation processing, and updating the second roughness value; wherein the preset second compensation coefficient is a constant;

[0057] Step S510: not performing compensation processing on the first roughness value;

[0058] Step S520: No compensation processing is performed on the second roughness value.

[0059] Assuming that the average position information < 25 indicates that the average position information is located within the preset compensation area, if i a <25, it means that the first average position information is located in the preset compensation area, and step S410 needs to be executed; otherwise, it means that the first average position information is not located in the preset compensation area, and step S510 needs to be executed. b <25, it indicates that the second average position information is located within the preset compensation area, and step S420 needs to be executed; otherwise, it indicates that the first average position information is not located within the preset compensation area, and step S520 needs to be executed.

[0060] In another embodiment of the present invention, the preset second compensation coefficient is different from the preset first compensation coefficient, for example, if the preset first compensation coefficient is 3, then Sa=3*Sa; if the preset second compensation coefficient is 4, then Sb=4*Sb. The values ​​of the preset second compensation coefficient and the preset first compensation coefficient can be adjusted according to the compensation effect.

[0061] See also Figure 2 As shown, in another embodiment of the present invention, step 105 includes the following steps:

[0062] Step S1051: obtaining the chrominance component of the image;

[0063] Step S1052: generating a chroma component histogram according to the chroma component;

[0064] Step S1053: determining the peaks and valleys in the chroma component histogram according to a preset chroma interval and a preset peak-valley setting condition;

[0065] Step S1054: obtaining a segmentation threshold according to the peaks and valleys;

[0066] Step S1055: Segment the image into a first area and a second area according to the preset chromaticity interval and the segmentation threshold, wherein the chromaticity value corresponding to one of the first area and the second area is within the segmentation threshold range, and the chromaticity value corresponding to the other of the first area and the second area is within the preset chromaticity interval and the chromaticity value is not within the segmentation threshold range.

[0067] The chromaticity components in step S1051 may be obtained directly or indirectly. The chromaticity components in the HSV image may be obtained after direct separation, and the chromaticity components of images such as RGB may be obtained after processing such as color space conversion.

[0068] In another embodiment of the present invention, the step S1051 includes:

[0069] Get image orgMat;

[0070] The image orgMat is separated and processed to obtain the H channel image outsMat and the chrominance component.

[0071] The acquired chromaticity component comes from the HSV image, and the HSV image includes a chromaticity component, a brightness component, and a saturation component.

[0072] In another embodiment of the present invention, the step S1051 includes:

[0073] Acquire an original image, where the original image includes a first color space;

[0074] Convert the original image from the first color space to the HSV color space and obtain the chrominance component.

[0075] Among them, the original images have different sources and different formats. The conversion processing is performed according to the format of the original image to obtain the chromaticity component. For example, the first color space can be an RGB color space, and then the original image is converted from the RGB color space to the HSV color space.

[0076] In another embodiment of the present invention, the step S1052 includes:

[0077] Generate a first chrominance component histogram orgLabelsMat according to the chrominance component;

[0078] The first chrominance component histogram orgLabelsMat is filtered and smoothed to obtain a second chrominance component histogram labelsMat.

[0079] In another embodiment of the present invention, the preset chromaticity interval in step S1053 can be determined according to needs, and different preset chromaticity intervals are set for different usage scenarios. For example, when the image is segmented by the image segmentation method based on chromaticity components of the present invention for lawn recognition, the preset chromaticity interval can be set to 15-95.

[0080] In another embodiment of the present invention, the preset peak and valley setting conditions in step S1053 include:

[0081] Preset peak and valley setting condition 1: Peak frequency > k*trough frequency, where k is a constant, including a positive integer, fraction or decimal;

[0082] Preset peak and valley setting condition 2: The distance between adjacent peaks meets the preset peak distance,

[0083] Preset peak and valley setting condition 3: peak frequency > frequency threshold.

[0084] The peaks and valleys in the chrominance component histogram are determined only when the preset peak and valley setting conditions 1, the preset peak and valley setting conditions 2 and the preset peak and valley setting conditions 3 are met at the same time. If the preset peak and valley setting conditions 1 and the preset peak and valley setting conditions 3 are met, but the preset peak and valley setting condition 2 is not met, the peak with the largest peak frequency is selected as the peak in the chrominance component histogram, and the remaining peaks are not regarded as peaks in the chrominance component histogram.

[0085] In another embodiment of the present invention, the step S1054 includes:

[0086] Counting the number j of the peaks;

[0087] Determine whether the number of peaks j is not less than 2; if the number of peaks j is not less than 2, execute step S403; if the number of peaks j is less than 2, execute step S404;

[0088] Obtain the segmentation threshold through the peak-valley segmentation method;

[0089] The segmentation threshold is obtained by Otsu thresholding method.

[0090] In another embodiment of the present invention, obtaining the segmentation threshold by using the peak-valley segmentation method includes:

[0091] Finding a group of peaks and valleys with the largest peak-to-valley ratio from the peaks and valleys as target peaks and valleys, and obtaining the position of the valley in the target peaks and valleys as the first position;

[0092] Find the second position where the maximum peak valley on the left side is located on the left side of the first position, find the third position where the maximum peak valley on the right side is located on the right side of the first position, and obtain the chromaticity value corresponding to the second position as the second wave peak chromaticity value h1i, and obtain the chromaticity value corresponding to the third position as the third wave peak chromaticity value h2i;

[0093] Find the chromaticity value corresponding to the minimum frequency between the second position and the third position as the split chromaticity value li;

[0094] The segmentation thresholds [lowValue, highValue] corresponding to regions of different chromaticities are obtained according to the second peak chromaticity value h1i, the third peak chromaticity value h2i and the segmentation chromaticity value li. The second peak chromaticity value h1i is compared with a preset second peak threshold, and the third peak chromaticity value h2i is compared with a preset third peak threshold to obtain a peak chromaticity value comparison result, and the segmentation thresholds corresponding to regions of different chromaticities are obtained according to the peak chromaticity value comparison result.

[0095] When the peak chromaticity value comparison result satisfies "the second peak chromaticity value h1i>the preset second peak threshold, and the third peak chromaticity value h2i>the preset third peak threshold", the minimum value of the preset chromaticity interval (or other numerical values ​​of the preset chromaticity interval) is set as the minimum value lowValue of the segmentation threshold, and the segmentation chromaticity value li is set to the maximum value highValue of the segmentation threshold.

[0096] When the peak chromaticity value comparison result does not satisfy "the second peak chromaticity value h1i>the preset second peak threshold, and the third peak chromaticity value h2i>the preset third peak threshold", the segmentation chromaticity value li is set to the minimum value lowValue of the segmentation threshold, and the maximum value of the preset chromaticity interval (it can also be other values ​​of the preset chromaticity interval) is set to the maximum value highValue of the segmentation threshold.

[0097] For example, the preset chromaticity interval is [15, 95], the preset second peak threshold is 30, the preset third peak threshold is 75, if h1i>30 and h2i>75 (the large peak is blue), then lowValue=15, highValue=li; otherwise, lowValue=li, highValue=95.

[0098] In another embodiment of the present invention, if the number of peaks j is less than 2, the Otsu threshold method (OTSU) is used to obtain the segmentation chromaticity value li, and the segmentation threshold [lowValue, highValue] corresponding to the area of ​​different chromaticity is obtained according to the number of peaks.

[0099] In order to accurately segment the area of ​​specific chromaticity in the preset chromaticity interval in the image, the lowest dividing point is found starting from the minimum value of the preset chromaticity interval. If the lowest dividing point exists, the second peak chromaticity value and the third peak chromaticity value are preset according to the first preset rule; if the lowest dividing point does not exist, the second peak chromaticity value and the third peak chromaticity value are preset according to the second preset rule. Among them, the chromaticity value of the lowest dividing point is mi, and the frequency corresponding to mi is greater than the frequency corresponding to mi+1 and mi+2. Taking the segmentation of grassland image as an example, the chromaticity value of some grass in the grassland is in the yellow-red chromaticity range (specific chromaticity). By finding the lowest dividing point, it is possible to avoid segmenting the yellow-red grass into non-grass areas after segmentation.

[0100] If there is a minimum demarcation point, the second peak chromaticity value and the third peak chromaticity value are preset according to the first preset rule based on the number of peaks. When the number of peaks is 0, the second peak chromaticity value h1i is set as the minimum demarcation point chromaticity value mi, and the third peak chromaticity value h2i is set as the maximum value of the preset chromaticity interval (it can also be other values ​​of the preset chromaticity interval). When the number of peaks is 1, the chromaticity value of the peak is h1, the second peak chromaticity value h1i is set as the minimum demarcation point chromaticity value, and the third peak chromaticity value is set to h1.

[0101] If there is no lowest dividing point, the second peak chromaticity value h1i and the third peak chromaticity value h2i are preset according to the number of peaks according to the second preset rule. When the number of peaks is 0, the second peak chromaticity value h1i is set to the minimum value of the preset chromaticity interval (it can also be other values ​​of the preset chromaticity interval), and the third peak chromaticity value h2i is set to the maximum value of the preset chromaticity interval (it can also be other values ​​of the preset chromaticity interval). When the number of peaks is 1, the chromaticity value of the peak is h1, the second peak chromaticity value h1i is set to h1, and the third peak chromaticity value is set to h1.

[0102] When the number of peaks is 0, the segmentation chromaticity value li, the second peak chromaticity value h1i and the third peak chromaticity value h2i are compared to obtain a peak chromaticity value comparison result, and the segmentation threshold corresponding to the area of ​​different chromaticity is obtained according to the peak chromaticity value comparison result.

[0103] When the number of peaks is 0, the comparison results include:

[0104] 1-1 When the peak chromaticity value comparison result satisfies "segmentation chromaticity value li>third peak chromaticity value h2i", the segmentation chromaticity value li is set to the minimum value lowValue of the segmentation threshold, and the maximum value of the preset chromaticity interval (it can also be other numerical values ​​of the preset chromaticity interval) is set to the maximum value highValue of the segmentation threshold.

[0105] 1-2 When the peak chromaticity value comparison result satisfies "segmentation chromaticity value li<second peak chromaticity value h1i", the minimum value of the preset chromaticity interval (or other numerical values ​​of the preset chromaticity interval) is set as the minimum value lowValue of the segmentation threshold, and the segmentation chromaticity value li is set to the maximum value highValue of the segmentation threshold.

[0106] 1-3 When the peak chromaticity value comparison result satisfies "the second peak chromaticity value h1i≤segmentation chromaticity value li≤third peak chromaticity value h2i", the second peak chromaticity value h1i is set to the minimum value lowValue of the segmentation threshold, and the third peak chromaticity value h2i is set to the maximum value highValue of the segmentation threshold.

[0107] When the number of peaks is 1, the second peak chromaticity value h1i is compared with the preset second peak threshold, and the third peak chromaticity value h2i is compared with the preset third peak threshold to obtain a peak chromaticity value comparison result, and the segmentation threshold corresponding to the area of ​​different chromaticity is obtained according to the peak chromaticity value comparison result. The comparison process when the number of peaks is 1 is the same as the comparison process when the number of peaks j is not less than 2, and the segmentation threshold [lowValue, highValue] corresponding to the area of ​​different chromaticity is obtained according to the second peak chromaticity value h1i, the third peak chromaticity value h2i and the segmentation chromaticity value li. The second peak chromaticity value h1i is compared with the preset second peak threshold, and the third peak chromaticity value h2i is compared with the preset third peak threshold to obtain a peak chromaticity value comparison result, and the segmentation threshold corresponding to the area of ​​different chromaticity is obtained according to the peak chromaticity value comparison result.

[0108] In another embodiment of the present invention, the step S105 further includes:

[0109] Step S106: Calculate the first average brightness value Va of the first area, the second average brightness value Vb of the second area, and the brightness difference Dv between the first average brightness value Va and the second average brightness value Vb; calculate the first roughness value Sa of the first area and the second roughness value Sb of the second area.

[0110] The first roughness value Sa and the second roughness value Sb in step S106 are used as data sources in steps S110 and S120 .

[0111] The step of calculating the first roughness value Sa of the first area and the second roughness value Sb of the second area comprises the following steps:

[0112] Get image orgMat;

[0113] Separate the image orgMat and obtain a V channel image, where the V channel image includes a brightness component;

[0114] Preprocessing the V channel image to obtain a preprocessed image, wherein the preprocessing includes filtering and normalization;

[0115] Perform edge extraction on the preprocessed image to obtain an edge image cannyMat;

[0116] A first roughness value Sa of the first area and a second roughness value Sb of the second area in the edge image cannyMat are calculated.

[0117] After executing the roughness compensation method, the first roughness value and the second roughness value in step S110 and step S120 obtain the final first roughness value and the second roughness value, and the roughness comparison value Rs of the first roughness value and the second roughness value is calculated according to the final first roughness value and the second roughness value in step S107.

[0118] The characteristic values ​​obtained by step S106 and step S107 include the first average brightness value of the first area, the second average brightness value of the second area, the brightness difference between the first average brightness value and the second average brightness value, the first roughness value of the first area, the second roughness value of the second area, or the roughness contrast value between the first roughness value and the second roughness value, and each of the characteristic values ​​is set with a corresponding preset threshold, wherein the comparison processing based on the characteristic value and the preset threshold to determine whether the image exists a shadow includes comparison processing based on each of the characteristic values ​​and the corresponding preset threshold, and determining whether the image exists a shadow based on any comparison result or a combination of comparison results.

[0119] According to any one or a combination of the eigenvalues, it is determined whether there is a shadow in the image. The combination of the eigenvalues ​​used to determine the shadow can be determined according to the needs. The combination of some eigenvalues ​​is used as the basis for determination:

[0120] Judgment basis 1: h1i>34 and h2i<75 (the color area is green range) and dv>45

[0121] Judgment basis 2: Vb<50 and Dv>40

[0122] Judgment basis 3: Rs<2 and Dv>35 and Sa>0.1

[0123] The image processing for shadow recognition includes several determination criteria, each of which includes any one or a combination of feature values. If any one or several determination criteria are met, then there is a shadow in the image; if any one or more determination criteria are not met, then there is no shadow in the image.

[0124] If there is a shadow, segmentation is performed using a preset fixed segmentation threshold (for example, [15, 95]) and the final segmentation result is dstMat; if there is no shadow, segmentation is performed using a dynamic segmentation threshold [lowValue, highValue] and the final segmentation result is dstMat.

[0125] The present invention also provides a roughness compensation system 1, the system comprising:

[0126] An information acquisition module 10, which is used to acquire the roughness value of a target area in an image and the position information of each pixel in the target area;

[0127] A position information processing module 20, which is used to perform an average processing according to the position information of each pixel point in the target area to obtain average position information;

[0128] The roughness compensation module 30 is used to determine whether the average position information is located in a preset compensation area; when the average position information is located in the preset compensation area, the roughness value is compensated and the roughness value is updated; when the average position information is not located in the preset compensation area, the roughness value is not compensated.

[0129] The present invention also provides an image processing device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the roughness compensation method when executing the computer program. The image processing device may be a lawn mower or other intelligent walking device, wherein the lawn mower or other intelligent walking device carries a shooting device, and the shooting device obtains an image in front of the walking direction, for example, an image of the grass in front, and the image includes an area close to the image processing device and an area far away from the image processing device. In the process of image processing of the image, if the average position information of the target area is within the preset compensation area (the area far away from the image processing device is set as the preset compensation area), compensation processing is required, and the compensated roughness value is closer to the real roughness value, which is conducive to subsequent shadow recognition.

[0130] The present invention also provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the roughness compensation method are implemented.

[0131] In summary, the present invention uses the judgment result of whether the average position information is located within the preset compensation area as the basis for compensation processing, and uses the compensated roughness value for image processing procedures such as shadow recognition, which can effectively reduce the misjudgment of shadow recognition results. The present invention obtains the segmentation threshold according to the peak and the trough, and the segmentation threshold is dynamically adjusted according to different images, and a fixed segmentation threshold is no longer used, thereby effectively reducing mis-segmentation.

[0132] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation mode may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

[0133] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. All equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.

Claims

1. A roughness compensation method; characterized in that, The method comprises the following steps: Obtaining the roughness value of the target area in the image and the position information of each pixel in the target area; Performing an averaging process according to the position information of each pixel in the target area to obtain average position information; Determining whether the average position information is within a preset compensation area; When the average position information is within the preset compensation area, the roughness value is compensated and the roughness value is updated; When the average position information is not located within the preset compensation area, no compensation processing is performed on the roughness value; Before obtaining the roughness value of the target area in the image and the position information of each pixel in the target area, the method includes: dynamically dividing the image into a plurality of target areas according to the chromaticity component of the image and a preset chromaticity interval, wherein the target areas include a first area and a second area; When the target area is the first area, the acquiring the roughness value of the target area in the image and the position information of each pixel in the target area includes acquiring the first roughness value of the first area in the image and the first position information of each pixel in the first area, and performing an averaging process according to the first position information of each pixel in the first area to obtain the first average position information; when the average position information is within the preset compensation area, performing compensation process on the first roughness value, and updating the first roughness value includes multiplying the first roughness value by a preset first compensation coefficient to perform compensation process when the first average position information is within the preset compensation area, and updating the first roughness value, wherein the preset first compensation coefficient is a constant; When the target area is the second area, acquiring the roughness value of the target area in the image and the position information of each pixel in the target area includes acquiring the second roughness value of the second area in the image and the second position information of each pixel in the second area, and averaging the second position information of each pixel in the second area to obtain second average position information; when the average position information is within the preset compensation area, compensating the roughness value, and updating the roughness value includes multiplying the second roughness value by a preset second compensation coefficient for compensation when the second average position information is within the preset compensation area, and updating the second roughness value, wherein the preset second compensation coefficient is a constant, and the preset second compensation coefficient is different from the preset first compensation coefficient.

2. The roughness compensation method according to claim 1, characterized in that: The position information of the pixel point is determined by a preset coordinate system of the image, the preset coordinate system includes an X-coordinate axis and a Y-coordinate axis, the X-coordinate axis and the Y-coordinate axis are respectively parallel to the boundary of the image, the position information of the pixel point is the Y-coordinate value of the pixel point, and the Y-coordinate value of the pixel point indicates the distance between the pixel point and the shooting device.

3. The roughness compensation method according to claim 2, characterized in that: The average position information is the average value of the Y coordinate values ​​of each pixel point in the target area, and the preset compensation area is an area in the image far away from the shooting device.

4. The roughness compensation method according to claim 1, characterized in that: The step of dynamically dividing the image into a plurality of target areas according to the chromaticity components of the image and the preset chromaticity interval comprises: Get the chrominance component of the image; Generating a chrominance component histogram according to the chrominance component; Determining peaks and valleys in the chroma component histogram according to a preset chroma interval and a preset peak-valley setting condition; Obtain segmentation thresholds based on peaks and troughs; The image is segmented into a first area and a second area according to the preset chromaticity interval and the segmentation threshold, wherein the chromaticity value corresponding to one of the first area and the second area is within the segmentation threshold range, and the chromaticity value corresponding to the other of the first area and the second area is within the preset chromaticity interval and the chromaticity value is not within the segmentation threshold range.

5. A roughness compensation system, using the roughness compensation method of claim 1, characterized in that: The system comprises: An information acquisition module, which is used to acquire the roughness value of a target area in an image and the position information of each pixel in the target area; A position information processing module, which is used to perform an average processing according to the position information of each pixel point in the target area to obtain average position information; A roughness compensation module is used to determine whether the average position information is located within a preset compensation area; when the average position information is located within the preset compensation area, the roughness value is compensated and the roughness value is updated; when the average position information is not located within the preset compensation area, the roughness value is not compensated.

6. An image processing device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the roughness compensation method according to any one of claims 1 to 4 are implemented.

7. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the roughness compensation method according to any one of claims 1 to 4 are implemented.