CN118446969A - Litchi phenotype parameter detection method and system based on image processing and three-dimensional point cloud - Google Patents
Litchi phenotype parameter detection method and system based on image processing and three-dimensional point cloud Download PDFInfo
- Publication number
- CN118446969A CN118446969A CN202410505174.7A CN202410505174A CN118446969A CN 118446969 A CN118446969 A CN 118446969A CN 202410505174 A CN202410505174 A CN 202410505174A CN 118446969 A CN118446969 A CN 118446969A
- Authority
- CN
- China
- Prior art keywords
- litchi
- point cloud
- dimensional point
- image
- tested
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/194—Segmentation; Edge detection involving foreground-background segmentation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10028—Range image; Depth image; 3D point clouds
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Geometry (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a litchi phenotype parameter detection method and system based on image processing and three-dimensional point cloud, wherein the method comprises the following steps: acquiring two-dimensional images of litchi to be detected under multiple visual angles; mapping and processing two-dimensional images of the litchi to be detected under a plurality of view angles to obtain three-dimensional point cloud data of the litchi to be detected, calculating point cloud curvature and normal vector of the three-dimensional point cloud data of the litchi to be detected, counting curvature threshold values, and identifying mechanical injury areas of the litchi; and performing color model space conversion on the obtained RGB image of the litchi to be detected, extracting red pixel points in the litchi image under the HSI model through red pixel point threshold values to obtain the red coloring rate of the litchi, obtaining a depth image containing the thickness of the litchi according to the depth image and the background depth image, and calculating the volume of the litchi by adopting the 3D models at the top and the bottom of the litchi to be detected, which are built by the depth image. The invention can rapidly and accurately detect the phenotype parameters of the litchi and provide scientific basis for quality classification of the litchi.
Description
Technical Field
The invention belongs to the technical field of fruit phenotype parameter detection, and particularly relates to a litchi phenotype parameter detection method and system based on image processing and three-dimensional point cloud.
Background
The post-partum grading of litchi is an important process before fresh-keeping packaging, sales and deep processing, and is also a key for improving the added value of litchi. At present, the post-partum classification treatment of litchi in China is still relatively backward, and the litchi is classified mainly in a manual mode, however, the post-partum classification of litchi in a manual mode has the problems of higher labor cost, lower classification precision and low efficiency, and in addition, the litchi is extremely easy to damage in the process of manually post-partum classification of the litchi due to the thin epidermis and high water content of the litchi, so that the sales value of the litchi is greatly influenced.
With the continuous development of machine vision technology in recent years, the machine vision technology is gradually applied to quality detection of fruit products, and researchers extract phenotype parameters of litchi through three-dimensional point cloud data by collecting the three-dimensional point cloud data of the litchi, so that nondestructive postpartum grading of the litchi is realized. However, because the size of the litchi is smaller, the accuracy of the three-dimensional point cloud of the collected litchi is lower, so that the accuracy of the litchi phenotype parameter detection result is greatly influenced, in addition, the current litchi surface parameter detection still only uses the size of the litchi fruit diameter as a grading standard, the problem of single litchi grading basis exists, and the situation of uneven maturity of the same graded litchi is caused.
Disclosure of Invention
The invention aims to overcome the defects in the prior art and provides a litchi phenotype parameter detection method based on image processing and three-dimensional point cloud.
The invention further aims to provide a litchi phenotype parameter detection system based on image processing and three-dimensional point cloud.
In order to achieve the above object, the present invention can be achieved by adopting the following technical scheme:
A litchi phenotype parameter detection method based on image processing and three-dimensional point cloud comprises the following steps:
s1, acquiring two-dimensional images of litchi to be detected under multiple view angles, wherein the two-dimensional images comprise depth images and RGB images;
S2, mapping the two-dimensional images of the litchi to be detected under a plurality of view angles to obtain original three-dimensional point cloud data of the litchi to be detected, carrying out background segmentation and noise reduction filtering treatment on the original three-dimensional point cloud data to obtain three-dimensional point cloud data of the litchi to be detected, calculating the point cloud curvature and normal vector of the three-dimensional point cloud data of the litchi to be detected, and counting the curvature threshold value for judging the litchi surface loss area, so that point cloud of the litchi damage area is segmented, and the mechanical damage area of the litchi to be detected is identified;
S3, converting the RGB images of the litchi to be detected under the different visual angles obtained in the step S1 into an HSI color model space to obtain litchi images under the HSI models of the different visual angles, extracting respective red pixel points in the litchi images under the HSI models of the different visual angles through a preset red pixel point threshold value, taking an average value, and taking the average value as the red coloring rate of the litchi to be detected;
s4, obtaining a depth image h (x, y) containing the thickness of the litchi according to the depth images f (x, y) and the background depth images b (x, y) of the litchi to be detected under different visual angles, preprocessing the depth image h (x, y) containing the thickness of the litchi, and calculating the volume value of the litchi to be detected according to the 3D models of the top and the bottom of the litchi to be detected by adopting the 3D models of the top and the bottom of the litchi to be detected, which are established by the preprocessed depth image h (x, y).
Preferably, the plurality of viewing angles in step S1 includes four viewing angles of left view, right view, top view and bottom view.
Preferably, in step S2, the deriving process of the point cloud curvature and the normal vector of the three-dimensional point cloud data of the litchi to be detected is as follows:
Because each point in the point cloud has a neighborhood point cloud, the neighborhood point cloud is approximated by using a specific surface, and the curvature of a certain point can be represented by the curvature of a local curved surface fitted by the point and the neighborhood point thereof; therefore, k points are uniformly selected around the circumference rate with the circumference rate as a center point, and a quadric equation can be expressed as follows:
z(x,y)=ax2+bxy+cy2
According to the least squares principle, the sum of squares of z i can be expressed as:
from this, the values of the coefficients a, b, c of the quadric equation can be found:
The curve on the curved surface can be expressed as:
r=(x(t),y(t))
The unit normal vector at point Pi can be expressed as:
taking the normal vector at the Pi point as the normal vector of the local curved surface in the neighborhood, and then the covariance matrix of each point in the neighborhood is:
C·Xj=λj·Xj,j=1,2,3
Wherein P 0 is the centroid of the neighborhood points, k is the number of the neighborhood points, and lambda j and X j respectively represent the characteristic value and the characteristic vector of C.
The feature vector corresponding to the minimum feature value of the matrix C is a point (normal vector of P i, a covariance matrix is constructed, the feature value of the matrix is calculated through feature value decomposition, and when the feature value satisfies the condition that λ0 is less than or equal to λ1 is less than or equal to λ2, the curvature of the neighboring point can be expressed as:
Finally, the neighborhood curvature k i is the curvature degree of the neighborhood curved surface.
Preferably, the curvature threshold for determining the litchi surface loss area in step S2 is 1.81.
Preferably, the specific procedure of step S3 is as follows:
Firstly, respectively carrying out normalization processing on an R component, a G component and a B component in RGB images under a plurality of different visual angles, wherein the color of a pixel point positioned at a space position (x, y) in an RGB color space is represented by 3 numerical values of the R component R (x, y), the G component G (x, y) and the B component B (x, y) of the pixel point; then, the litchi area in the RGB image after normalization processing is converted into an HSI color space, and the H component H (x, y), the S component S (x, y) and the I component I (x, y) of the pixel point in the HSI color space are expressed as follows:
Wherein,
Finally, according to the formula, litchi images under the HSI model corresponding to RGB images under a plurality of different visual angles of the litchi to be detected are obtained;
Extracting respective red pixel values in the litchi images under the HSI models of the different visual angles according to a preset red pixel point threshold value, and averaging, wherein the average value is used as the red coloring rate of the litchi to be detected; the red coloring rate is the ratio of the red pixel points on the surface of the whole litchi to be detected to the total area value of all the pixel points of the litchi to be detected; the red pixel points are red H components of the litchi surface in the litchi image to be detected under the HSI model.
Preferably, the preset threshold value of the red pixel point is 35-40 degrees.
Preferably, in step S4, the preprocessing mode of the depth image h (x, y) including the litchi thickness is erosion, expansion and gaussian smoothing.
Preferably, the shooting environments and shooting heights of the depth image f (x, y) and the background depth image b (x, y) in step S4 are the same.
The litchi phenotype parameter detection system based on the image processing and the three-dimensional point cloud is used for the litchi phenotype parameter detection method based on the image processing and the three-dimensional point cloud, and comprises a litchi image acquisition platform and a cloud server;
The litchi image acquisition platform comprises a camera bellows, an LED light source, a litchi placing plate, a depth camera and a camera bracket, wherein the LED light source is arranged at the top in the box body of the camera bellows, the depth camera is arranged below the LED light source through the camera bracket, the litchi placing plate is arranged at the bottom of the box body of the camera bellows, and a lens of the depth camera faces the litchi placing plate; the litchi placing plate is used for placing litchi to be detected, and the depth camera is in communication connection with the cloud server;
The cloud server comprises a processor and a memory; the memory having stored thereon non-transitory computer instructions which, when executed by a processor, perform the litchi phenotype parameter detection method based on image processing and three-dimensional point cloud as claimed in any one of claims 1-8.
Preferably, the depth camera employs INTEL REALSENSE D a 405 depth camera.
Compared with the prior art, the invention has the following advantages:
(1) According to the litchi phenotype parameter detection method based on image processing and three-dimensional point cloud, the point cloud data of the litchi to be detected is obtained by obtaining the RGB images and the depth images of the litchi to be detected under 4 visual angles, and the curvature threshold value of the litchi surface loss area is obtained based on the point cloud normal vector and the curvature algorithm, so that the litchi mechanical damage is rapidly and accurately identified, the litchi skin is effectively protected from being damaged in the detection process, the economic value of the litchi is effectively improved, the average identification accuracy of the litchi mechanical damage area according to multiple test statistics reaches 94%, and the litchi phenotype parameter detection accuracy is improved.
(2) The litchi phenotype parameter detection method based on image processing and three-dimensional point cloud comprises the steps of performing RGB-HSI color model space conversion on RGB images of litchi to be detected under a plurality of different visual angles to obtain a litchi image under an HSI model, extracting red pixel points in the litchi image under the HSI model through a preset red pixel point threshold value, and finally calculating to obtain the red coloring rate of the litchi; compared with the conventional method for reconstructing three-dimensional point cloud of litchi based on MVS-SFM algorithm in the prior art, the method provided by the invention has the advantages that the coloring rate of the litchi point cloud is improved by 90% in speed, so that the efficiency of litchi phenotype parameter detection is greatly enhanced.
(3) According to the litchi phenotype parameter detection system based on image processing and three-dimensional point cloud, the litchi to be detected is acquired through ingenious matching of the camera bellows, the LED light source, the litchi placing plate, the depth camera and the camera support, the litchi depth image and the RGB image under 4 visual angles are acquired, the three-dimensional point cloud data of the litchi to be detected are obtained through mapping of the acquired litchi depth image and the acquired RGB image under 4 visual angles, and therefore the three-dimensional point cloud data of the litchi to be detected are more accurate, and the accuracy of litchi phenotype parameter detection is improved.
Drawings
Fig. 1 is a schematic diagram of a litchi phenotype parameter detection method based on image processing and three-dimensional point cloud provided in embodiment 1 of the present invention;
Fig. 2 is an RGB image, a depth image and a point cloud image of litchi at multiple viewing angles provided in embodiment 1 of the present invention;
Fig. 3 is a schematic diagram of comparison between an original three-dimensional point cloud and a processed point cloud of litchi provided in embodiment 1 of the present invention;
fig. 4 is a schematic diagram showing the comparison of the litchi RGB image and the HSI model image provided in embodiment 1 of the present invention;
Fig. 5 is a visual result diagram of litchi red pixel extraction provided in embodiment 1 of the present invention;
Fig. 6 is a schematic view of a depth image of the top and bottom of litchi provided in embodiment 1 of the present invention;
fig. 7 is a schematic diagram of the litchi depth image h (x, y) provided in embodiment 1 before and after processing;
Fig. 8 is a schematic diagram of a top model of litchi provided in embodiment 1 of the present invention;
Fig. 9 is a schematic view of a litchi bottom model provided in embodiment 1 of the present invention;
fig. 10 is a graph of the results of the mechanical damage experiment of litchi provided in example 1 of the present invention;
FIG. 11 is a schematic flow chart of a litchi point cloud coloring rate extraction process based on the reconstruction of three-dimensional point cloud of litchi by MVS-SFM algorithm provided in embodiment 1 of the present invention;
fig. 12 is a linear result chart of litchi tinting rate and artificially measured tinting rate extracted based on an litchi RGB graph and a color space model provided in embodiment 1 of the present invention;
fig. 13 is a linear result diagram of the extraction of the coloring rate of the litchi point cloud and the manual measurement of the coloring rate based on the reconstruction of the three-dimensional point cloud of litchi by the MVS-SFM algorithm provided in the embodiment 1 of the invention;
FIG. 14 is a graph showing the predicted volume results and the linear results of the manual measurement of the volume of litchi provided in example 1 of the present invention;
Fig. 15 is a schematic structural diagram of a litchi phenotype parameter detection system based on image processing and three-dimensional point cloud according to embodiment 2 of the present invention.
Wherein 1 is the camera bellows, 2 is the LED light source, 3 is the camera support, 4 is the depth camera, 5 is the litchi that awaits measuring, 6 is cloud ware, 7 is the litchi and places the board.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments, and all other embodiments obtained by those skilled in the art without making any inventive effort based on the embodiments of the present invention are within the scope of protection of the present invention.
The technical scheme of the invention is further described below by the specific embodiments with reference to the accompanying drawings.
In the description of the present invention, it should be understood that the directions or positional relationships indicated by the terms "upper", "lower", "top", "bottom", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as limiting the present invention.
Example 1
As shown in fig. 1, the litchi phenotype parameter detection method based on image processing and three-dimensional point cloud comprises the following steps:
s1, acquiring two-dimensional images of litchi to be detected under multiple view angles, wherein the two-dimensional images comprise depth images and RGB images; specifically, the plurality of viewing angles includes four viewing angles of left-hand view, right-hand view, top-down view and bottom-hand view.
Specifically, INTEL REALSENSE D depth camera 4 is used in this embodiment to collect depth images and RGB images of the litchi under test under multiple viewing angles, where each pixel point of the depth image represents a distance between the pixel point and the plane of depth camera 4, and the unit of the distance is mm.
S2, mapping the two-dimensional images of the litchi to be detected under a plurality of view angles to obtain original three-dimensional point cloud data of the litchi to be detected, carrying out background segmentation and noise reduction filtering treatment on the original three-dimensional point cloud data to obtain three-dimensional point cloud data of the litchi to be detected, calculating the point cloud curvature and normal vector of the three-dimensional point cloud data of the litchi to be detected, and counting the curvature threshold value for judging the litchi surface loss area, so that point cloud of the litchi damage area is segmented, and the mechanical damage area of the litchi to be detected is identified;
specifically, the process of acquiring the original three-dimensional point cloud data of the litchi to be detected is as follows:
Firstly, transmitting the depth image and the RGB image of the litchi to be detected under the multiple visual angles acquired by the depth camera 4 in the step S1 to a cloud server 6, processing the depth image and the RGB image of the litchi to be detected under the multiple visual angles by adopting python software and combining corresponding programming driving of the depth camera 4 in the cloud server 6, so that the depth image and the RGB image are combined, converting two-dimensional pixel data into points in a three-dimensional space through calibration parameters of the depth camera 4, mapping color data in the RGB image onto corresponding three-dimensional points, enabling the generated point cloud to have real color information, and finally obtaining the original three-dimensional point cloud of the litchi to be detected through conversion of a mapping relation.
Specifically, as shown in fig. 3, since the original three-dimensional point cloud data of the litchi to be detected obtained by the depth camera 4 includes a large number of hash points and isolated points, and when the point cloud data is obtained, because of the influence of the precision of the device, the experience of an operator and environmental factors, the diffraction of electromagnetic waves, the change of the surface property of the object to be detected and the error influence in the data stitching registration operation process, some unavoidable noise and other point clouds irrelevant to the litchi will appear in the point cloud data, in order to obtain better three-dimensional point cloud data, in this embodiment, the obtained original three-dimensional point cloud data of the litchi to be detected is subjected to background segmentation by adopting cloudcompare software, and the litchi point cloud is subjected to noise reduction and filtering processing based on a bounding box algorithm and a statistical filtering (STATISTICAL OUTLIER REMOVAL, SOR) method, so that the clean and complete litchi point cloud is finally obtained.
Since the surface curvature of the point cloud is a concept of eigenvalues that is used to describe the degree of change in the surface of the point cloud. The mechanical damage formed in the processes of growing, picking and grading after picking of the litchi can enable the surface of the litchi to form a certain depression or bulge, the depression or bulge area of the surface of the litchi can change the original shape of the surface of the fruit, the point cloud curvature of the area of the litchi is changed and is usually expressed as an abnormally high value or a abnormally low value, so that after the surface curvature of the point cloud of the litchi is obtained through calculation, a threshold value can be obtained through statistics, the curvature point cloud area under the threshold value range is the point cloud area with the changed curvature of the surface of the litchi, the point cloud area is the mechanical damage area of the litchi, which is obtained through identification, of the litchi, the threshold value range is the curvature change threshold value of the point cloud of the litchi, and then the mechanical damage area of the litchi to be detected can be identified through the threshold value.
Specifically, the calculation principle of the point cloud curvature and the normal vector of the three-dimensional point cloud data of the litchi to be detected is as follows:
The degree of change of the point cloud is described by the eigenvalue due to the surface curvature. By estimating the normal vector for each point in the point cloud, the curvature of a point can be obtained. The normal vector may be calculated using the tangent normal of the surface at that point. According to the least squares method (Least Squares Method, LSM), a quadric may be used to characterize the local region and a local region surface fitting method may be used to estimate the normal vector.
Because each point in the point cloud has a neighborhood point cloud, the neighborhood point cloud is approximated by using a specific surface, and the curvature of a certain point can be represented by the curvature of a local curved surface fitted by the point and the neighborhood point thereof; therefore, k points are uniformly selected around the circumference rate with the circumference rate as a center point, and a quadric equation can be expressed as follows:
z(x,y)=ax2+bxy+cy2
According to the least squares principle, the sum of squares of z i can be expressed as:
from this, the values of the coefficients a, b, c of the quadric equation can be found:
The curve on the curved surface can be expressed as:
r=(x(t),y(t))
The unit normal vector at point Pi can be expressed as:
taking the normal vector at the Pi point as the normal vector of the local curved surface in the neighborhood, and then the covariance matrix of each point in the neighborhood is:
C·Xj=λj·Xj,j=1,2,3
Wherein P 0 is the centroid of the neighborhood points, k is the number of the neighborhood points, and lambda j and X j respectively represent the characteristic value and the characteristic vector of C.
The feature vector corresponding to the minimum feature value of the matrix C is a point (normal vector of P i, a covariance matrix is constructed, the feature value of the matrix is calculated through feature value decomposition, and when the feature value satisfies the condition that λ0 is less than or equal to λ1 is less than or equal to λ2, the curvature of the neighboring point can be expressed as:
Finally, the obtained neighborhood curvature k i is the point cloud curvature of the curved surface area.
Specifically, after iterative analysis is performed on the point cloud curvatures of different litchi point cloud samples in Cloudcompare software, the accuracy of the measured surface loss curvature of litchi is finally obtained when the curvature threshold is set to be 1.81.
S3, converting the RGB images of the litchi to be detected under the different visual angles obtained in the step S1 into an HSI color model space to obtain litchi images under the HSI models of the different visual angles, extracting respective red pixel points in the litchi images under the HSI models of the different visual angles through a preset red pixel point threshold value, taking an average value, and taking the average value as the red coloring rate of the litchi to be detected;
Specifically, the specific process of step S3 is as follows:
Firstly, acquiring the values of an R component, a G component and a B component of each pixel point in the RGB image under a plurality of different visual angles obtained in the step S3 by adopting a python+opencv writing program, and then respectively carrying out normalization processing on the values of the R component, the G component and the B component of each pixel point to obtain that the color of the pixel point positioned at a space position (x, y) in an RGB color space is represented by 3 values of the R component R (x, y), the G component G (x, y) and the B component B (x, y) of the pixel point; then, the litchi area in the RGB image after normalization processing is converted into an HSI color space, and the H component H (x, y), the S component S (x, y) and the I component I (x, y) of the pixel point in the HSI color space are expressed as follows:
Wherein,
The RGB color space is based on a three-dimensional rectangular coordinate system and comprises R, G, B original spectrum components, an HSI model is set according to a human visual system and consists of H, S, I components, wherein an H component represents the color of an object, an I component represents the brightness, an S component represents the saturation of the color, and θ (x, y) is the value of an included angle in an H component conversion formula.
As shown in fig. 4, finally, according to the above formula, obtaining litchi images under the HSI model corresponding to the RGB images under a plurality of different viewing angles of the litchi to be detected;
The smaller the H value of a pixel point in the HSI color space is, the more red the hue of the pixel point is, so that the pixel point with the H component smaller than the preset red pixel point threshold value in an image is marked as a red pixel point according to the preset red pixel point threshold value, then the respective red pixel point values in litchi images under the HSI models with different visual angles are obtained through calculation, and the average value is used as the red coloring rate of litchis to be measured; the red coloring rate is the ratio of the red pixel points on the surface of the whole litchi to be detected to the total area value of all the pixel points of the litchi to be detected;
the method for acquiring the preset red pixel point threshold value comprises the following steps:
Firstly, different litchi image samples under an HSI model are obtained, then the red coloring rate corresponding to the samples is obtained by adjusting the size of the red pixel threshold value, the obtained red coloring rate is verified by the litchi coloring rate standard, and finally the value range of the red pixel threshold value with the most accurate verification result is used as the preset red pixel threshold value.
Specifically, the red coloring rate measurement experiment is carried out on the litchi sample for a plurality of times, and the result is the most accurate when the value range of the preset red pixel point threshold value is 35-40 degrees.
S4, obtaining a depth image h (x, y) containing the thickness of the litchi according to the depth images f (x, y) and the background depth images b (x, y) of the litchi to be detected under different visual angles, preprocessing the depth image h (x, y) containing the thickness of the litchi, and calculating the volume value of the litchi to be detected according to the 3D models of the top and the bottom of the litchi to be detected by adopting the 3D models of the top and the bottom of the litchi to be detected, which are established by the preprocessed depth image h (x, y).
The specific process of step S4 is as follows:
Since a depth image is an image or image channel containing information about the distance of the surface of a scene object from the viewpoint, also called range view, directly reflects the geometry of the visible surface of the photographic subject. Each non-zero gray area pixel of the depth image represents the height of the litchi surface within one pixel area, so the thickness of the litchi can be defined as the distance from the surface of the litchi to the platform on which the litchi is placed.
Since the depth image f (x, y) of the litchi indicates the distance between the surface of the litchi and the depth camera 4, this distance does not directly reflect the thickness of the litchi. It is necessary to keep the depth camera 4 at the same height, the background depth pattern b (x, y) under the same photographing environment, and construct a depth image h (x, y) containing the litchi thickness based on the depth image f (x, y) and the background depth image b (x, y), the depth image h (x, y) containing the litchi thickness being expressed as follows:
Then using python+opencv writing program to erode, expand and Gaussian smooth depth image h (x, y), removing tiny noise in the image, filling small holes, and obtaining the result as shown in figure 7
And then, the processed preprocessed depth image h (x, y) is imported into Matlab software and built into 3D models of the top and bottom of the litchi to be detected, and at the moment, the non-zero pixel value in the image h (x, y) is the thickness of the litchi at the point, and the default pixel value unit of the depth image obtained by directly storing the processed image after shooting by a camera is a sub-millimeter, so that the unit is converted into mm. Meanwhile, the number of the non-zero pixel values represents the surface area S of the litchi projected into the two-dimensional image space, and the actual area of each pixel is calculated to be equal to 0.089mm 2.
Specifically, the actual volume acquisition process of each pixel is as follows:
Firstly, shooting a green card paper with the area of 100 square centimeters vertically downwards by adopting the same camera height and angle as those of shooting litchi data, then using python+opencv to write a program, dividing the green card paper area, calculating the number of pixels in the area in an image, and dividing the actual area of the card paper by the number of pixels to obtain the actual area of each pixel. It should be noted that, this value represents the actual area represented by each pixel point in the depth image generated by the depth camera, and does not change with the change of the external environment, so it can be used in the subsequent litchi detection.
The volume of litchi is defined as the sum of the volumes of each pixel in the litchi surface area, and because only half of litchi thickness information is contained in one depth image h (x, y), the minimum non-zero pixel value is subtracted from each non-zero pixel value in h (x, y) to obtain half of the litchi volume. And finally, calculating the volume of the whole litchi through the three-dimensional surface models of the top and the bottom of the litchi.
The volume calculation of litchi is expressed as follows:
V Total (S) =V Top +V Bottom
Conclusion and analysis
In order to provide efficient technical means and data support for post-partum grading of litchis, the litchi phenotype parameter detection method based on image processing and three-dimensional point cloud in the embodiment is subjected to data analysis in an experimental mode.
The test selects Feizixiao litchi variety as a sample, and is collected from Guangzhou city increasing urban area in Guangdong province.
(1) Mechanical injury data analysis
In order to verify the accuracy of litchi point cloud loss area identification, 50 litchis subjected to mechanical damage of different degrees are prepared for the test, and the litchi mechanical damage identification accuracy under different number of view angles is detected.
As shown in table 1 below, the damage detection accuracy of litchi at a single viewing angle, 2 viewing angles, 3 viewing angles and 4 viewing angles was tested, curvature calculation was performed after point cloud synthesis, and the detection result of mechanical damage on the litchi surface was obtained. From the results in table 1, it can be seen that the detection rate of mechanical damage to litchi is lower under a single visual angle, the number of missed litchi detection is more, the detection accuracy of mechanical damage is obviously improved along with the increase of the detection visual angles, and the detection accuracy of litchi under 4 detection visual angles is 94%. According to the detection result, the method for calculating the point cloud curvature change value can be used for rapidly and effectively detecting the mechanical damage of the litchi under a certain error permission condition, and has high detection accuracy.
| Viewing angle (personal) | Total number of samples (number) | Correct detection quantity (number) | Detection accuracy (%) |
| 1 | 50 | 30 | 60 |
| 2 | 50 | 38 | 76 |
| 3 | 50 | 42 | 84 |
| 4 | 50 | 47 | 94 |
Table 1 litchi mechanical injury test results
(2) Litchi coloring rate extraction data analysis
In order to verify the extraction result of the litchi coloring rate, the experiment uses the judgment of the litchi coloring rate by manpower as the verification of real data, and in addition, the experiment adopts the method for reconstructing three-dimensional point cloud of litchi based on MVS-SFM algorithm in the prior art to extract the litchi point cloud coloring rate, and the method is compared with the method;
Specifically, as shown in fig. 12, the result obtained in the step of extracting the litchi coloring rate provided by the invention and the litchi coloring rate manually judged are obviously linearly related, the correlation coefficient R2 and the root mean square Error (Root Mean Square Error, RMSE) of the litchi coloring rate in the RGB chart are 0.9574 and 0.0809%, the average absolute Error (Mean Absolute Error, MAE) is 6.33%, and the average relative Error (MEAN RELATIVE Error, MRE) is 4.17%, respectively.
Specifically, as shown in fig. 11, the process of reconstructing three-dimensional point cloud of litchi based on MVS-SFM algorithm to extract the coloring rate of litchi point cloud is as follows:
Firstly, reconstructing an acquired litchi image by using an MVS-SFM algorithm to obtain litchi point cloud, then carrying out plane segmentation on the litchi point cloud based on a random sampling consistency algorithm (Random Sample Consensus, RANSAC), obtaining complete and clean litchi point cloud through processing such as statistical filtering, and finally obtaining a red coloring rate result of the litchi surface according to the determined litchi red threshold range.
As shown in FIG. 13, the three-dimensional point cloud of the reconstructed litchi finally based on the MVS-SFM algorithm shows obvious linear distribution of the litchi point cloud coloring rate and the litchi coloring rate judged manually, wherein R2 and RMSE are respectively 0.9205 and 0.0563%, MAE is 4.37%, and MRE is 6.01%. The result shows that the litchi tinting rate result obtained through the computer vision processing has better correlation with the tinting rate result judged by manual measurement.
Finally, although the MVS-SFM algorithm can obtain a complete litchi point cloud and is simple to operate, the sparse and dense reconstruction process of a single litchi is long in time consumption, high in equipment requirement, and the average reconstruction of the point cloud of a litchi and the extraction of the coloring rate are required to be 10 minutes, and the time required for extracting the coloring rate of the litchi by adopting the litchi coloring rate provided by the invention is less than 1mm, so that the overall speed is improved by 90%.
(3) Litchi volume extraction data analysis
In order to verify that the litchi detection result is verified by adopting the litchi depth image to carry out 3D modeling on the litchi and extracting the litchi volume extraction result, the experiment utilizes a manual volume measurement mode to verify the litchi detection result. Specifically, the volume measurement of litchi is carried out by adopting a drainage method in the experiment.
As shown in FIG. 14, after multiple experiments, the invention adopts the depth image of the litchi to carry out 3D modeling on the litchi, and extracts the predicted volume result and the manual measurement volume of the litchi volume to show obvious linear distribution, wherein R2 and RMSE of the predicted volume of the litchi are 0.8901 and 2.4733cm3, MAE is 1.59cm3 and MRE is 7.94 percent respectively.
According to the detection result, the 3D model established by the litchi depth image is utilized, the result of estimating the litchi volume by the pixel value thickness based on the litchi 3D model has better correlation with the manual measurement result, and the detection precision rate reaches 89%.
In summary, the three-dimensional point cloud of the litchi is obtained by acquiring RGB color images and depth images of the litchi under 4 different visual angles through mapping, and the litchi images and the point cloud are processed by utilizing image processing and a three-dimensional point cloud technology, so that nondestructive and rapid extraction of three phenotype parameters of mechanical injury, coloring rate and volume of the litchi is realized, the economic value of the litchi is improved, and scientific basis is provided for quality classification of the litchi.
Example 2:
As shown in fig. 15, a litchi phenotype parameter detection system based on image processing and three-dimensional point cloud is used for the litchi phenotype parameter detection method based on image processing and three-dimensional point cloud, and the system comprises a litchi image acquisition platform and a cloud server 6;
As shown in fig. 14, the litchi image acquisition platform comprises a camera bellows 1, an LED light source 2, a litchi placing plate 7, a depth camera 4 and a camera bracket 3, wherein the LED light source 2 is installed at the top in the box body of the camera bellows 1, the depth camera 4 is installed below the LED light source 2 through the camera bracket 3, the litchi placing plate 7 is installed at the bottom of the box body of the camera bellows 1, and the lens of the depth camera 4 faces the litchi placing plate 7; the litchi placing plate 7 is used for placing litchi to be detected, and the depth camera 4 is in communication connection with the cloud server 6;
the working flow of the litchi image acquisition platform is as follows:
during detection, firstly, the litchi to be detected is placed under the depth camera 4, the camera lens is kept to face the center of the litchi to be detected horizontally, then the litchi to be detected is uniformly rotated in a manual mode, depth images and RGB images of the left view, the right view, the overlook view and the look-up view of the litchi to be detected are obtained, at this time, the depth camera 4 processes the obtained depth images and RGB images of the four views to obtain original three-dimensional point cloud data of the litchi to be detected, and the depth images, the RGB images and the original three-dimensional point cloud data of the four views of the litchi to be detected are transmitted to the cloud server 6.
The cloud server 6 includes a processor and a memory; the memory has stored thereon non-transitory computer instructions which, when executed by the processor, perform the litchi phenotype parameter detection method based on image processing and three-dimensional point cloud as described in embodiment 1.
The depth camera 4 employs INTEL REALSENSE D depth cameras.
Specifically, INTEL REALSENSE D's 405 depth camera is a close-range depth camera, the frame rate is 90 frames/s, the depth range is 7cm-50cm, the depth field is 87 ° (horizontal) ×58 ° (vertical), the frame rate is 90 frames/s, the resolution of a color camera, namely RGB mode, is 1280×720, and the resolution output of the depth camera mode is 1280×720 at the highest.
In the description of the present invention, it should be noted that, unless explicitly stated and agreed otherwise, the terms "disposed," "mounted," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
The above examples are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above examples, and any other changes, modifications, substitutions, combinations, and simplifications that do not depart from the spirit and principle of the present invention should be made in the equivalent manner, and the embodiments are included in the protection scope of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410505174.7A CN118446969A (en) | 2024-04-25 | 2024-04-25 | Litchi phenotype parameter detection method and system based on image processing and three-dimensional point cloud |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410505174.7A CN118446969A (en) | 2024-04-25 | 2024-04-25 | Litchi phenotype parameter detection method and system based on image processing and three-dimensional point cloud |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN118446969A true CN118446969A (en) | 2024-08-06 |
Family
ID=92328822
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410505174.7A Pending CN118446969A (en) | 2024-04-25 | 2024-04-25 | Litchi phenotype parameter detection method and system based on image processing and three-dimensional point cloud |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118446969A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119049041A (en) * | 2024-08-19 | 2024-11-29 | 深圳职业技术大学 | Litchi nondestructive sorting method and device, storage medium and computer equipment |
-
2024
- 2024-04-25 CN CN202410505174.7A patent/CN118446969A/en active Pending
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119049041A (en) * | 2024-08-19 | 2024-11-29 | 深圳职业技术大学 | Litchi nondestructive sorting method and device, storage medium and computer equipment |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112308832B (en) | Bearing quality detection method based on machine vision | |
| CN109285145B (en) | A smartphone-based method for measuring the height of multiple standing trees | |
| CN106709950B (en) | Binocular vision-based inspection robot obstacle crossing wire positioning method | |
| CN110210448B (en) | Intelligent face skin aging degree identification and evaluation method | |
| CN110443836A (en) | A kind of point cloud data autoegistration method and device based on plane characteristic | |
| CN109580630A (en) | A kind of visible detection method of component of machine defect | |
| CN109410139A (en) | Inside a kind of historical relic and surface disease digital assay appraisal procedure | |
| CN107392929B (en) | An intelligent target detection and size measurement method based on human visual model | |
| CN113705564B (en) | A method for identifying and reading pointer instruments | |
| CN103593840B (en) | Method for detecting phenotype of Arabidopsis | |
| CN116912691A (en) | A remote sensing image change detection method based on multi-feature evidence fusion and structural similarity | |
| CN109255785A (en) | A kind of bearing open defect detection system | |
| CN112241964B (en) | Light strip center extraction method for line structured light non-contact measurement | |
| CN118446969A (en) | Litchi phenotype parameter detection method and system based on image processing and three-dimensional point cloud | |
| CN108629771A (en) | A kind of blind evaluation method of picture quality with scale robustness | |
| CN104392209B (en) | A kind of image complexity evaluation method of target and background | |
| CN120765660A (en) | Egg oiling quality detection method based on machine vision | |
| CN119206099B (en) | A construction site measurement system based on image processing | |
| CN120721727A (en) | A machine vision-based aluminum-plastic pharmaceutical packaging detection system and method | |
| CN119205870A (en) | A method and system for estimating the mass of underwater swimming fish | |
| CN117739823A (en) | Target ranging method, system and service robot | |
| CN109084721B (en) | Method and apparatus for determining a topographical parameter of a target structure in a semiconductor device | |
| CN116645418A (en) | 2D and 3D camera-based screen button detection method, device and related medium | |
| CN107462221B (en) | A method for automatic measurement of fisheye features | |
| CN119444704B (en) | A droplet detection method and system based on machine vision |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |