A clustering-based processing method for tobacco field images

By calculating the minimum circumcircle radius and pixel ratio of vector surface patches, the k-means algorithm is used for clustering to identify and delete non-tobacco plant patches, thus solving the problem of inaccurate tobacco plant count in tobacco field images and improving the accuracy of tobacco plant count acquisition.

CN118840576BActive Publication Date: 2026-08-25BEIJING XIANGTIAN INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411176729.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2026-08-25
Estimated Expiration
2044-08-26

AI Technical Summary

Technical Problem

Existing technologies for obtaining the number of tobacco plants in tobacco field images suffer from inaccurate counts due to the presence of a small number of other plants besides tobacco plants in the target tobacco field image.

Method used

By acquiring the vector surface map of the target tobacco field image, the radius of the minimum circumcircle and the pixel ratio of each vector surface patch are calculated. The k-means algorithm is then used to cluster the vector surface patches, identifying the tobacco plant class as the class with high similarity to the preset values. Vector surface patches that are not tobacco plant classes are then deleted to obtain the denoised vector surface map.

Benefits of technology

It improves the accuracy of tobacco plant count acquisition, reduces the impact of non-tobacco plants on tobacco plant count, and enhances the precision of tobacco field image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118840576B_ABST
    Figure CN118840576B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image processing, in particular to a tobacco field image processing method based on clustering. The method comprises the following steps: acquiring a vector surface graph corresponding to a target tobacco field image; clustering vector surface graph patches in the vector surface graph according to the radius of the minimum circumscribed circle of each vector surface graph patch in the vector surface graph and the pixel proportion; if the similarity between the center vector surface graph patch of the class with the largest number of vector surface graph patches and a preset vector surface graph patch is greater than or equal to a preset similarity threshold, performing denoising processing on the vector surface graph according to a specified vector surface graph patch in the vector surface graph to obtain a denoised vector surface graph; the specified vector surface graph patch is a vector surface graph patch in the class with the number of vector surface graph patches being not the largest; the denoising processing comprises deleting the specified vector surface graph patch in the vector surface graph; and acquiring the number of tobacco plants in the denoised vector surface graph. The application can solve the problem that the number of tobacco plants in the acquired tobacco field image is inaccurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a clustering-based method for processing tobacco field images. Background Technology

[0002] Existing technologies disclose methods for obtaining the number of tobacco plants based on captured tobacco field images. For example, Chinese Patent Application No. CN202311295114.9 discloses a clustering-based method for processing tobacco field images. This method first obtains a sequence of vector surface patches corresponding to the target tobacco field image, then analyzes the number of tobacco plants included in each vector surface patch, and finally obtains the number of tobacco plants in the tobacco field image by summing the number of tobacco plants included in all vector surface patches. This method is suitable for situations where every vector surface patch in the target tobacco field image is a tobacco plant vector surface patch. However, when the target tobacco field image includes a small number of other plants besides tobacco plants, the aforementioned vector surface patches may not all be tobacco plant vector surface patches, leading to inaccurate tobacco plant counts in the obtained tobacco field image. Summary of the Invention

[0003] The purpose of this invention is to provide a clustering-based method for processing tobacco field images to solve the problem of inaccurate tobacco plant counts in the obtained tobacco field images.

[0004] According to the present invention, a clustering-based method for processing tobacco field images is provided, the method comprising the following steps: S100, Obtain the vector surface map corresponding to the target tobacco field image; the vector surface map includes several vector surface patches.

[0005] S200, obtains the radius of the smallest circumcircle of each vector surface patch in the vector surface map.

[0006] S300, obtain the pixel percentage of each vector surface patch in the vector surface map; the pixel percentage of any vector surface patch is the ratio of the number of pixels included in the vector surface patch to the number of pixels included in the smallest circumcircle of the vector surface patch.

[0007] S400 clusters the vector surface patches in the vector surface image based on the radius of the smallest circumcircle of each vector surface patch and the pixel ratio.

[0008] S500, if the similarity between the central vector surface patch of the class containing the most vector surface patches and the preset vector surface patch is greater than or equal to the preset similarity threshold, then proceed to S600; wherein, the radius of the minimum circumscribed circle of the central vector surface patch of the class containing the most vector surface patches is the average radius of the minimum circumscribed circle of the vector surface patches in the class containing the most vector surface patches, and the pixel ratio of the central vector surface patch of the class containing the most vector surface patches is the average radius pixel ratio of the vector surface patches in the class containing the most vector surface patches; the preset vector surface patch is a preset tobacco plant vector surface patch that matches the growth stage of the tobacco plant corresponding to the target tobacco field image.

[0009] S600, the vector surface map is denoised according to a specified vector surface patch in the vector surface map to obtain a denoised vector surface map; the specified vector surface patch is a vector surface patch in a class that does not have the largest number of vector surface patches; the denoising process includes deleting the specified vector surface patch in the vector surface map.

[0010] S700, obtain the number of tobacco plants in the denoised vector surface image.

