CN-120599374-B - Object classification method, device, medium and equipment based on image processing
Abstract
The application provides a target object classification method, a device, a medium and equipment based on image processing, which relate to the technical field of image processing and comprise the steps of obtaining an image of a target object to be processed; according to the sliding window of b pixels and b pixels, the image of the object to be processed is transversely and longitudinally sliding segmented according to the step length of c pixels to obtain a plurality of pixel blocks to be processed, LBP processing is carried out on each pixel block to be processed to obtain a texture feature vector T of the object, and the T is input into an object classification model to obtain a classification result. The method can judge according to more accurate characteristic information, thereby greatly improving the accuracy of distinguishing good fruits from bad fruits of the water chestnut and meeting the actual requirements of water chestnut quality detection.
Inventors
- PENG DA
- ZHANG JIANXIONG
- ZHANG HAO
- Fan Duanyang
- ZHANG XINSHI
Assignees
- 湖北天井湖农业科技服务有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20250707
Claims (6)
- 1. An image processing-based object classification method, the method comprising: S100, acquiring an image of a target object to be processed, wherein the size of the image of the target object to be processed is a pixels multiplied by a pixels; s200, according to a sliding window of b pixels and b pixels, transversely and longitudinally sliding and blocking an image of a target object to be processed according to the step length of c pixels to obtain a plurality of pixel blocks to be processed, wherein b is smaller than a; S300, performing LBP processing on each pixel block to be processed to obtain a target texture feature vector t= (T 1 ,T 2 ,…,T i ,…,T n ), i=1, 2..n, where n is the number of pixel blocks to be processed, n=a/b, T i is the texture feature corresponding to the ith pixel block to be processed, each pixel point in each pixel block to be processed has a corresponding LBP value, T i =(T i,1 ,T i,2 ,…,T i,j ,…,T i,m ) j=1, 2..m, m is the number of available LBP values of each pixel point in the pixel block to be processed, T i,j is the number of pixel points corresponding to available LBP values of the j-th pixel block to be processed, and step S300 includes: S310, performing Fourier transform on each pixel block to be processed to obtain a high-frequency component duty ratio list G= (G 1 ,G 2 ,…,G i ,…,G n ), wherein G i is the duty ratio of the high-frequency component after performing Fourier transform on the image corresponding to the ith pixel block to be processed, and the duty ratio of the high-frequency component is the ratio of the energy of a high-frequency region to the total energy; S320, if G i is larger than a preset high-frequency component duty ratio threshold, obtaining an LBP value of each pixel point in G i according to the first neighborhood radius; S330, obtaining the number of pixel points corresponding to the available value of each LBP value obtained according to the first neighborhood radius to obtain T= (T 1 ,T 2 ,…,T i ,…,T n ); S340, if G i is equal to or smaller than a preset high-frequency component duty ratio threshold, obtaining an LBP value of each pixel point in G i according to a second neighborhood radius, wherein the number of sampling points corresponding to the second neighborhood radius is larger than that of sampling points corresponding to the first neighborhood radius; S350, obtaining the number of pixel points corresponding to the available value of each LBP value obtained according to the second neighborhood radius to obtain T= (T 1 ,T 2 ,…,T i ,…,T n ); S400, inputting T into a target object classification model to obtain a classification result, wherein the classification result is that a target object in a target object image to be processed is good or that the target object in the target object image to be processed is bad.
- 2. The image processing-based object classification method according to claim 1, wherein the object classification model includes a first object classification model and a second object classification model, wherein the first object classification model is adapted to obtain an object texture feature vector according to a first neighborhood, the second object classification model is adapted to obtain an object texture feature vector according to a second neighborhood, and step S400 includes: S410, inputting T into the first target classification model or the second target classification model to obtain a classification result, wherein if T is obtained according to the first neighborhood, T is input into the first target classification model, and if T is obtained according to the second neighborhood, T is input into the second target classification model.
- 3. The method according to claim 2, wherein the classification result obtained according to the object classification model has a corresponding first confidence coefficient YZ, YZ >50%, and after step S400, the method further comprises: S500, obtaining a target shadow proportion P in a target image to be processed, wherein P meets the following conditions of P=S Yin type vagina /S Finishing the whole , S Yin type vagina is the number of pixel points contained in the target shadow in the target image to be processed, S Finishing the whole is the number of pixel points contained in the target to be processed in the target image to be processed; S600, obtaining a second confidence coefficient EZ corresponding to P according to the P and a preset shadow proportion mapping table, wherein the preset shadow proportion mapping table comprises a plurality of shadow proportions and the second confidence coefficient corresponding to each shadow proportion, EZ E [0,1]; And S700, obtaining an updated classification result according to YZ and EZ, wherein if the confidence coefficient SZ of the updated classification result is larger than a preset confidence coefficient threshold value, the updated classification result is the same as the classification result obtained by the object classification model, and SZ=YZ×EZ.
- 4. An image processing-based object classification apparatus, the apparatus comprising: The image acquisition unit is used for acquiring an image of a target object to be processed, wherein the size of the image of the target object to be processed is a pixels multiplied by a pixels; the block dividing unit is used for transversely and longitudinally sliding and dividing the image of the object to be processed according to the sliding window of b pixels and b pixels by the step length of c pixels to obtain a plurality of pixel blocks to be processed, wherein b is smaller than a; The processing unit is configured to perform LBP processing on each pixel block to be processed to obtain a target texture feature vector t= (T 1 ,T 2 ,…,T i ,…,T n ), i=1, 2..n, where n is the number of pixel blocks to be processed, n=a/b, T i is a texture feature corresponding to the i th pixel block to be processed, each pixel point in each pixel block to be processed has a corresponding LBP value, T i =(T i,1 ,T i,2 ,…,T i,j ,…,T i,m ) j=1, 2..m, m is the number of available values of the LBP value of each pixel point in the pixel block to be processed, T i,j is the number of pixel points corresponding to the available value of the j th LBP value in the i th pixel block to be processed, and performing LBP processing on each pixel block to obtain the target texture feature vector t= (T 1 ,T 2 ,…,T i ,…,T n ) includes: S310, performing Fourier transform on each pixel block to be processed to obtain a high-frequency component duty ratio list G= (G 1 ,G 2 ,…,G i ,…,G n ), wherein G i is the duty ratio of the high-frequency component after performing Fourier transform on the image corresponding to the ith pixel block to be processed, and the duty ratio of the high-frequency component is the ratio of the energy of a high-frequency region to the total energy; S320, if G i is larger than a preset high-frequency component duty ratio threshold, obtaining an LBP value of each pixel point in G i according to the first neighborhood radius; S330, obtaining the number of pixel points corresponding to the available value of each LBP value obtained according to the first neighborhood radius to obtain T= (T 1 ,T 2 ,…,T i ,…,T n ); S340, if G i is equal to or smaller than a preset high-frequency component duty ratio threshold, obtaining an LBP value of each pixel point in G i according to a second neighborhood radius, wherein the number of sampling points corresponding to the second neighborhood radius is larger than that of sampling points corresponding to the first neighborhood radius; S350, obtaining the number of pixel points corresponding to the available value of each LBP value obtained according to the second neighborhood radius to obtain T= (T 1 ,T 2 ,…,T i ,…,T n ); The classification unit is used for inputting T into the target object classification model to obtain a classification result, wherein the classification result is that the target object in the target object image to be processed is a good fruit or the target object in the target object image to be processed is a bad fruit.
- 5. A non-transitory computer readable storage medium having stored therein at least one instruction or at least one program loaded and executed by a processor to implement the image processing-based object classification method according to any one of claims 1-3.
- 6. An electronic device comprising a processor and the non-transitory computer readable storage medium of claim 5.
Description
Object classification method, device, medium and equipment based on image processing Technical Field The present application relates to the field of image processing, and in particular, to a method, an apparatus, a medium, and a device for classifying objects based on image processing. Background In the field of quality detection and sorting of water chestnuts, the method for quickly and accurately distinguishing good fruits and good fruits has important significance for improving product quality and reducing labor cost. At present, most of mainstream water chestnut good and bad fruit distinguishing methods are based on an image color analysis technology, color features of images are extracted by collecting water chestnut images and utilizing an image processing algorithm, and then the water chestnut quality is judged. However, this method has significant technical drawbacks. Firstly, the image acquisition process is extremely easy to be influenced by external environmental factors, such as illumination intensity, shooting angle, environment reflection and the like, and the factors can cause the acquired water chestnut image to deviate in color, so that a larger error occurs in the good and bad fruit judgment result based on the color characteristics. Second, the quality defects of water chestnut often exhibit localized, miniaturized features, such as localized mildew, insect damage, and the like. The existing global analysis method based on color can only acquire the overall color distribution information of the water chestnuts, cannot accurately capture the local fine features, and causes that partial water chestnuts with local defects are misjudged as good fruits, so that the sorting accuracy and the product quality are seriously affected. Therefore, a technology for distinguishing good and bad fruits capable of overcoming the interference of external environment and accurately identifying the local fine features of the water chestnut is needed, so as to meet the actual requirements of water chestnut quality detection. Disclosure of Invention Aiming at the technical problems, the application provides a target object classification method, device, medium and equipment based on image processing, which at least partially solve the problems existing in the prior art. In a first aspect of the present application, there is provided an object classification method based on image processing, the method comprising: S100, acquiring an image of a target object to be processed, wherein the size of the image of the target object to be processed is a pixels multiplied by a pixels. S200, according to a sliding window of b pixels and b pixels, performing horizontal and vertical sliding blocking on the image of the object to be processed according to the step length of c pixels to obtain a plurality of pixel blocks to be processed, wherein b is smaller than a. And S300, performing LBP processing on each pixel block to be processed to obtain a target texture feature vector T= (T 1,T2,…,Ti,…,Tn), wherein i=1, 2, & gt, n is the number of the pixel blocks to be processed, n=a/b, T i is the texture feature corresponding to the ith pixel block to be processed, each pixel point in each pixel block to be processed has a corresponding LBP value, T i=(Ti,1,Ti,2,…,Ti,j,…,Ti,m) j=1, 2, & gt, m is the number of the LBP values of each pixel point in the pixel block to be processed, and T i,j is the number of the pixel points corresponding to the j LBP values of the ith pixel block to be processed. S400, inputting T into a target object classification model to obtain a classification result, wherein the classification result is that a target object in a target object image to be processed is good or that the target object in the target object image to be processed is bad. In a second aspect of the present application, there is provided an object classification apparatus based on image processing, the apparatus comprising: And the image acquisition unit is used for acquiring an image of the object to be processed, wherein the size of the image of the object to be processed is a pixels multiplied by a pixels. And the block dividing unit is used for transversely and longitudinally sliding and dividing the image of the object to be processed according to the sliding window of b pixels and b pixels by the step length of c pixels so as to obtain a plurality of pixel blocks to be processed, wherein b is smaller than a. The processing unit is used for performing LBP processing on each pixel block to be processed to obtain a target texture feature vector T= (T 1,T2,…,Ti,…,Tn), i=1, 2, and n, wherein n is the number of the pixel blocks to be processed, n=a/b, T i is texture features corresponding to the ith pixel block to be processed, each pixel point in each pixel block to be processed has a corresponding LBP value, T i=(Ti,1,Ti,2,…,Ti,j,…,Ti,m) j=1, 2, and m, m is the number of available LBP values of each pixel point in the pixel block to be