Image shadow evaluation method and device
By calculating the image quality differences and grayscale characteristics of the main and secondary target objects, the problem of shadow misdetection in deep learning object detection is solved, and fast and accurate shadow evaluation and human body distinction are achieved.
Patent Information
- Application Number
- CN202111548452.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2041-12-17
AI Technical Summary
When detecting the human body, the existing deep learning-based object detection method is prone to misdetect the human body's shadow as a companion, which affects the implementation results of subsequent tasks and lacks effective methods of distinguishing.
By calculating the image quality of the main target object and the secondary target object, using the difference information of the overlapping area, the evaluation value of the secondary target object is determined as a shadow, avoid interference from the main target object, and NIQE scores and grayscale features are used for evaluation, and the evaluation value is corrected to improve accuracy.
It realizes rapid and widely used shadow evaluation, can flexibly adjust thresholds, accurately distinguish between human body and shadow, and improves the accuracy of target detection.
Smart Images

Figure CN114359684B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image shadow evaluation method and device. Background Art
[0002] Object detection is a key branch of image processing and computer vision, widely used in numerous fields. It has become a research hotspot in both theory and application in recent years. Reducing the consumption of human capital through computer vision has important practical significance. Object detection is also a fundamental algorithm in the field of pan-identity recognition, playing a crucial role in subsequent tasks such as face recognition, gait recognition, crowd counting, and instance segmentation.
[0003] Shadows, as an optical phenomenon, occur when an object blocks the propagation of light, preventing it from passing through an opaque object, resulting in a darker area. Shadows are also extremely common in digital images. When using deep learning-based object detection methods to detect human targets and their companions (companions are other human targets that are very close to the human target), people with shadows are often encountered. In this case, the object detection method may not only detect the human, but also the human's shadow as its companion (i.e., the human), which will affect the implementation of subsequent tasks. Therefore, in order to distinguish between a real human and its shadow, a fast discrimination method is needed that can effectively distinguish between a human and its shadow. Summary of the Invention
[0004] The present invention provides an image shadow evaluation method and device. By calculating the image quality of the images of the main target object and the secondary target object, the evaluation value of the secondary target object as a shadow is determined. There is no need to collect data to train the target detection model. The method has a wide range of applications and a fast detection speed.
[0005] In a first aspect, an embodiment of the present invention provides a method for evaluating image shadows, the method comprising:
[0006] Acquire a first area and a second area in the image to be measured, wherein the first area contains a primary target object and the second area contains a secondary target object;
[0007] Determine a first image based on difference information between the first area and the overlapping area, and determine a second image based on difference information between the second area and the overlapping area, wherein the overlapping area is determined based on an overlapping area between the first area and the second area;
[0008] An evaluation value of a secondary target object included in the second image is determined according to the image qualities of the first image and the second image.
[0009] This embodiment determines the evaluation value of whether the secondary target object is the shadow of the main target object based on the image quality of the first image containing the main target object and the image quality of the second image containing the secondary target object, and when calculating the image quality, removes the overlapping area of the main target object and the secondary target object, effectively avoiding the interference of the main target object on the shadow detection. The shadow evaluation method provided by this embodiment only needs to calculate the image quality of the images of the main target object and the secondary target object, and does not need to collect data to train the target detection model. It has a wide range of applications and a fast detection speed. By calculating the evaluation value of whether the secondary target object is a shadow, this embodiment can provide a more flexible selection space for subsequent needs related to target detection. The user can adjust the output threshold according to the needs to determine whether the secondary target object is a shadow.
[0010] As an optional implementation manner, the image quality of the first image is determined based on first quality information of the first image, and the image quality of the second image is determined based on second quality information of the second image.
[0011] As an optional implementation manner, determining, based on the image qualities of the first image and the second image, an evaluation value of whether the secondary target object is a shadow includes:
[0012] An evaluation value of a secondary target object included in the second image is determined according to difference information between the image qualities of the first image and the second image.
[0013] As an optional implementation, the method further includes:
[0014] determining at least one shadow reference evaluation value, wherein the shadow reference evaluation value is used to characterize the uniformity of the grayscale distribution of the second image;
[0015] The evaluation value is corrected according to the at least one shadow reference evaluation value to obtain a corrected evaluation value.
[0016] As an optional implementation manner, determining at least one shadow reference evaluation value includes:
[0017] performing threshold segmentation on the second image to obtain a secondary target object area and a background area;
[0018] determining a first grayscale feature of the secondary target object area according to the first variance of the secondary target object area, and determining a second grayscale feature of the background area according to the second variance of the background area;
[0019] A corresponding shadow reference evaluation value is determined according to at least one of the first grayscale feature and the second grayscale feature.
[0020] As an optional implementation manner, performing threshold segmentation on the second image to obtain a secondary target object area and a background area includes:
[0021] determining a segmentation threshold for the second image based on a threshold selection algorithm;
[0022] According to the segmentation threshold, threshold segmentation is performed on the grayscale histogram of the second image to obtain a secondary target object area and a background area, wherein the grayscale histogram is obtained by counting the number of pixels of different grayscale levels in the second image.
[0023] As an optional implementation, the first variance is determined in the following manner:
[0024] determining the first variance according to the total number of pixels, the grayscale mean, and the number of pixels corresponding to different grayscale levels in the secondary target object area; and / or,
[0025] The second variance is determined as follows:
[0026] The second variance is determined according to the total number of pixels in the background area, the grayscale mean, and the number of pixels corresponding to different grayscale levels.
[0027] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature, and the correcting the evaluation value according to the at least one shadow reference evaluation value to obtain a corrected evaluation value includes:
[0028] If the difference in image quality between the first image and the second image is greater than a first threshold, and the first grayscale feature is less than a second threshold, correcting the evaluation value to a first preset value representing a shadow;
[0029] If the difference information between the image quality of the first image and the second image is not greater than a first threshold, and the first grayscale feature is not less than a second threshold, the evaluation value is corrected to a second preset value representing a non-shadow.
[0030] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature and a second grayscale feature, and the correcting the evaluation value according to the at least one shadow reference evaluation value to obtain a corrected evaluation value includes:
[0031] Using the weights corresponding to the image quality of the second image, the first grayscale feature, and the second grayscale feature, weighted sums are performed on the image quality of the second image, the first grayscale feature, and the second grayscale feature to obtain a corrected evaluation value.
[0032] In a second aspect, an embodiment of the present invention provides an image shadow evaluation device, comprising a processor and a memory, wherein the memory is configured to store a program executable by the processor, and the processor is configured to read the program in the memory and perform the following steps:
[0033] Acquire a first area and a second area in the image to be measured, wherein the first area contains a primary target object and the second area contains a secondary target object;
[0034] Determine a first image based on difference information between the first area and the overlapping area, and determine a second image based on difference information between the second area and the overlapping area, wherein the overlapping area is determined based on an overlapping area between the first area and the second area;
[0035] An evaluation value of a secondary target object included in the second image is determined according to the image qualities of the first image and the second image.
[0036] As an optional implementation manner, the image quality of the first image is determined based on first quality information of the first image, and the image quality of the second image is determined based on second quality information of the second image.
[0037] As an optional implementation, the processor is specifically configured to execute:
[0038] An evaluation value of a secondary target object included in the second image is determined according to difference information between the image qualities of the first image and the second image.
[0039] As an optional implementation manner, the processor is further configured to execute:
[0040] determining at least one shadow reference evaluation value, wherein the shadow reference evaluation value is used to characterize the uniformity of the grayscale distribution of the second image;
[0041] The evaluation value is corrected according to the at least one shadow reference evaluation value to obtain a corrected evaluation value.
[0042] As an optional implementation, the processor is specifically configured to execute:
[0043] performing threshold segmentation on the second image to obtain a secondary target object area and a background area;
[0044] determining a first grayscale feature of the secondary target object area according to the first variance of the secondary target object area, and determining a second grayscale feature of the background area according to the second variance of the background area;
[0045] A corresponding shadow reference evaluation value is determined according to at least one of the first grayscale feature and the second grayscale feature.
[0046] As an optional implementation, the processor is specifically configured to execute:
[0047] determining a segmentation threshold for the second image based on a threshold selection algorithm;
[0048] According to the segmentation threshold, threshold segmentation is performed on the grayscale histogram of the second image to obtain a secondary target object area and a background area, wherein the grayscale histogram is obtained by counting the number of pixels of different grayscale levels in the second image.
[0049] As an optional implementation manner, the processor is specifically configured to determine the first variance in the following manner:
[0050] determining the first variance according to the total number of pixels, the grayscale mean, and the number of pixels corresponding to different grayscale levels in the secondary target object area; and / or,
[0051] The second variance is determined as follows:
[0052] The second variance is determined according to the total number of pixels in the background area, the grayscale mean, and the number of pixels corresponding to different grayscale levels.
[0053] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature, and the processor is specifically configured to execute:
[0054] If the difference in image quality between the first image and the second image is greater than a first threshold, and the first grayscale feature is less than a second threshold, correcting the evaluation value to a first preset value representing a shadow;
[0055] If the difference information between the image quality of the first image and the second image is not greater than a first threshold, and the first grayscale feature is not less than a second threshold, the evaluation value is corrected to a second preset value representing a non-shadow.
[0056] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature and a second grayscale feature, and the processor is specifically configured to execute:
[0057] Using the weights corresponding to the image quality of the second image, the first grayscale feature, and the second grayscale feature, weighted sums are performed on the image quality of the second image, the first grayscale feature, and the second grayscale feature to obtain a corrected evaluation value.
[0058] In a third aspect, an embodiment of the present invention further provides an image shadow evaluation device, the device comprising:
[0059] an acquisition unit, configured to acquire a first area and a second area in the image to be measured, wherein the first area includes a primary target object and the second area includes a secondary target object;
[0060] a determining unit, configured to determine a first image based on difference information between the first area and an overlapping area, and determine a second image based on difference information between the second area and the overlapping area, wherein the overlapping area is determined based on an overlapping area between the first area and the second area;
[0061] An evaluation unit is configured to determine an evaluation value of a secondary target object contained in the second image according to image qualities of the first image and the second image.
[0062] As an optional implementation manner, the image quality of the first image is determined based on first quality information of the first image, and the image quality of the second image is determined based on second quality information of the second image.
[0063] As an optional implementation manner, the evaluation unit is specifically configured to:
[0064] An evaluation value of a secondary target object included in the second image is determined according to difference information between the image qualities of the first image and the second image.
[0065] As an optional implementation manner, the method further includes a correction unit specifically configured to:
[0066] determining at least one shadow reference evaluation value, wherein the shadow reference evaluation value is used to characterize the uniformity of the grayscale distribution of the second image;
[0067] The evaluation value is corrected according to the at least one shadow reference evaluation value to obtain a corrected evaluation value.
[0068] As an optional implementation manner, the correction unit is specifically configured to:
[0069] performing threshold segmentation on the second image to obtain a secondary target object area and a background area;
[0070] determining a first grayscale feature of the secondary target object area according to the first variance of the secondary target object area, and determining a second grayscale feature of the background area according to the second variance of the background area;
[0071] A corresponding shadow reference evaluation value is determined according to at least one of the first grayscale feature and the second grayscale feature.
[0072] As an optional implementation manner, the correction unit is specifically configured to:
[0073] determining a segmentation threshold for the second image based on a threshold selection algorithm;
[0074] According to the segmentation threshold, threshold segmentation is performed on the grayscale histogram of the second image to obtain a secondary target object area and a background area, wherein the grayscale histogram is obtained by counting the number of pixels of different grayscale levels in the second image.
[0075] As an optional implementation manner, the correction unit is specifically configured to determine the first variance in the following manner:
[0076] determining the first variance according to the total number of pixels, the grayscale mean, and the number of pixels corresponding to different grayscale levels in the secondary target object area; and / or,
[0077] The second variance is determined as follows:
[0078] The second variance is determined according to the total number of pixels in the background area, the grayscale mean, and the number of pixels corresponding to different grayscale levels.
[0079] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature, and the correction unit is specifically configured to:
[0080] If the difference in image quality between the first image and the second image is greater than a first threshold, and the first grayscale feature is less than a second threshold, correcting the evaluation value to a first preset value representing a shadow;
[0081] If the difference information between the image quality of the first image and the second image is not greater than a first threshold, and the first grayscale feature is not less than a second threshold, the evaluation value is corrected to a second preset value representing a non-shadow.
[0082] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature and a second grayscale feature, and the correction unit is specifically configured to:
[0083] Using the weights corresponding to the image quality of the second image, the first grayscale feature, and the second grayscale feature, weighted sums are performed on the image quality of the second image, the first grayscale feature, and the second grayscale feature to obtain a corrected evaluation value.
[0084] In a fourth aspect, an embodiment of the present invention further provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, it is used to implement the steps of the method described in the first aspect above.
[0085] These and other aspects of the present application will be more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0087] Figure 1 A flowchart of an implementation method for evaluating image shadows provided by an embodiment of the present invention;
[0088] Figure 2 A schematic diagram of an implementation of determining a first image and a second image provided by an embodiment of the present invention;
[0089] Figure 3 A specific evaluation flow chart of an image shadow provided by an embodiment of the present invention;
[0090] Figure 4 A schematic diagram of an image shadow evaluation device provided by an embodiment of the present invention;
[0091] Figure 5 A schematic diagram of an image shadow evaluation device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0092] To make the objectives, technical solutions, and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings. It is apparent that the embodiments described are only some, not all, of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort are intended to fall within the scope of protection of the present invention.
[0093] In embodiments of the present invention, the term "and / or" describes the association relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0094] The application scenarios described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Persons skilled in the art will appreciate that as new application scenarios emerge, the technical solutions provided by the embodiments of the present invention will also be applicable to similar technical problems. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0095] Example 1. Target detection is a hot topic in computer vision and digital image processing. It is widely used in many fields such as robot navigation, intelligent video surveillance, industrial inspection, aerospace, etc. It has important practical significance to reduce the consumption of human capital through computer vision. Target detection is an important branch of image processing and computer vision disciplines, and is also the core part of intelligent monitoring systems. At the same time, target detection is also a basic algorithm in the field of pan-identity recognition, and plays a vital role in subsequent tasks such as face recognition, gait recognition, crowd counting, and instance segmentation. Target detection is used to find objects of interest to users in an image, including two subtasks: object positioning and object classification. That is, it is necessary not only to classify objects but also to detect their positions. It is usually divided into single target detection and multi-target detection.
[0096] Object detection is performed in three main steps:
[0097] Step 1: Select the region of interest, which is mainly used to select the area that may contain the object;
[0098] Step 2: Extract features of areas that may contain objects;
[0099] Step 3: Detect and classify the extracted features.
[0100] Currently, object detection methods are mainly divided into traditional object detection methods and deep learning-based object detection methods. Traditional object detection methods typically use a sliding window approach: a window is slid across the detection image to sequentially select regions of interest. Feature extraction is performed on each sliding window using algorithms such as the scale-invariant feature transform (SIFT) and histogram of oriented gradients (HOG). Machine learning algorithms, such as support vector machines, are then used to classify the extracted features, ultimately determining whether the window contains a certain object class. However, due to the varying sizes of objects in an image, sliding windows of various sizes are often used, resulting in slower performance. Deep learning-based object detection methods primarily involve two-stage and one-stage approaches. The two-stage approach first generates a region proposal (RP), a preselected box indicating the potential object to be detected, followed by sample classification using a convolutional neural network. The one-stage approach, on the other hand, does not utilize RP and directly extracts features within the network to predict object class and location.
[0101] Shadows, as an optical phenomenon, occur when an object blocks light from passing through an opaque object, creating a darker area. Shadows are extremely common in digital images, so deep learning-based object detection methods often encounter people with shadows. In these cases, the object detection method may not only detect the person, but also misidentify the person's shadow as its companion (i.e., the person), which can affect the performance of subsequent methods. To distinguish between a real person and their shadow, a fast discrimination method is needed that can effectively distinguish between a person and their shadow. Currently, deep learning-based object detection methods often encounter people with shadows when detecting human targets and their companions (companions are other human targets in close proximity to the human target). In these cases, the object detection method may not only detect the person, but also misidentify the person's shadow as its companion (i.e., the person), which can affect the performance of subsequent methods. To distinguish between a real person and their shadow, a fast discrimination method is needed that can effectively distinguish between a person and their shadow.
[0102] An embodiment of the present invention provides an image shadow evaluation method, the core idea of which is to use the non-overlapping parts between the first area containing the main target object and the second area containing the secondary target object, and the corresponding image qualities, respectively, to determine the evaluation value of the secondary target object as a shadow. Since in the specific process of judging the image quality, the overlapping part of the first image containing the main target object and the second area is removed, and the overlapping part of the second image containing the secondary target object and the first area is removed, the interference of the main target object (such as the human body) in the detection of the secondary target object (such as the shadow of the human body) is avoided. The shadow detection method used in this embodiment does not require training of the target detection model, does not require collection of training data, takes a short detection time, has a wide range of applications, and outputs the evaluation value of the shadow. It can more flexibly set different output thresholds according to different needs of users to determine whether the secondary target object is the shadow of the main target object.
[0103] like Figure 1 As shown, an embodiment of the present invention provides an image shadow evaluation method, and the specific implementation process of the method is as follows:
[0104] Step 100: Acquire a first area and a second area in the image to be measured, wherein the first area contains a primary target object and the second area contains a secondary target object;
[0105] In some embodiments, a target detection method may be used to detect a primary target object and a secondary target object in the image to be detected, thereby obtaining a first detection frame and a second detection frame.
[0106] In some embodiments, the priority of the target objects contained in the two image areas is determined by calculating the quality information of the first image area corresponding to the first detection frame and the quality information of the second image area corresponding to the second detection frame.
[0107] Optionally, the quality information includes but is not limited to NIQE scores, that is, the NIQE score of the first image region and the NIQE score of the second image region are calculated to determine the priority of the target objects contained in the two image regions.
[0108] During implementation, if the quality information corresponding to the first image area is greater than the quality information corresponding to the second detection frame, it is determined that the target object contained in the first image area is the primary target object (such as a human body), and the target object contained in the second image area is the secondary target object (such as a shadow); if the quality information corresponding to the first image area is less than or equal to the quality information corresponding to the second detection frame, it is determined that the target object contained in the first image area is the secondary target object, and the target object contained in the second image area is the primary target object.
[0109] During implementation, the image region containing the primary target object is determined as the first region, and the image region containing the secondary target object is determined as the second region. If the quality information corresponding to the first detection frame is higher than the quality information corresponding to the second detection frame, the first image region corresponding to the first detection frame is determined as the first region, and the second image region corresponding to the second detection frame is determined as the second region. If the quality information corresponding to the first detection frame is not higher than the quality information corresponding to the second detection frame, the first image region corresponding to the first detection frame is determined as the second region, and the second image region corresponding to the second detection frame is determined as the first region.
[0110] Step 101: Determine a first image based on difference information between the first area and the overlapping area, and determine a second image based on difference information between the second area and the overlapping area, wherein the overlapping area is determined based on an overlapping area between the first area and the second area;
[0111] It is easy to understand that the first region is an image, which is actually a pixel matrix. The elements in the matrix represent the pixel values of the pixels at the corresponding positions in the image. The first image is determined based on the difference information between the first region and the overlapping region. Optionally, in implementation, the difference between the first region and the overlapping region is determined as the first image, that is, the pixel matrix obtained by the difference between the pixel matrix of the first region and the pixel matrix of the overlapping region is determined as the first image. The first image contains the main target object and does not contain the area overlapping with the second region; similarly, the difference information between the second region and the overlapping region is determined as the second image, wherein the second image contains the secondary target object and does not contain the area overlapping with the first region.
[0112] In specific implementation, Figure 2 As shown, taking the second region R2 located on the left side of the first region R1 as an example, R1 and R2 have an overlapping area 200 on the image, and the coordinates of the upper left corner of the first region R1 in the image to be measured are (x 10 ,y 10 ), the coordinate of the lower right corner of the first region R1 in the image to be tested is (x 20 ,y 20 ); The coordinate of the upper left corner of the second region R2 in the image to be tested is (x 11 ,y 11 ), the coordinate of the lower right corner of the second region R2 in the image to be measured is (x 21 ,y 21 ), so the rectangular area I in R1 that does not overlap with R2 r1 The coordinates of the upper left corner are (x 21 ,y 10 ), the coordinate of the lower right corner is (x 20 ,y 20 ), the rectangular area I in R2 that does not overlap with R1 r2 The coordinates of the upper left corner are (x 11 ,y 11 ), the coordinate of the lower right corner is (x 10 ,y 21 ).
[0113] Step 102: Determine an evaluation value of whether the secondary target object is a shadow based on the image qualities of the first image and the second image.
[0114] In implementation, an evaluation value of whether the secondary target object is the shadow of the primary target object can be determined based on the image quality of the first image and the second image, wherein a smaller evaluation value indicates a greater probability that the secondary target object is the shadow of the primary target object.
[0115] In some embodiments, the image quality of the first image is determined based on first quality information of the first image, and the image quality of the second image is determined based on second quality information of the second image.
[0116] NIQE is a no-reference image quality evaluation algorithm that does not require training using distorted images scored by the human eye. After calculating its local (Mean Subtracted Contrast Normalized, MSCN) normalized image, it selects some image blocks as training data based on local activity, fits the model parameters obtained by generalized Gaussian model as features, and uses a multivariate Gaussian model to describe these features. During the evaluation process, the distance between the model parameters of the image features to be evaluated and the pre-established model parameters is used to determine the image quality. MSCN was proposed in the No-Reference Image Quality Assessment in the Spatial Domain (BRISQUE) algorithm. The MSCN coefficients have characteristic statistical properties that change due to the presence of distortion, and quantifying these changes will make it possible to predict the type of distortion affecting the image and its perceived quality.
[0117] In some embodiments, determining, based on the image qualities of the first image and the second image, an evaluation value of whether the secondary target object is a shadow specifically includes:
[0118] An evaluation value of a secondary target object included in the second image is determined according to difference information between the image qualities of the first image and the second image.
[0119] In practice, a first NIQE score for the first image and a second NIQE score for the second image can be calculated. The evaluation value of the secondary target object contained in the second image can be determined based on the absolute value of the difference between the first NIQE score and the second NIQE score. Specifically, the image quality difference information is determined using the following formula:
[0120] S remain =|S n1 -S n2 | Formula (1);
[0121] Among them, S remain Indicates the difference in image quality, S n1 Indicates the first NIQE score, S n2 Represents the second NIQE score, where the difference information is a calculated value.
[0122] Optionally, if the absolute value of the difference is greater than the first threshold, the evaluation value is determined to be 0, indicating that the current secondary target object is a shadow; if the absolute value of the difference is less than or equal to the first threshold, the evaluation value is determined to be 1, indicating that the current secondary target object is not a shadow.
[0123] Optionally, if the absolute value of the difference is greater than a first threshold, the absolute value of the difference is used as an evaluation value, that is, based on the size of the difference information between the image quality of the first image and the second image, the evaluation value of judging whether the secondary target object in the second image is a shadow is used.
[0124] In some embodiments, this embodiment further provides at least one shadow reference evaluation value for correcting the evaluation value, thereby correcting the evaluation value of the secondary target object determined based on the difference in image quality based on the grayscale distribution uniformity in the second image. The evaluation value can be determined based on three considerations: first, it can be based on the difference in image quality; second, it can be based on the grayscale distribution uniformity of the area where the secondary target object is located in the second image; and finally, it can be based on the grayscale distribution uniformity of the background in the second image. By considering these different aspects, the accuracy of shadow evaluation is improved.
[0125] In implementation, the specific implementation steps for correcting the evaluation value based on at least one shadow reference evaluation value are as follows:
[0126] Step (1) determining at least one shadow reference evaluation value, wherein the shadow reference evaluation value is used to characterize the uniformity of the grayscale distribution of the second image;
[0127] In some embodiments, this embodiment determines a shadow reference evaluation value by the uniformity of the grayscale distribution of the area where the secondary target object is located in the second image, and determines another shadow reference evaluation value by the uniformity of the grayscale distribution of the area where the background is located in the second image. Specifically, at least one shadow reference evaluation value is determined by:
[0128] First, threshold segmentation is performed on the second image to obtain a secondary target object region and a background region; the secondary target object region represents the region in the second image containing the secondary target object, and the background region represents the region in the second image containing the background. In some embodiments, this embodiment determines the segmentation threshold of the second image based on a threshold selection algorithm; alternatively, the segmentation threshold of the second image can be determined based on the OTSU method, and threshold segmentation is performed on the grayscale histogram of the second image based on the segmentation threshold to obtain the secondary target object region and the background region, wherein the grayscale histogram is obtained by counting the number of pixels of different grayscale levels in the second image. In implementation, the grayscale histogram of the second image can be first obtained by counting the number of pixels of different grayscale levels in the second image, and then the grayscale histogram of the second image can be threshold segmented using the segmentation threshold determined by the OTSU method to obtain the secondary target object region and the background region. It should be noted that the region formed by pixels in the second image whose pixel values are lower than the segmentation threshold is determined as the secondary target object region, and the region formed by pixels in the second image whose pixel values are greater than or equal to the segmentation threshold is determined as the background region.
[0129] Among them, the Otsu method (OTSU) is an algorithm for determining the threshold for image binarization segmentation. It is considered the optimal algorithm for threshold selection in image segmentation. It is computationally simple and unaffected by image brightness and contrast, making it widely used in digital image processing. It separates an image into two components, background and foreground, based on its grayscale characteristics. Since variance is a measure of the uniformity of grayscale distribution, a larger inter-class variance between the background and foreground indicates a greater difference between the two components of the image. Misclassification of part of the foreground as background or vice versa results in a smaller difference between the two components. Therefore, the segmentation that maximizes the inter-class variance minimizes the misclassification assessment value. Based on its principle, the Otsu method is also known as the maximum inter-class variance method because the inter-class variance between the foreground and background images is maximized when the threshold value determined by the Otsu method is used for image binarization segmentation.
[0130] In practice, the OTSU method uses a segmentation threshold to divide the image into two parts: foreground (i.e., the secondary target object area) and background (i.e., the background area), and can maximize the variance between the foreground and background. The specific steps of the OTSU algorithm are as follows:
[0131] Step (1) reading the input second image and obtaining a grayscale image of the second image;
[0132] Step (2) calculates the statistical histogram of the grayscale image to obtain a grayscale histogram; for example, assuming that the second image includes 256 grayscale levels, the X-axis corresponding to the grayscale histogram represents 0 to 255 grayscale levels, and the Y-axis represents the number of pixels corresponding to each grayscale level.
[0133] In step (3), t is the initial segmentation threshold of the foreground and background. The ratio of the number of pixels of the foreground to the total number of pixels of the second image is w0, and the average grayscale of the foreground is u0; the ratio of the number of pixels of the background to the total number of pixels of the second image is w1, and the average grayscale of the background is u1.
[0134] Step (4) The total average grayscale of the second image is: u = w0*u0+w1*u1;
[0135] Step (5) calculates the variance of the foreground and background. The variance g can be calculated using the following formula:
[0136] g=w0*(u0-u)*(u0-u)+w1*(u1-u)*(u1-u)=w0*w1*(u0-u1)*(u0-u1) Formula (2);
[0137] Among them, w0 is the ratio of the number of foreground pixels to the total number of pixels in the second image, u0 is the average grayscale of the foreground, w1 is the ratio of the number of background pixels to the total number of pixels in the second image, u1 is the average grayscale of the background, and u is the total average grayscale of the second image.
[0138] Step (6) changes the size of the t value, iteratively calculates the variance of the foreground and background, and determines the t value corresponding to the maximum variance of the foreground and background as the final segmentation threshold.
[0139] Next, a first grayscale feature of the secondary target object region is determined based on the first variance of the secondary target object region, and a second grayscale feature of the background region is determined based on the second variance of the background region. In implementation, the first variance is used as the first grayscale feature, and the second variance is used as the second grayscale feature. This embodiment characterizes grayscale distribution uniformity through the variance of a grayscale histogram. In this embodiment, the secondary target object region is a grayscale histogram, and the background region is also a grayscale histogram. By calculating the first variance and the second variance, respectively, the grayscale distribution uniformity in the secondary target object region and the grayscale distribution uniformity in the background region are determined.
[0140] In some embodiments, the first variance is determined based on the total number of pixels, the grayscale mean, and the number of pixels corresponding to different grayscale levels in the secondary target object area. The first variance is the variance of the secondary target object area, where the pixel values in the secondary target area are all below the segmentation threshold. In implementation, the first variance can be determined using the following formula:
[0141]
[0142] Among them, V t represents the first variance, T OTSU represents the segmentation threshold, l represents the gray level, n l Indicates the number of pixels corresponding to gray level l, N t Indicates that it is lower than T OTSU The total number of pixels, mean t Represents the grayscale mean of the secondary target object area.
[0143] In some embodiments, the second variance is determined based on the total number of pixels in the background area, the grayscale mean, and the number of pixels corresponding to different grayscale levels. The second variance is the variance of the background area, and the pixel values in the background area are all greater than or equal to the segmentation threshold. In implementation, the second variance can be determined using the following formula:
[0144]
[0145] Among them, V b represents the second variance, TOTSU represents the segmentation threshold, l represents the gray level, n l Indicates the number of pixels corresponding to gray level l, N b Indicates greater than or equal to T OTSU The total number of pixels, mean b Represents the grayscale mean of the background area.
[0146] In implementation, the grayscale histogram of the second image can be first segmented into a secondary target object area with pixel values less than the segmentation threshold and a background area with pixel values greater than or equal to the segmentation threshold according to the segmentation threshold, and then the first variance of the secondary target object area is calculated according to formula (3), and the second variance of the background area is calculated according to formula (4).
[0147] An optional implementation is that after obtaining the first variance and the second variance, the first grayscale feature and the second grayscale feature are determined, and the first variance and the second variance can also be normalized to facilitate the subsequent calculation of the shadow reference evaluation value. The normalization process is as follows: if the first variance is greater than a preset normalization value, the first variance is set to 1, and the normalized second variance = (second variance) / preset normalization value. The preset normalization value can be set manually, for example, to 300.
[0148] Finally, a corresponding shadow reference evaluation value is determined based on at least one of the first grayscale feature and the second grayscale feature. In implementation, at least one of the first grayscale feature and the second grayscale feature is determined as the shadow reference evaluation value, i.e., the shadow reference evaluation value includes the first grayscale feature, or the shadow reference evaluation value includes the second grayscale feature, or the shadow reference evaluation value includes the first grayscale feature and the second grayscale feature.
[0149] Step (2) corrects the evaluation value according to the at least one shadow reference evaluation value to obtain a corrected evaluation value.
[0150] In some embodiments, based on different shadow reference evaluation values, the evaluation value is corrected in at least two ways as follows. Specific implementations are as follows:
[0151] Method 1: Correct the shadow reference evaluation value based on the first grayscale feature.
[0152] If the difference information between the image quality of the first image and the second image is greater than a first threshold, and the first grayscale feature is less than a second threshold, the evaluation value is corrected to a first preset value representing the shadow; optionally, if the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image is greater than the first threshold, and the first variance is less than the second threshold, the secondary target object is determined to be a shadow, and the evaluation value can be corrected to 0, indicating that the secondary target object in the current second image is the shadow of the main target object.
[0153] If the difference in image quality between the first image and the second image is no greater than a first threshold, and the first grayscale feature is no less than a second threshold, the evaluation value is corrected to a second preset value indicating a non-shadow. Alternatively, if the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image is less than or equal to the first threshold, and the first variance is greater than or equal to the second threshold, then it is determined that the secondary target object is not a shadow, and the evaluation value may be corrected to 1, indicating that the secondary target object in the current second image is not a shadow of the primary target object, and that the secondary target object is an object different from the primary target object.
[0154] Optionally, the second threshold and the preset normalized value may be the same or different, and this embodiment does not impose any further limitations on this.
[0155] Method 2: Based on the first grayscale feature and the second grayscale feature, the shadow reference evaluation value is corrected.
[0156] Using the weights of the image quality of the second image, the first grayscale feature, and the second grayscale feature, respectively, weighted sums are performed on the image quality of the second image, the first grayscale feature, and the second grayscale feature to obtain a corrected evaluation value.
[0157] In implementation, the second NIQE score, the first variance, and the second variance of the second image may be weightedly summed according to their corresponding weights to obtain a revised evaluation value.
[0158] In some embodiments, the second approach and the first approach can be implemented independently or in combination. If the first approach and the second approach are implemented in combination, the implementation of the second approach requires that any one of the following conditions be met:
[0159] Condition 1: If the difference information between the image quality of the first image and the second image is greater than a first threshold, and the first grayscale feature is greater than or equal to a second threshold.
[0160] The difference information may be the absolute value of the difference in NIQE scores, that is, the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image.
[0161] Optionally, condition 1 specifically includes: if the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image is greater than a first threshold, and the first variance is greater than or equal to a second threshold.
[0162] Condition 2: If the difference information of the image quality between the first image and the second image is less than or equal to a first threshold, and the first grayscale feature is less than a second threshold.
[0163] Optionally, condition 2 specifically includes: if the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image is less than or equal to a first threshold, and the first variance is less than a second threshold.
[0164] When any of the above conditions is met, the evaluation value is determined using method 2.
[0165] Optionally, if any of the above conditions (condition 1 or condition 2) is met, the evaluation value is determined by the following formula:
[0166] S out =a×S n2 +b×V t +c×V b ,a+b+c=1 Formula (5);
[0167] Among them, S out represents the evaluation value, S n2 represents the second NIQE score of the second image, V t represents the first variance, V b represents the second variance, a represents the weight corresponding to the second NIQE score of the second image, b represents the weight corresponding to the first variance, and c represents the weight corresponding to the second variance. For example, a = 0.4, b = 0.3, and c = 0.3 can be set.
[0168] like Figure 3 As shown, this embodiment also provides a specific evaluation process for image shadows, and the specific implementation steps of the process are as follows:
[0169] Step 300: Acquire a first area and a second area in the image to be measured, wherein the first area contains a primary target object and the second area contains a secondary target object;
[0170] Step 301: Determine a first image based on a difference between the first area and the overlapping area, and determine a second image based on a difference between the second area and the overlapping area;
[0171] Step 302: Determine a first NIQE score for the first image and a second NIQE score for the second image.
[0172] Step 303: Calculate the absolute value of the difference between the first NIQE score and the second NIQE score;
[0173] Step 304: Determine a segmentation threshold for the second image based on the OTSU method. Perform threshold segmentation on the grayscale histogram of the second image according to the segmentation threshold to obtain a secondary target object area and a background area.
[0174] Step 305: determine the first variance of the secondary target object area and the second variance of the background area, and perform normalization processing on the first variance and the second variance to obtain normalized first variance and second variance;
[0175] Step 306: Determine an evaluation value that the secondary target object is a shadow based on the absolute value of the difference between the first NIQE score and the second NIQE score, the first variance, the second NIQE score, and the second variance.
[0176] In an implementation, if the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image is greater than a first threshold, and the first variance is less than a second threshold, then determining that the evaluation value is 0 indicates that the secondary target object is a shadow;
[0177] If the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image is less than or equal to the first threshold, and the first variance is greater than or equal to the second threshold, determining that the evaluation value is 1, indicating that the secondary target object is not a shadow;
[0178] If the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image is greater than the first threshold, and the first variance is greater than or equal to the second threshold; or if the absolute value of the difference between the first NIQE score of the first image and the second NIQE score of the second image is less than or equal to the first threshold, and the first variance is less than the second threshold; then the evaluation value is determined by the above formula (5).
[0179] Optionally, the evaluation value in this embodiment ranges from 0 to 1, wherein a smaller evaluation value indicates a higher possibility that the secondary target object is a shadow.
[0180] Example 2: Based on the same inventive concept, the embodiment of the present invention also provides an image shadow evaluation device. Since the device is the device in the method in the embodiment of the present invention, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0181] like Figure 4As shown, the device includes a processor 400 and a memory 401, wherein the memory 401 is used to store a program executable by the processor 400, and the processor 400 is used to read the program in the memory 401 and perform the following steps:
[0182] Acquire a first area and a second area in the image to be measured, wherein the first area contains a primary target object and the second area contains a secondary target object;
[0183] Determine a first image based on difference information between the first area and the overlapping area, and determine a second image based on difference information between the second area and the overlapping area, wherein the overlapping area is determined based on an overlapping area between the first area and the second area;
[0184] An evaluation value of a secondary target object included in the second image is determined according to the image qualities of the first image and the second image.
[0185] As an optional implementation manner, the image quality of the first image is determined based on first quality information of the first image, and the image quality of the second image is determined based on second quality information of the second image.
[0186] As an optional implementation manner, the processor 400 is specifically configured to execute:
[0187] An evaluation value of a secondary target object included in the second image is determined according to difference information between the image qualities of the first image and the second image.
[0188] As an optional implementation manner, the processor 400 is further configured to execute:
[0189] determining at least one shadow reference evaluation value, wherein the shadow reference evaluation value is used to characterize the uniformity of the grayscale distribution of the second image;
[0190] The evaluation value is corrected according to the at least one shadow reference evaluation value to obtain a corrected evaluation value.
[0191] As an optional implementation manner, the processor 400 is specifically configured to execute:
[0192] performing threshold segmentation on the second image to obtain a secondary target object area and a background area;
[0193] determining a first grayscale feature of the secondary target object area according to the first variance of the secondary target object area, and determining a second grayscale feature of the background area according to the second variance of the background area;
[0194] A corresponding shadow reference evaluation value is determined according to at least one of the first grayscale feature and the second grayscale feature.
[0195] As an optional implementation manner, the processor 400 is specifically configured to execute:
[0196] Determining a segmentation threshold of the second image based on the OTSU method;
[0197] According to the segmentation threshold, threshold segmentation is performed on the grayscale histogram of the second image to obtain a secondary target object area and a background area, wherein the grayscale histogram is obtained by counting the number of pixels of different grayscale levels in the second image.
[0198] As an optional implementation manner, the processor 400 is specifically configured to determine the first variance in the following manner:
[0199] determining the first variance according to the total number of pixels, the grayscale mean, and the number of pixels corresponding to different grayscale levels in the secondary target object area; and / or,
[0200] The second variance is determined as follows:
[0201] The second variance is determined according to the total number of pixels in the background area, the grayscale mean, and the number of pixels corresponding to different grayscale levels.
[0202] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature, and the processor 400 is specifically configured to execute:
[0203] If the difference in image quality between the first image and the second image is greater than a first threshold, and the first grayscale feature is less than a second threshold, correcting the evaluation value to a first preset value representing a shadow;
[0204] If the difference information between the image quality of the first image and the second image is not greater than a first threshold, and the first grayscale feature is not less than a second threshold, the evaluation value is corrected to a second preset value representing a non-shadow.
[0205] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature and a second grayscale feature, and the processor 400 is specifically configured to execute:
[0206] Using the weights corresponding to the image quality of the second image, the first grayscale feature, and the second grayscale feature, weighted sums are performed on the image quality of the second image, the first grayscale feature, and the second grayscale feature to obtain a corrected evaluation value.
[0207] Example 3. Based on the same inventive concept, the embodiment of the present invention also provides an image shadow evaluation device. Since the device is the device in the method in the embodiment of the present invention, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0208] like Figure 5 As shown, the device includes:
[0209] An acquisition unit 500 is configured to acquire a first region and a second region in the image to be measured, wherein the first region includes a primary target object and the second region includes a secondary target object;
[0210] a determining unit 501 configured to determine a first image based on difference information between the first area and an overlapping area, and to determine a second image based on difference information between the second area and the overlapping area, wherein the overlapping area is determined based on an overlapping area between the first area and the second area;
[0211] The evaluation unit 502 is configured to determine an evaluation value of a secondary target object included in the second image according to image qualities of the first image and the second image.
[0212] As an optional implementation manner, the image quality of the first image is determined based on first quality information of the first image, and the image quality of the second image is determined based on second quality information of the second image.
[0213] As an optional implementation manner, the evaluation unit 502 is specifically configured to:
[0214] An evaluation value of a secondary target object included in the second image is determined according to difference information between the image qualities of the first image and the second image.
[0215] As an optional implementation manner, the method further includes a correction unit specifically configured to:
[0216] determining at least one shadow reference evaluation value, wherein the shadow reference evaluation value is used to characterize the uniformity of the grayscale distribution of the second image;
[0217] The evaluation value is corrected according to the at least one shadow reference evaluation value to obtain a corrected evaluation value.
[0218] As an optional implementation manner, the correction unit is specifically configured to:
[0219] performing threshold segmentation on the second image to obtain a secondary target object area and a background area;
[0220] determining a first grayscale feature of the secondary target object area according to the first variance of the secondary target object area, and determining a second grayscale feature of the background area according to the second variance of the background area;
[0221] A corresponding shadow reference evaluation value is determined according to at least one of the first grayscale feature and the second grayscale feature.
[0222] As an optional implementation manner, the correction unit is specifically configured to:
[0223] Determining a segmentation threshold of the second image based on the OTSU method;
[0224] According to the segmentation threshold, threshold segmentation is performed on the grayscale histogram of the second image to obtain a secondary target object area and a background area, wherein the grayscale histogram is obtained by counting the number of pixels of different grayscale levels in the second image.
[0225] As an optional implementation manner, the correction unit is specifically configured to determine the first variance in the following manner:
[0226] determining the first variance according to the total number of pixels, the grayscale mean, and the number of pixels corresponding to different grayscale levels in the secondary target object area; and / or,
[0227] The second variance is determined as follows:
[0228] The second variance is determined according to the total number of pixels in the background area, the grayscale mean, and the number of pixels corresponding to different grayscale levels.
[0229] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature, and the correction unit is specifically configured to:
[0230] If the difference in image quality between the first image and the second image is greater than a first threshold, and the first grayscale feature is less than a second threshold, correcting the evaluation value to a first preset value representing a shadow;
[0231] If the difference information between the image quality of the first image and the second image is not greater than a first threshold, and the first grayscale feature is not less than a second threshold, the evaluation value is corrected to a second preset value representing a non-shadow.
[0232] As an optional implementation manner, the shadow reference evaluation value includes a first grayscale feature and a second grayscale feature, and the correction unit is specifically configured to:
[0233] Using the weights corresponding to the image quality of the second image, the first grayscale feature, and the second grayscale feature, weighted sums are performed on the image quality of the second image, the first grayscale feature, and the second grayscale feature to obtain a corrected evaluation value.
[0234] Based on the same inventive concept, an embodiment of the present invention further provides a computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0235] Acquire a first area and a second area in the image to be measured, wherein the first area contains a primary target object and the second area contains a secondary target object;
[0236] Determine a first image based on difference information between the first area and the overlapping area, and determine a second image based on difference information between the second area and the overlapping area, wherein the overlapping area is determined based on an overlapping area between the first area and the second area;
[0237] An evaluation value of a secondary target object included in the second image is determined according to the image qualities of the first image and the second image.
[0238] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.
[0239] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that performs the functions specified in one or more boxes.
[0240] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0241] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0242] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A method for evaluating image shadows, characterized in that: The method includes: Acquire a first area and a second area in the image to be measured, wherein the first area contains a primary target object and the second area contains a secondary target object; Determine a first image based on difference information between the first area and the overlapping area, and determine a second image based on difference information between the second area and the overlapping area, wherein the overlapping area is determined based on an overlapping area between the first area and the second area; Determining an evaluation value of whether the secondary target object is a shadow based on the image qualities of the first image and the second image, including: determining an evaluation value of whether the secondary target object is a shadow based on difference information of the image qualities of the first image and the second image; wherein if the difference information is greater than a first threshold, it indicates that the current secondary target object is a shadow; and if the difference information is less than or equal to the first threshold, it indicates that the current secondary target object is not a shadow.
2. The method according to claim 1, characterized in that The image quality of the first image is determined based on first quality information of the first image, and the image quality of the second image is determined based on second quality information of the second image.
3. The method according to claim 1 or 2, characterized in that The method further includes: determining at least one shadow reference evaluation value, wherein the shadow reference evaluation value is used to characterize the uniformity of the grayscale distribution of the second image; The evaluation value is corrected according to the at least one shadow reference evaluation value to obtain a corrected evaluation value.
4. The method according to claim 3, characterized in that The determining of at least one shadow reference evaluation value comprises: performing threshold segmentation on the second image to obtain a secondary target object area and a background area; determining a first grayscale feature of the secondary target object area according to the first variance of the secondary target object area, and determining a second grayscale feature of the background area according to the second variance of the background area; A corresponding shadow reference evaluation value is determined according to at least one of the first grayscale feature and the second grayscale feature.
5. The method according to claim 4, characterized in that The performing threshold segmentation on the second image to obtain a secondary target object area and a background area includes: determining a segmentation threshold for the second image based on a threshold selection algorithm; According to the segmentation threshold, threshold segmentation is performed on the grayscale histogram of the second image to obtain a secondary target object area and a background area, wherein the grayscale histogram is obtained by counting the number of pixels of different grayscale levels in the second image.
6. The method according to claim 4, characterized in that The first variance is determined as follows: The first variance is determined according to the total number of pixels, the grayscale mean, and the number of pixels corresponding to different grayscale levels in the secondary target object area.
7. The method according to claim 4, characterized in that The second variance is determined as follows: The second variance is determined according to the total number of pixels in the background area, the grayscale mean, and the number of pixels corresponding to different grayscale levels.
8. The method according to claim 3, characterized in that The shadow reference evaluation value includes a first grayscale feature, and the correcting the evaluation value according to the at least one shadow reference evaluation value to obtain a corrected evaluation value includes: If the difference in image quality between the first image and the second image is greater than a first threshold, and the first grayscale feature is less than a second threshold, correcting the evaluation value to a first preset value representing a shadow; If the difference information between the image quality of the first image and the second image is not greater than a first threshold, and the first grayscale feature is not less than a second threshold, the evaluation value is corrected to a second preset value representing a non-shadow.
9. The method according to claim 3, characterized in that The shadow reference evaluation value includes a first grayscale feature and a second grayscale feature, and the correcting the evaluation value according to the at least one shadow reference evaluation value to obtain a corrected evaluation value includes: Using the weights corresponding to the image quality of the second image, the first grayscale feature, and the second grayscale feature, weighted sums are performed on the image quality of the second image, the first grayscale feature, and the second grayscale feature to obtain a corrected evaluation value.
10. An image shadow evaluation device, characterized in that: The device includes a processor and a memory, wherein the memory is used to store a program executable by the processor, and the processor is used to read the program in the memory and execute the steps of any one of the methods of claims 1 to 9.
11. A computer storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Shadow detection and removal algorithm based on image segmentation
CN104463853A
Object detection device, object detection method, and object detection program
JP2020030751A