[0011] Compared with the prior art, the present invention has at least the following beneficial effects: This invention, based on obtaining the vector surface image corresponding to the target tobacco field image, also obtains the radius of the minimum circumscribed circle and the pixel ratio of each vector surface patch in the vector surface image. Since the radius of the minimum circumscribed circle and the pixel ratio of different vector surface patches in the vector surface image are different, this invention clusters the vector surface patches in the vector surface image. Vector surface patches in the same cluster have similar radii of the minimum circumscribed circle and pixel ratios, while vector surface patches in different clusters have significantly different radii and / or pixel ratios. If the clustering result includes the cluster with the largest number of vector surface patches and has a high similarity to a preset vector surface patch, then the cluster with the largest number of vector surface patches is determined to be the cluster corresponding to tobacco plants, and the cluster with a smaller number of vector surface patches is determined to be the cluster corresponding to non-tobacco plants. Based on this, this invention deletes the vector surface patches included in the cluster corresponding to non-tobacco plants in the vector surface image, obtaining a denoised vector surface image. This invention uses the denoised vector surface image as the image for obtaining the number of tobacco plants, which can reduce the influence of non-tobacco plants on the obtained number of tobacco plants, and is beneficial to improving the accuracy of the number of tobacco plants in the obtained target tobacco field image. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 A flowchart illustrating a clustering-based tobacco field image processing method provided in an embodiment of the present invention. Detailed Implementation

[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0015] According to this embodiment, as Figure 1 As shown, a clustering-based method for processing tobacco field images is provided, the method comprising the following steps: S100, Obtain the vector surface map corresponding to the target tobacco field image; the vector surface map includes several vector surface patches.

[0016] In this embodiment, there is no overlap of tobacco plant leaves between different tobacco plants in the target tobacco field image. That is, the target tobacco field image was taken at an early stage, such as the root elongation stage. Therefore, the vector area patches corresponding to different tobacco plants are relatively independent. The processing method of this embodiment is more suitable for situations where other plants besides tobacco plants account for a small proportion of the tobacco field, are relatively far away from the tobacco plants (i.e., the leaves do not overlap), and the appearance of other plants differs greatly from that of the tobacco plants. The appearance differences include differences in plant size, leaf shape, and leaf density.

[0017] Those skilled in the art will understand that any method in the prior art for obtaining a vector surface map corresponding to a target tobacco field image falls within the protection scope of this invention; as a specific embodiment, S100 includes: S110, Obtain the saturation band map corresponding to the target tobacco field image.

[0018] In this embodiment, the target tobacco field image is a visible light image. Those skilled in the art will understand that any existing method for obtaining the saturation band map corresponding to a visible light image falls within the protection scope of this invention.

[0019] S120, update the saturation of pixels in the saturation band image whose saturation is less than the preset saturation threshold to empty, and obtain the updated saturation band image.

[0020] In this embodiment, the initial saturation threshold is an empirical value. If the saturation of a pixel in the saturation band image is greater than or equal to the preset saturation threshold, the saturation of that pixel will not be updated; otherwise, the saturation of that pixel will be updated to null (nodata).

[0021] S130, perform raster-to-vector surface processing on the updated saturation band map to obtain a vector surface map.

[0022] Those skilled in the art will understand that any existing method for converting a raster to a vector surface falls within the protection scope of this invention.

[0023] Based on S110-S130, a vector surface map corresponding to the target tobacco field image can be obtained. This vector surface map includes several vector surface patches, any of which can be a tobacco plant vector surface patch or a non-tobacco plant vector surface patch.

[0024] S200, obtains the radius of the smallest circumcircle of each vector surface patch in the vector surface map.

[0025] In this embodiment, the minimum circumcircle radius of the vector surface patch corresponding to plants of different sizes in the target tobacco field image is different, and the minimum circumcircle radius of the vector surface patch corresponding to larger plants is larger.

[0026] Those skilled in the art will understand that any method for obtaining the smallest circumcircle in the prior art falls within the protection scope of this invention.

[0027] S300, obtain the pixel percentage of each vector surface patch in the vector surface map; the pixel percentage of any vector surface patch is the ratio of the number of pixels included in the vector surface patch to the number of pixels included in the smallest circumcircle of the vector surface patch.

[0028] In this embodiment, the pixel proportion of vector surface patches corresponding to plants with different leaf shapes and leaf density in the target tobacco field image is different, and the pixel proportion of vector surface patches corresponding to plants with wider leaf shapes and denser leaves is larger.

[0029] S400 clusters the vector surface patches in the vector surface image based on the radius of the smallest circumcircle of each vector surface patch and the pixel ratio.

[0030] In this embodiment, the minimum circumcircle radius and pixel percentage of vector surface patches of different plant species in the target tobacco field image differ significantly, while the minimum circumcircle radius and pixel percentage of vector surface patches of the same plant species differ less. The distance between vector surface patches within the same cluster is small, meaning the differences in the minimum circumcircle radius and pixel percentage are both small. Conversely, the distance between vector surface patches in different clusters is large, meaning the differences in the minimum circumcircle radius and / or pixel percentage are significant. As a preferred embodiment, the k-means algorithm is used to cluster the vector surface patches in the vector surface image. S400 includes: S410. Use the k-means algorithm to cluster the vector patches in the vector surface map into two categories, namely the first initial category and the second initial category. During the clustering process, the distance between the first vector patch and the second vector patch is positively correlated with the difference value between the radius of the minimum circumscribed circle of the first vector patch and the second vector patch, and the distance between the first vector patch and the second vector patch is positively correlated with the difference value of the pixel proportion of the first vector patch and the second vector patch. The first vector patch is any vector patch in the vector surface map, and the second vector patch is any vector patch in the vector surface other than the first vector patch.

[0031] In this embodiment, each vector patch is used as an object to be clustered. One vector patch is an object. The x coordinate of each vector patch is the radius of the minimum circumscribed circle of the corresponding vector patch, and the y coordinate of each vector patch is the pixel proportion of the corresponding vector patch. As a preferred specific implementation manner, the distance between the first vector patch and the second vector patch is dis 1,2 = w1×f(|r1 - r2|)+(1 - w1)×g(|c1 - c2|), where r1 and r2 are the radii of the minimum circumscribed circles of the first vector patch and the second vector patch respectively, f( ) is the normalization process corresponding to the radius of the minimum circumscribed circle, c1 and c2 are the pixel proportions of the first vector patch and the second vector patch respectively, g( ) is the normalization process corresponding to the pixel proportion, and w1 is a preset weight value, 0 < w1 < 1. The method for obtaining the distance between any two vector patches is similar to the method for obtaining the distance between the first vector patch and the second vector patch described above, and will not be elaborated here.

[0032] As a preferred specific implementation manner, the process of obtaining w1 includes: S411. Obtain a sample tobacco field image set. The sample tobacco field image set includes several sample tobacco field images, and the growth stage of the tobacco plants corresponding to each sample tobacco field image is the same as that of the target tobacco field image.

[0033] In this embodiment, if the growth stage of the tobacco plants corresponding to the target tobacco field image is the 5th day of the root elongation stage, the growth stage of the tobacco plants corresponding to each sample tobacco field image is also the 5th day of the root elongation stage; if the growth stage of the tobacco plants corresponding to the target tobacco field image is the 8th day of the root elongation stage, the growth stage of the tobacco plants corresponding to each sample tobacco field image is also the 8th day of the root elongation stage.

[0034] In this embodiment, the scaling ratio of each sample tobacco field image is the same as that of the target tobacco field image.

[0035] S412. Obtain the tobacco plant vector patches and non-tobacco plant vector patches in the vector surface map corresponding to each sample tobacco field image in the sample tobacco field image set.

[0036] In this embodiment, the method for obtaining the vector surface map corresponding to each sample tobacco field image is similar to the method for obtaining the vector surface map corresponding to the target tobacco field image described above, and will not be repeated here.

[0037] Optionally, the vector surface patches of tobacco plants and those of non-tobacco plants can be distinguished manually.

[0038] S413, obtain the distance between any two tobacco plant vector surface patches in the vector surface image corresponding to each sample tobacco field image, and construct a first distance set between tobacco plants; the first distance set includes the distance between any two tobacco plant vector surface patches in the vector surface image corresponding to each sample tobacco field image, the distance between any two tobacco plant vector surface patches is the sum of the first difference value and the second difference value of the corresponding two tobacco plant vector surface patches, the first difference value is the product of the first variable w0 and r', r' is the difference value of the radius of the normalized minimum circumcircle, and the second difference value is the product of (1-w0) and c', c' is the difference value of the normalized pixel proportion.

[0039] In this embodiment, the radius difference is the absolute value of the radius difference, and the pixel ratio difference is the absolute value of the pixel ratio difference.

[0040] In this embodiment, for each sample tobacco field image corresponding to a vector surface map, the distance between any two tobacco plant vector surface patches in the vector surface map is obtained and appended to the first empty set. Thus, a first distance set can be obtained, which includes the distance between any two tobacco plant vector surface patches in the vector surface maps corresponding to all sample tobacco field images.

[0041] Those skilled in the art will understand that any normalization method in the prior art falls within the protection scope of this invention.

[0042] S414, obtain the distance between any tobacco plant vector surface patch and any non-tobacco plant vector surface patch in the vector surface map corresponding to each sample tobacco field image, and construct a second distance set between tobacco plants and non-tobacco plants; the second distance set includes the distance between any tobacco plant vector surface patch and any non-tobacco plant vector surface patch in the vector surface map corresponding to each sample tobacco field image, and the distance between any tobacco plant vector surface patch and any non-tobacco plant vector surface patch is the sum of the first difference value and the second difference value of the corresponding tobacco plant vector surface patch and non-tobacco plant vector surface patch.

