A three-dimensional modeling method of blade based on positive and negative images
Through the three-dimensional modeling method based on front and back images, the problems of poor universality and low realism of plant leaf modeling in the existing technology are solved, and efficient and simple 3D modeling and visualization of a variety of plant leaves are achieved. The natural shape of the leaves is retained.
Patent Information
- Application Number
- CN202010945021.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-10
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-09-10
AI Technical Summary
Existing plant leaf modeling methods have poor universality and low realism. They are usually only effective for a single plant and are difficult to fully simulate the natural shape of leaves.
A three-dimensional modeling method based on front and back images is used to achieve 3D modeling by taking photos of the front and back of the leaves, performing background and denoising preprocessing, matching image point pairs, and breaking them into point clouds. Specific steps include taking photos of leaves, preprocessing images, matching image point pairs, calculating depth maps, and obtaining 3D point cloud coordinates.
It realizes the modeling of a variety of plant leaves with good universality and real natural shape. It is simple and fast. It can simulate and visualize plant leaves and retain the natural details of the leaves.
Smart Images

Figure CN112200904B
Abstract
Description
Technical Field
[0001] The invention relates to plant visualization, and in particular to a leaf three-dimensional modeling method based on positive and negative images. Background Art
[0002] Organ morphological modeling is an important part of crop virtual growth research. In the process of simulating crop growth, it is necessary to describe and characterize the changes of various organs of crops. Leaves are one of the important organs of crops. Compared with roots, flowers, and fruits, leaves run through the entire life process of crops. Therefore, the display effect of leaves has a great impact on the simulation of crop growth. The leaves of different crops have irregular shapes and rich texture details. Different methods are often used to simulate leaves with different morphological characteristics.
[0003] The research on plant leaf modeling and simulation mainly includes leaf modeling based on geometric models, leaf modeling based on scanned data sets, and leaf modeling based on images. However, the above methods are not universal, usually one method is only effective for a single plant leaf, and the authenticity needs to be improved. Summary of the invention
[0004] In view of the problems existing in the above methods, the present invention proposes a universal crop leaf modeling method that almost completely reproduces the natural form of plant crop leaves. First, use a mobile phone to collect photos of the front and back of plant leaves; second, perform background processing and other operations on the collected photos of the front and back of the leaves; then, match the photos of the front and back of the leaves based on the obtained results; finally, break up the matched results into point clouds for 3D modeling.
[0005] To achieve the above object, the present invention proposes a blade three-dimensional modeling method based on positive and negative images, comprising the following steps:
[0006] 1) Photograph the front and back sides of the leaf to obtain a pair of original images of the front and back sides of the leaf;
[0007] 2) Preprocessing the front and back leaf original images including background removal and noise removal to obtain front and back preprocessed images containing only leaf information;
[0008] 3) Matching the positive and negative pre-processed images to obtain image pairs with one-to-one correspondence between points;
[0009] 4) Break up the image pairs into point clouds to achieve 3D blade modeling.
[0010] Furthermore, in the above step 2), preprocessing the original images of the front and back leaves includes the following steps:
[0011] 2.1) Input the original image of the front and back blades, and obtain the foreground Fp, background Bp and transparency α of the original image of the front and back blades p ;
[0012] 2.2) Using formula (1), obtain the positive and negative preprocessed images that only retain the leaf information:
[0013] P=α p F p +(1-α p )B p (1) Where P is the color of the original image of the front and back leaves.
[0014] Furthermore, in the above step 3), matching the positive and negative pre-processed images to obtain an image pair includes the following steps:
[0015] 3.1) Take the positive and negative preprocessed images as input, and obtain the highest pixel value and the lowest pixel value, which are denoted as Hp and Lp respectively;
[0016] 3.2) The centroid Cp(X,Y) is obtained by formula (2):
[0017]
[0018]
[0019] Among them, Xi and Yi represent the horizontal and vertical coordinates of the pixel respectively, and Pi represents the RGB value of the pixel;
[0020] 3.3) Calculate the difference between the highest pixel value Hp and the lowest pixel value Lp in the positive and negative pre-processed images respectively, and divide them to obtain the scaling ratio E;
[0021] 3.4) By combining Hp and Lp with the center of mass Cp obtained in step 3.2), the rotation matrix R is obtained by covariance calculation, as shown in formula (3):
[0022]
[0023] [M,N,O]=SVD(H)
[0024] R=MO T (3)
[0025] Among them, D i It is composed of Hp, Lp and Cp. The subscripts A and B represent the positive and negative images respectively, such as C pA represents the centroid of the front image, C pB represents the centroid of the negative face image, and SVD is the covariance function;
[0026] 3.5) Perform continuous iterations to minimize L n , as shown in formula (4):
[0027]
[0028] Among them, B and F represent the negative image matrix and the positive image matrix respectively. The B and F matrices are composed of Hp, Lp and step 3.2)
[0029] Each iteration will update Cp, Hp, Lp, R and E.
[0030] Furthermore, in the above step 4), the 2D image pairs obtained in step 3) are broken up into 3D point clouds, and 3D blade modeling is performed, including the following steps:
[0031] 4.1) The front image is trained with the back image as the reference. The distance difference between the pixels of the front image and the back image is calculated as the depth map of the front image, denoted as G A ; The negative image is trained with the positive image as the benchmark, and is used as the depth map of the negative image, denoted by G B ;
[0032] 4.2) The 2D pixel coordinates of the 2D image pair obtained in step 3) are recorded as [u A , v A , d A ],d A It is the front blade depth map G A The median coordinate is [u A , v A ], and the three-dimensional coordinate value of the pixel point in the front image is recorded as [X A , Y A , Z A ], using the pixel coordinates of the 2D image combined with formula (5) to obtain the 3D point cloud coordinates [X A , Y A , Z A ],:
[0033] Z A =d A / 1000
[0034] X A =(u A -325.5)*Z A / 518
[0035] Y A =(v A -253.5)*Z A / 519 (5)
[0036] 4.3) The pixels of the reverse image are recorded as [X B , Y B , Z B], and its corresponding 2D pixel coordinate value is recorded as [u B , v B , d B ],d B This is the depth map of the reverse blade G B The median coordinate is [u B ,v B ]; the calculation method of the 3D point cloud coordinate value corresponding to the reverse image is the same as step 4.2).
[0037] Compared with the existing methods, the present invention only needs two photos of the front and back of the leaf to achieve real 3D modeling. The 3D modeling method proposed by the present invention has good universality, is simple and fast, and can achieve good modeling effects for a variety of common plant leaves in life, retain the real natural shape of the leaf, and simulate and realize the visualization of the plant leaf. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 Flowchart of the method for blade 3D modeling based on front and back images.
[0039] Figure 2 The original plant leaf image.
[0040] Figure 3 This is the leaf image after background removal.
[0041] Figure 4 is the image pair after matching.
[0042] Figure 5 is the 3D model of the leaf image pair. DETAILED DESCRIPTION
[0043] The present invention is further described below in conjunction with the accompanying drawings and implementation examples.
[0044] like Figure 1 Shown is a flow chart of the method of the present invention, comprising the following steps:
[0045] 1) Take photos of the front and back sides of the leaf to obtain a pair of original images of the front and back leaves, such as Figure 2 As shown;
[0046] 2) Perform preprocessing including background removal and noise removal on the front and back leaf original images to obtain the front and back preprocessed images containing only leaf information, such as Figure 3 As shown;
[0047] 3) Perform matching operations on the positive and negative preprocessed images to obtain image pairs with one-to-one correspondence between points, such as Figure 4 As shown;
[0048] 4) Break up the image pairs into point clouds to achieve 3D leaf modeling, such as Figure 5 shown.
[0049] As a preferred embodiment of the present invention, in step 1 of the present invention, a common plant leaf model is generally picked, the mobile phone is fixed, and the front and back sides of a leaf are photographed; to ensure that subsequent experimental results are more accurate, the position, angle and size of a leaf are kept similar when photographing the front and back sides.
[0050] As a preferred embodiment of the present invention, the preprocessing of the original images of the front and back blades in step 2) includes the following steps:
[0051] 2.1) Input the original image of the front and back blades, and obtain the foreground Fp, background Bp and transparency α of the original image of the front and back blades p ;
[0052] 2.2) Using formula (1), obtain the positive and negative preprocessed images that only retain the leaf information:
[0053] P=α p F p +(1-α p )B p (1)
[0054] Where P is the color of the original image of the front and back leaves.
[0055] As a preferred embodiment of the present invention, matching the positive and negative pre-processed images to obtain an image pair in step 3) includes the following steps:
[0056] 3.1) Take the positive and negative preprocessed images as input, and obtain the highest pixel value and the lowest pixel value, which are denoted as Hp and Lp respectively;
[0057] 3.2) The centroid Cp(X,Y) is obtained by formula (2):
[0058]
[0059]
[0060] Among them, Xi and Yi represent the horizontal and vertical coordinates of the pixel respectively, and Pi represents the RGB value of the pixel;
[0061] 3.3) Calculate the difference between the highest pixel value Hp and the lowest pixel value Lp in the positive and negative pre-processed images respectively, and divide them to obtain the scaling ratio E;
[0062] 3.4) By combining Hp and Lp with the center of mass Cp obtained in step 3.2), the rotation matrix R is obtained by covariance calculation, as shown in formula (3):
[0063]
[0064] [M,N,O]=SVD(H)
[0065] R=MO T (3)
[0066] Among them, D i It is composed of Hp, Lp and Cp. The subscripts A and B represent the positive and negative images respectively, such as C pA represents the centroid of the front image, C pB represents the centroid of the negative face image, and SVD is the covariance function;
[0067] 3.5) Perform continuous iterations to minimize L n , as shown in formula (4):
[0068]
[0069] Where B and F represent the negative image matrix and the positive image matrix respectively. The B and F matrices are composed of Hp, Lp and Cp obtained in step 3.2). Each iteration will update Cp, Hp, Lp, R and E.
[0070] As a preferred embodiment of the present invention, in step 4), the 2D image pairs obtained in step 3) are broken up into 3D point clouds, and 3D blade modeling is performed, including the following steps:
[0071] 4.1) The front image is trained with the back image as the reference. The distance difference between the pixels of the front image and the back image is calculated as the depth map of the front image, denoted as G A ; The negative image is trained with the positive image as the benchmark, and is used as the depth map of the negative image, denoted by G B ;
[0072] 4.2) The 2D pixel coordinates of the 2D image pair obtained in step 3) are recorded as [u A , v A , d A ],d A It is the front blade depth map G A The median coordinate is [u A , v A ], and the three-dimensional coordinate value of the pixel point in the front image is recorded as [X A , Y A , Z A ], using the pixel coordinates of the 2D image combined with formula (5) to obtain the 3D point cloud coordinates [X A , Y A , Z A ],:
[0073] Z A =d A / 1000
[0074] X A =(u A -325.5)*Z A / 518
[0075] Y A =(v A -253.5)*Z A / 519 (5)
[0076] 4.3) The pixels of the reverse image are recorded as [X B , Y B , Z B ], and its corresponding 2D pixel coordinate value is recorded as [u B , v B , d B ],d B This is the depth map of the reverse blade G B The median coordinate is [u B ,v B ]; the calculation method of the 3D point cloud coordinate value corresponding to the reverse image is the same as step 4.2).
[0077] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, without departing from the principles and spirit of the present invention, changes, modifications, substitutions and variations to these embodiments still fall within the scope of protection of the present invention.
Claims
1. A blade three-dimensional modeling method based on positive and negative images, characterized in that: The steps include: 1) Photograph the front and back sides of the leaf to obtain a pair of original images of the front and back sides of the leaf; 2) Preprocessing the front and back leaf original images including background removal and noise removal to obtain front and back preprocessed images containing only leaf information; 3) Matching the positive and negative pre-processed images to obtain image pairs with one-to-one correspondence between points; In the step 3), matching the positive and negative pre-processed images to obtain an image pair comprises the following steps: 3.1) Take the positive and negative preprocessed images as input, and obtain the highest pixel value and the lowest pixel value, which are denoted as Hp and Lp respectively; 3.2) The centroid Cp(X,Y) is obtained by the following formula: Among them, Xi and Yi represent the horizontal and vertical coordinates of the pixel respectively, and Pi represents the RGB value of the pixel; 3.3) Calculate the difference between the highest pixel value Hp and the lowest pixel value Lp in the positive and negative pre-processed images respectively, and divide them to obtain the scaling ratio E; 3.4) By combining Hp and Lp with the center of mass Cp obtained in step 3.2), the rotation matrix R is obtained by covariance calculation, as shown in the following formula: [M,N,O]=SVD(H) RMO T Among them, D i It is composed of Hp, Lp and Cp. The subscripts A and B represent the positive and negative images respectively. pA represents the centroid of the front image, C pB represents the centroid of the negative face image, and SVD is the covariance function; 3.5) Perform continuous iterations to minimize L n , as shown below: Among them, B and F represent the negative image matrix and the positive image matrix respectively. The B and F matrices are composed of Hp, Lp and Cp obtained in step 3.2). Each iteration will update Cp, Hp, Lp, R and E; 4) Break up the image pairs into point clouds to achieve 3D blade modeling; In the step 4), the 2D image pairs obtained in the step 3) are broken up into 3D point clouds, and 3D blade modeling is performed, which includes the following steps: 4.1) The front image is trained with the back image as the reference. The distance difference between the pixels of the front image and the back image is calculated as the depth map of the front image, denoted as G A ; The negative image is trained with the positive image as the benchmark, and is used as the depth map of the negative image, denoted by G B ; 4.2) The 2D pixel coordinates of the 2D image pair obtained in step 3) are recorded as [u A , v A , d A ],d A It is the front blade depth map G A The median coordinate is [u A , v A ], and the three-dimensional coordinate value of the pixel point in the front image is recorded as [X A , Y A , Z A ], using the pixel coordinates of the 2D image combined with the following formula to get the 3D point cloud coordinates [X A , Y A , Z A ],: Z A =d A / 1000 X A =(u A -325.5)*Z A / 518 Y A =(v A -253.5)*Z A / 519 4.3) The pixels of the reverse image are recorded as [X B , Y B , Z B ], and its corresponding 2D pixel coordinate value is recorded as [u B , v B , d B ],d B This is the depth map of the reverse blade G B The median coordinate is [u B ,v B ]; the calculation method of the 3D point cloud coordinate value corresponding to the reverse image is the same as step 4.2).
2. The blade three-dimensional modeling method based on positive and negative images according to claim 1, characterized in that: In the step 2), preprocessing the original images of the front and back leaves includes the following steps: 2.1) Input the original image of the front and back blades, and obtain the foreground Fp, background Bp and transparency α of the original image of the front and back blades p ; 2.2) Use the following formula to obtain the positive and negative preprocessed images that only retain the leaf information: P=a p F p +(1-a p )B p Where P is the color of the original image of the front and back leaves.