[0043] In this embodiment, for each sample tobacco field image corresponding to a vector surface map, the distance between any tobacco plant vector surface patch and any non-tobacco plant vector surface patch in the vector surface map is obtained and appended to the second empty set. Thus, a second distance set can be obtained, which includes the distance between any tobacco plant vector surface patch and any non-tobacco plant vector surface patch in the vector surface maps corresponding to all sample tobacco field images.

[0044] S415, Under the premise of satisfying preset conditions, obtain w0 that maximizes the difference between the mean distance of the second distance set and the mean distance of the first distance set; the preset conditions include: each distance in the first distance set is greater than or equal to 0 and less than or equal to 1, each distance in the second distance set is greater than or equal to 0 and less than or equal to 1, 0 <w0<1。

[0045] Those skilled in the art will understand that any method for obtaining the optimal solution in the prior art falls within the protection scope of this invention. Optionally, the range of values ​​of w0 that satisfies preset conditions is first obtained, and then w0 within the range of values ​​that maximizes the difference between the mean distance of the second distance set and the mean distance of the first distance set is obtained.

[0046] S416, the w0 that maximizes the difference between the mean distance of the second distance set and the mean distance of the first distance set is determined as w1.

[0047] The w1 obtained based on S411-S416 can reduce the distance between tobacco plant vector surface patches and increase the distance between tobacco plant vector surface patches and non-tobacco plant vector surface patches, which is beneficial for classifying tobacco plant vector surface patches into one class and classifying non-tobacco plant vector surface patches and tobacco plant vector surface patches into different classes.

[0048] S420, if the variance of the vector surface patch in the first initial class is greater than a preset variance threshold and the variance of the vector surface patch in the second initial class is less than or equal to the preset variance threshold, then proceed to S430.

[0049] In this embodiment, if the variance of the vector surface patches in the first initial class is less than or equal to a preset variance threshold and the variance of the vector surface patches in the second initial class is less than or equal to a preset variance threshold, then the distance between the center vector surface patch of the first initial class and the center vector surface patch of the second initial class is determined. If the distance is greater than or equal to a preset distance threshold, then the first initial class and the second initial class are determined as the final result of clustering the vector surface patches in the vector surface image using the k-means algorithm; if the distance is less than the preset distance threshold, then the class formed by all vector surface patches in the vector surface image is determined as the final result of clustering the vector surface patches in the vector surface image using the k-means algorithm, i.e., there is only one class. For the case where the class formed by all vector surface patches in the vector surface image is determined as the final result of clustering the vector surface patches in the vector surface image using the k-means algorithm, S500 and S600 are no longer executed, and S700 is executed instead.

[0050] In this embodiment, the preset variance threshold is an empirical value. If the variance of the vector surface patches in the first initial class is greater than the preset variance threshold, it is determined that the difference between the radius of the minimum circumcircle of the vector surface patches in the first initial class and the pixel ratio is large; if the variance of the vector surface patches in the first initial class is less than or equal to the preset variance threshold, it is determined that the difference between the radius of the minimum circumcircle of the vector surface patches in the first initial class and the pixel ratio is small. As a specific implementation, S420 includes: S421, obtain the center vector surface patch of the first initial class; the radius of the minimum circumscribed circle of the center vector surface patch of the first initial class is the average radius of the minimum circumscribed circle of the vector surface patches in the first initial class, and the pixel ratio of the center vector surface patch of the first initial class is the average pixel ratio of the vector surface patches in the first initial class.

[0051] S422, obtain the difference value between each vector surface patch in the first initial class and the center vector surface patch of the first initial class; the difference value between any vector surface patch in the first initial class and the center vector surface patch of the first initial class is positively correlated with the difference value between the radius of the vector surface patch in the first initial class and the center vector surface patch of the first initial class, and the difference value between any vector surface patch in the first initial class and the center vector surface patch of the first initial class is positively correlated with the difference value between the pixel ratio of the vector surface patch in the first initial class and the center vector surface patch of the first initial class.

[0052] In this embodiment, the method for obtaining the difference value between each vector surface patch in the first initial class and the center vector surface patch of the first initial class is similar to the method for obtaining the distance between the first vector surface patch and the second vector surface patch, and will not be repeated here.

[0053] S423, obtain the variance of the vector surface patch in the first initial class based on the difference value between each vector surface patch in the first initial class and the center vector surface patch of the first initial class.

[0054] In this embodiment, the sum of squares of the differences between each vector surface patch in the first initial class and the center vector surface patch of the first initial class is first obtained, and then the ratio of the sum of squares to the number of vector surface patches included in the first initial class is determined as the variance of the vector surface patches in the first initial class.

[0055] In this embodiment, the method for obtaining the variance of vector surface patches in the second initial class is similar to the method for obtaining the variance of vector surface patches in the first initial class, and will not be described again here.

[0056] S430 uses the k-means algorithm to cluster the vector surface patches in the first initial class into two classes, namely the first subclass and the second subclass.

[0057] In this embodiment, the method of using the k-means algorithm to cluster the vector surface patches in the first initial class into two classes is similar to the method described above of using the k-means algorithm to cluster the vector surface patches in the vector surface map into two classes, and will not be repeated here.

[0058] S440, if the variance of the vector surface patch in the first subclass is less than or equal to the preset variance threshold and the variance of the vector surface patch in the second subclass is less than or equal to the preset variance threshold, then proceed to S450.

[0059] In this embodiment, the methods for obtaining the variance of vector surface patches in the first subclass and the methods for obtaining the variance of vector surface patches in the second subclass are similar to the methods for obtaining the variance of vector surface patches in the first initial class, and will not be described again here.

[0060] S450, if the distance between the center vector surface patches of the second initial class and the first subclass is greater than or equal to a preset distance threshold, and the distance between the center vector surface patches of the second initial class and the second subclass is greater than or equal to a preset distance threshold, then the second initial class, the first subclass, and the second subclass are determined as the final result of clustering the vector surface patches in the vector surface map using the k-means algorithm.

[0061] In this embodiment, the preset distance threshold is an empirical value. If the distance between the center vector surface patches of the second initial class and the first subclass is greater than or equal to the preset distance threshold, it indicates that the radius of the minimum circumscribed circle and the pixel ratio of the vector area patches in the second initial class and the first subclass are significantly different. If the distance between the center vector surface patches of the second initial class and the first subclass is less than the preset distance threshold, it indicates that the radius of the minimum circumscribed circle and the pixel ratio of the vector area patches in the second initial class and the first subclass are significantly different, and the vector surface patches in the second initial class and the first subclass correspond to the same type of plant. In this case, the second initial class and the first subclass are merged into one class.

[0062] In one specific implementation, S450 further includes: if the distance between the center vector surface patches of the first subclass and the second initial class is greater than or equal to a preset distance threshold, and the distance between the center vector surface patches of the second subclass and the second initial class is less than the preset distance threshold, then the second subclass and the second initial class are merged into a first merged class, and the first subclass and the first merged class are determined as the final result of clustering the vector surface patches in the vector surface map using the k-means algorithm.

[0063] In one specific implementation, S440 further includes: if the variance of the vector surface patch in the first subclass is greater than a preset variance threshold and the variance of the vector surface patch in the second subclass is less than or equal to the preset variance threshold, then proceed to S441.

[0064] S441, using the k-means algorithm, the vector surface patches in the first subclass are clustered into two classes, namely the first intermediate class and the second intermediate class.

[0065] S442, if the variance of the vector surface patch in the first intermediate class is less than or equal to the preset variance threshold and the variance of the vector surface patch in the second intermediate class is less than or equal to the preset variance threshold, then proceed to S443.

[0066] S443, if the distance between the center vector surface patches of any of the second subclass, the first intermediate class, and the second intermediate class and the second initial class is greater than or equal to a preset distance threshold, the distance between the center vector surface patches of the first intermediate class and the second subclass is greater than or equal to a preset distance threshold, and the distance between the center vector surface patches of the second intermediate class and the second subclass is greater than or equal to a preset distance threshold, then the second initial class, the second subclass, the first intermediate class, and the second intermediate class are determined as the final result of clustering the vector surface patches in the vector surface map using the k-means algorithm.

[0067] In one specific implementation, S440 further includes: if the variance of the vector surface patch in the first subclass is greater than a preset variance threshold and the variance of the vector surface patch in the second subclass is greater than a preset variance threshold, then proceed to S444.

[0068] S444 uses the k-means algorithm to cluster the vector surface patches in the first subclass into two classes, namely the first intermediate class and the second intermediate class.

[0069] S445 uses the k-means algorithm to cluster the vector surface patches in the second subclass into two classes, namely the third intermediate class and the fourth intermediate class.

[0070] S446, if the distance between the center vector surface patches of the third intermediate class and the second initial class is less than a preset distance threshold, and the distance between the center vector surface patches of the fourth intermediate class and the first intermediate class is less than a preset distance threshold, then the third intermediate class and the second initial class are merged into the second merged class, the fourth intermediate class and the first intermediate class are merged into the third merged class, and the second merged class, the second intermediate class, and the third merged class are determined as the final result of clustering the vector surface patches in the vector surface map using the k-means algorithm.

[0071] In this embodiment, if the variance of vector surface patches in a certain class is greater than a preset variance threshold, it is determined that the class contains at least two types of plants. The k-means algorithm is then used to cluster the vector surface patches in the class into two classes. Next, it is determined whether the variance of the vector surface patches in the two newly obtained classes is greater than the preset variance threshold. If the variance of the vector surface patches in a newly obtained class is greater than the preset variance threshold, the new class is further divided until the variance of the vector surface patches in all newly obtained classes is less than or equal to the preset variance threshold. If the variance of the vector surface patches in all newly obtained classes is less than or equal to the preset variance threshold, the clustering is considered complete. Then, a decision is made on whether merging is necessary. This decision only considers whether undivided classes need to be merged, and only considers whether classes not obtained in the same k-means algorithm within undivided classes need to be merged. When the distance between the center vector surface patches of two classes is less than a preset distance threshold, it is determined that the two classes need to be merged; the radius of the minimum circumcircle of the center vector surface patch of any class is the average radius of the minimum circumcircle of the vector surface patches included in that class, and the pixel ratio of the center vector surface patch of any class is the average pixel ratio of the vector surface patches included in that class; the method for obtaining the distance between the center vector surface patches of two classes is similar to the method for obtaining the first vector surface patch and the second vector surface patch described above, and will not be repeated here.

[0072] S500, if the similarity between the central vector surface patch of the class containing the most vector surface patches and the preset vector surface patch is greater than or equal to the preset similarity threshold, then proceed to S600; wherein, the radius of the minimum circumscribed circle of the central vector surface patch of the class containing the most vector surface patches is the average radius of the minimum circumscribed circle of the vector surface patches in the class containing the most vector surface patches, and the pixel ratio of the central vector surface patch of the class containing the most vector surface patches is the average radius pixel ratio of the vector surface patches in the class containing the most vector surface patches; the preset vector surface patch is a preset tobacco plant vector surface patch that matches the growth stage of the tobacco plant corresponding to the target tobacco field image.

[0073] In this embodiment, the similarity between the center vector surface patch of the class with the most vector surface patches and the preset vector surface patch is 1, and the difference between the center vector surface patch of the class with the most vector surface patches and the preset vector surface patch is also considered.

[0074] Optionally, the preset similarity threshold can be an empirical value, for example, the preset similarity threshold is greater than or equal to 0.9.

[0075] In this embodiment, the preset vector surface patch is a preset vector surface patch of tobacco plant that matches the growth stage of the tobacco plant corresponding to the target tobacco field image. Different growth stages of the tobacco plant corresponding to the target tobacco field image result in different preset vector surface patches, which helps to improve the accuracy of judging whether the vector surface patch of the class with the most vector surface patches is a tobacco plant vector surface patch.

[0076] In this embodiment, if the similarity between the center vector surface patch of the class with the most vector surface patches and the preset vector surface patch is less than the preset similarity threshold, then S600 and S700 will not be executed, and instead information used to characterize the abnormal situation will be output.

[0077] S600, the vector surface map is denoised according to a specified vector surface patch in the vector surface map to obtain a denoised vector surface map; the specified vector surface patch is a vector surface patch in a class that does not have the largest number of vector surface patches; the denoising process includes deleting the specified vector surface patch in the vector surface map.

[0078] In this embodiment, if the similarity between the central vector surface patch of the class with the largest number of vector surface patches and the preset vector surface patch is greater than or equal to the preset similarity threshold, the vector surface patches of the class with a smaller number of vector surface patches are determined to be non-smoker vector surface patches.

[0079] S700, obtain the number of tobacco plants in the denoised vector surface image.

[0080] Those skilled in the art will understand that any prior art method for obtaining the number of tobacco plants in a vector surface image based on a vector surface image falls within the protection scope of this invention. Optionally, the number of tobacco plants in the denoised vector surface image can be obtained using a clustering-based tobacco field image processing method disclosed in Chinese Patent Application No. CN202311295114.9.

[0081] In this embodiment, based on the vector surface image corresponding to the target tobacco field image, the radius of the minimum circumscribed circle and the pixel ratio of each vector surface patch in the vector surface image are also obtained. Since the radius of the minimum circumscribed circle and the pixel ratio of different vector surface patches in the vector surface image are different, this embodiment clusters the vector surface patches in the vector surface image. Vector surface patches in the same cluster have similar radii of the minimum circumscribed circle and pixel ratios, while vector surface patches in different clusters have significantly different radii and / or pixel ratios. If the clustering result includes the cluster with the largest number of vector surface patches and has a high similarity to a preset vector surface patch, then the cluster with the largest number of vector surface patches is determined to be the cluster corresponding to tobacco plants, and the cluster with a smaller number of vector surface patches is determined to be the cluster corresponding to non-tobacco plants. Based on this, this embodiment deletes the vector surface patches included in the cluster corresponding to non-tobacco plants in the vector surface image, obtaining a denoised vector surface image. This embodiment uses the denoised vector surface image as the image for obtaining the number of tobacco plants, which can reduce the influence of non-tobacco plants on the obtained number of tobacco plants, and is beneficial to improving the accuracy of the number of tobacco plants in the obtained target tobacco field image.

[0082] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. It should also be understood that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.

Claims

1. A clustering-based method for processing tobacco field images, characterized in that, The processing method includes the following steps: S100, Obtain the vector surface map corresponding to the target tobacco field image; the vector surface map includes several vector surface patches; S200, obtain the radius of the minimum circumcircle of each vector surface patch in the vector surface map; S300, obtain the pixel percentage of each vector surface patch in the vector surface map; the pixel percentage of any vector surface patch is the ratio of the number of pixels included in the vector surface patch to the number of pixels included in the smallest circumcircle of the vector surface patch. S400, cluster the vector surface patches in the vector surface image according to the radius of the minimum circumcircle of each vector surface patch and the pixel ratio; S500: If the similarity between the central vector surface patch of the class containing the most vector surface patches and the preset vector surface patch is greater than or equal to the preset similarity threshold, proceed to S600; otherwise, do not execute S600 and S700, but output information to characterize the abnormal situation; wherein, the radius of the minimum circumscribed circle of the central vector surface patch of the class containing the most vector surface patches is the average radius of the minimum circumscribed circle of the vector surface patches in the class containing the most vector surface patches, and the pixel ratio of the central vector surface patch of the class containing the most vector surface patches is the average pixel ratio of the vector surface patches in the class containing the most vector surface patches; the preset vector surface patch is a preset vector surface patch of tobacco plants that matches the growth stage of the tobacco plants corresponding to the target tobacco field image; S600, the vector surface image is denoised according to a specified vector surface patch in the vector surface image to obtain a denoised vector surface image; the specified vector surface patch is a vector surface patch in a class that does not have the largest number of vector surface patches; the denoising process includes deleting the specified vector surface patch in the vector surface image. S700, obtain the number of tobacco plants in the denoised vector surface image.

2. The method for processing tobacco field images based on clustering according to claim 1, characterized in that, The k-means algorithm is used to cluster vector polygon patches in the vector polygon map. S400 includes: S410, the k-means algorithm is used to cluster the vector surface patches in the vector surface image into two classes, namely the first initial class and the second initial class. During the clustering process, the distance between the first vector surface patch and the second vector surface patch is positively correlated with the difference in the radius of the minimum circumcircle of the first vector surface patch and the second vector surface patch, and the distance between the first vector surface patch and the second vector surface patch is positively correlated with the difference in the pixel ratio of the first vector surface patch and the second vector surface patch. The first vector surface patch is any vector surface patch in the vector surface image, and the second vector surface patch is any vector surface patch in the vector surface image other than the first vector surface patch. S420, if the variance of the vector surface patch in the first initial class is greater than the preset variance threshold and the variance of the vector surface patch in the second initial class is less than or equal to the preset variance threshold, then proceed to S430. S430, the k-means algorithm is used to cluster the vector surface patches in the first initial class into two classes, namely the first subclass and the second subclass; S440, if the variance of the vector surface patch in the first subclass is less than or equal to the preset variance threshold and the variance of the vector surface patch in the second subclass is less than or equal to the preset variance threshold, then proceed to S450. S450, if the distance between the center vector surface patches of the second initial class and the first subclass is greater than or equal to a preset distance threshold, and the distance between the center vector surface patches of the second initial class and the second subclass is greater than or equal to a preset distance threshold, then the second initial class, the first subclass, and the second subclass are determined as the final result of clustering the vector surface patches in the vector surface map using the k-means algorithm.

3. The method for processing tobacco field images based on clustering according to claim 2, characterized in that, S440 further includes: if the variance of the vector surface patch in the first subclass is greater than a preset variance threshold and the variance of the vector surface patch in the second subclass is less than or equal to the preset variance threshold, then proceed to S441. S441, use the k-means algorithm to cluster the vector surface patches in the first subclass into two classes, namely the first intermediate class and the second intermediate class; S442, If the variance of the vector surface patch in the first intermediate class is less than or equal to a preset variance threshold and the variance of the vector surface patch in the second intermediate class is less than or equal to a preset variance threshold, then proceed to S443. S443, if the distance between the center vector surface patches of any of the second subclass, the first intermediate class, and the second intermediate class and the second initial class is greater than or equal to a preset distance threshold, the distance between the center vector surface patches of the first intermediate class and the second subclass is greater than or equal to a preset distance threshold, and the distance between the center vector surface patches of the second intermediate class and the second subclass is greater than or equal to a preset distance threshold, then the second initial class, the second subclass, the first intermediate class, and the second intermediate class are determined as the final result of clustering the vector surface patches in the vector surface map using the k-means algorithm.

4. The method for processing tobacco field images based on clustering according to claim 2, characterized in that, S450 further includes: if the distance between the center vector surface patches of the first subclass and the second initial class is greater than or equal to a preset distance threshold, and the distance between the center vector surface patches of the second subclass and the second initial class is less than the preset distance threshold, then the second subclass and the second initial class are merged into a first merged class, and the first subclass and the first merged class are determined as the final result of clustering the vector surface patches in the vector surface map using the k-means algorithm.

5. The method for processing tobacco field images based on clustering according to claim 2, characterized in that, S440 further includes: if the variance of the vector surface patch in the first subclass is greater than a preset variance threshold and the variance of the vector surface patch in the second subclass is greater than a preset variance threshold, then proceed to S444. S444, using the k-means algorithm, the vector surface patches in the first subclass are clustered into two classes, namely the first intermediate class and the second intermediate class; S445, using the k-means algorithm, the vector surface patches in the second subclass are clustered into two classes, namely the third intermediate class and the fourth intermediate class; S446, if among the first, second, third, and fourth intermediate classes, only the distance between the center vector surface patches of the third intermediate class and the second initial class is less than a preset distance threshold; among the third and fourth intermediate classes, only the distance between the center vector surface patches of the fourth intermediate class and the first intermediate class is less than a preset distance threshold; the distance between the center vector surface patches of the third intermediate class and the second intermediate class is greater than or equal to a preset distance threshold; and the distance between the center vector surface patches of the fourth intermediate class and the second intermediate class is greater than or equal to a preset distance threshold, then the third intermediate class and the second initial class are merged into the second merged class, the fourth intermediate class and the first intermediate class are merged into the third merged class, and the second merged class, the second intermediate class, and the third merged class are determined as the final result of clustering the vector surface patches in the vector surface map using the k-means algorithm.

6. The method for processing tobacco field images based on clustering according to claim 2, characterized in that, The S420 includes: S421, obtain the center vector surface patch of the first initial class; the radius of the minimum circumcircle of the center vector surface patch of the first initial class is the average radius of the minimum circumcircle of the vector surface patches in the first initial class, and the pixel ratio of the center vector surface patch of the first initial class is the average pixel ratio of the vector surface patches in the first initial class. S422, obtain the difference value between each vector surface patch in the first initial class and the center vector surface patch of the first initial class; the difference value between any vector surface patch in the first initial class and the center vector surface patch of the first initial class is positively correlated with the difference value between the radius of the vector surface patch and the center vector surface patch of the first initial class, and the difference value between any vector surface patch in the first initial class and the center vector surface patch of the first initial class is positively correlated with the difference value between the pixel ratio of the vector surface patch and the center vector surface patch of the first initial class; S423, obtain the variance of the vector surface patch in the first initial class based on the difference value between each vector surface patch in the first initial class and the center vector surface patch of the first initial class.

7. The method for processing tobacco field images based on clustering according to claim 2, characterized in that, The distance between the first vector surface patch and the second vector surface patch is dis 1,2 =w1×f(|r1-r2|)+(1-w1)×g(|c1-c2|), where r1 and r2 are the radii of the minimum circumcircles of the first and second vector surface patches, respectively; f() is the normalization process corresponding to the radius of the minimum circumcircle; c1 and c2 are the pixel proportions of the first and second vector surface patches, respectively; g() is the normalization process corresponding to the pixel proportions; and w1 is the preset weight, 0. <w1<1。 8. The method for processing tobacco field images based on clustering according to claim 7, characterized in that, The process of obtaining w1 includes: S411, Obtain a sample tobacco field image set; the sample tobacco field image set includes several sample tobacco field images, and the tobacco plants in each sample tobacco field image are at the same growth stage as the tobacco plants in the target tobacco field image. S412, Obtain the tobacco plant vector surface patch and non-tobacco plant vector surface patch in the vector surface map corresponding to each sample tobacco field image in the sample tobacco field image set; S413, obtain the distance between any two tobacco plant vector surface patches in the vector surface image corresponding to each sample tobacco field image, and construct a first distance set between tobacco plants; the first distance set includes the distance between any two tobacco plant vector surface patches in the vector surface image corresponding to each sample tobacco field image, the distance between any two tobacco plant vector surface patches is the sum of the first difference value and the second difference value of the corresponding two tobacco plant vector surface patches, the first difference value is the product of the first variable w0 and r', r' is the difference value of the radius of the normalized minimum circumcircle, and the second difference value is the product of (1-w0) and c', c' is the difference value of the normalized pixel proportion; S414, obtain the distance between any tobacco plant vector surface patch and any non-tobacco plant vector surface patch in the vector surface image corresponding to each sample tobacco field image, and construct a second distance set between tobacco plants and non-tobacco plants; the second distance set includes the distance between any tobacco plant vector surface patch and any non-tobacco plant vector surface patch in the vector surface image corresponding to each sample tobacco field image, and the distance between any tobacco plant vector surface patch and any non-tobacco plant vector surface patch is the sum of the first difference value and the second difference value of the corresponding tobacco plant vector surface patch and non-tobacco plant vector surface patch; S415, Under the premise of satisfying preset conditions, obtain w0 that maximizes the difference between the mean distance of the second distance set and the mean distance of the first distance set; the preset conditions include: each distance in the first distance set is greater than or equal to 0 and less than or equal to 1, each distance in the second distance set is greater than or equal to 0 and less than or equal to 1, 0 <w0<1; S416, the w0 that maximizes the difference between the mean distance of the second distance set and the mean distance of the first distance set is determined as w1.

9. The method for processing tobacco field images based on clustering according to claim 1, characterized in that, S100 includes: S110, Obtain the saturation band map corresponding to the target tobacco field image; S120, update the saturation of pixels in the saturation band image whose saturation is less than the preset saturation threshold to empty, and obtain the updated saturation band image. S130, perform raster-to-vector surface processing on the updated saturation band map to obtain a vector surface map.

Citation Information

Patent Citations

  • A method for processing tobacco field images

    CN117274814B

  • Tobacco plant counting method

    CN117274812A

  • Tobacco field image processing method

    CN117274814A