Vision-based pitaya section phenotype analysis method
Through the vision-based pitaya cut surface phenotypic analysis method, machine vision technology is used to calculate pitaya cut surface parameters, which solves the problem of large manual measurement errors and difficulty, achieves fast and accurate pitaya cut surface phenotypic parameter measurement, improves efficiency and Automated.
Patent Information
- Application Number
- CN202410809462.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-27
AI Technical Summary
In the existing technology, the calculation of phenotypic parameters of dragon fruit cut surfaces mainly relies on manual measurement, which has the problems of large errors, high difficulty and slow speed, especially for irregular cuts with low accuracy.
A vision-based phenotypic analysis method of dragon fruit cut sections is adopted. Machine vision technology is used to obtain pitaya cut section images. The outline and pulp outline are extracted through preprocessing, the grain area is segmented, the second-order derivative and Bezier curve are calculated, the bracts are removed, and the calculation Longitudinal diameter, transverse diameter and other parameters, and the pulp volume is calculated through the central axis rotation estimation method.
Fast and accurate calculation of pitaya cut surface phenotypic parameters is achieved, which reduces the difficulty and error of manual measurement, improves measurement efficiency, and achieves automation and intelligence.
Smart Images

Figure CN118710700A
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a method for analyzing pitaya cross-section phenotype based on vision. Background Art
[0002] The analysis of pitaya section phenotypic parameters refers to processing the pitaya section image and calculating the parameters such as the longitudinal diameter of the pitaya section, the transverse diameter of the pitaya section, the pitaya shape parameters, the perimeter of the pitaya section, the area of the pitaya section, the thickness of the pitaya rind, the area of the pitaya pulp, the volume of the pitaya pulp and the density of the pitaya seeds. The pitaya section phenotypic parameters reflect the quality of the pitaya to a certain extent. The analysis of the pitaya section phenotypic parameters can be used to formulate pitaya breeding programs and guide the research and development of new pitaya varieties. At the same time, the pitaya section phenotypic parameters are one of the important criteria for measuring the quality of pitaya.
[0003] At present, the calculation of pitaya cross-section phenotypic parameters mainly relies on manual measurement. The manual measurement method has the problems of large error, high difficulty and slow speed. At the same time, for irregular pitaya cross-section, the manual measurement method is difficult and has low accuracy. Summary of the invention
[0004] The purpose of this section is to summarize some aspects of the embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0005] Therefore, the object of the present invention is to provide a vision-based pitaya section phenotypic analysis method, which applies machine vision to the computational analysis of pitaya section phenotypic parameters, can achieve fast and accurate parameter calculation, reduce the difficulty of manual measurement, save a lot of manpower and material resources, and greatly improve the measurement efficiency of pitaya section phenotypic parameters.
[0006] To solve the above technical problems, according to one aspect of the present invention, the present invention provides the following technical solutions:
[0007] A method for analyzing pitaya section phenotype based on vision, comprising:
[0008] S100, obtaining a pitaya cross-section image, obtaining a pitaya cross-section binary image and a pitaya pulp binary image through preprocessing, and extracting a pitaya cross-section contour and a pitaya pulp contour;
[0009] S200, segmenting the pitaya seed region based on the pitaya cross-section binary image, segmenting the pitaya seed adhesion using the heterologous closest point method, and calculating the pitaya seed density;
[0010] S300, based on the cross-sectional profile of the pitaya, calculating the second-order derivative of each point of the profile, determining the inflection point of the cross-sectional profile, calculating the intersection of the tangent equations at the two inflection points, taking the two inflection points and the intersection as control points, calculating the second-order Bezier curve, based on the Bezier curve, removing the pitaya bract area, and calculating the longitudinal diameter, transverse diameter and other parameters of the pitaya;
[0011] S400: Based on the dragon fruit pulp contour, a base point range search method is used to calculate the pulp central axis, and a central axis rotation estimation method is used to calculate the dragon fruit pulp volume.
[0012] As a preferred embodiment of the method for visually analyzing pitaya section phenotype according to the present invention, the pretreatment comprises the following steps:
[0013] Based on the pitaya cross-section image, grayscale processing is performed to obtain a pitaya grayscale image, and the pitaya grayscale image is binarized to obtain a pitaya cross-section binary image, wherein the binarization threshold is set to 40;
[0014] Based on the pitaya cross-section image, the red channel is separated to obtain an image containing the pitaya peel, wherein the specific formula for separating the red channel is:
[0015]
[0016] Among them, P(x,y) is the pixel value of the separated red channel image, B, R, G, are the pixel values of the dragon fruit cross-section image at 0, 1, and 2 respectively;
[0017] Based on the pitaya peel image, noise reduction and contour smoothing processing are performed on the pitaya peel image.
[0018] As a preferred embodiment of the method for visually analyzing cross-section phenotype of pitaya described in the present invention, the heterologous closest point method comprises the following steps:
[0019] Based on the segmented pitaya seed region, extracting a seed region contour;
[0020] Based on the extracted grain region contour, calculating the minimum circumscribed rectangle of the contour;
[0021] Based on the minimum circumscribed rectangle of the seed region outline, two points P and Q on the seed region outline that are away from the diagonal line of the minimum circumscribed rectangle are calculated respectively;
[0022] Based on two points P and Q on the contour, the grain region contour is divided into two segments PQ and QP;
[0023] Based on the PQ segment of the area contour, with point P as the base point, the coordinates of each point on the line segment PQ are traversed in sequence toward point Q, and the coordinates of each point on the line segment PQ are calculated to be the closest point to the line segment QP. Taking point M on the line segment PQ as an example, the closest point N from point M to the line segment QP is calculated. Based on point N, the closest point C from point N to the line segment PQ is calculated. If point C is the same point as point M, then point M and point N are heterologous closest points. If the distance between point M and point N is less than the width of the minimum circumscribed rectangle of the grain area contour, the grain area contour is cut along point M and point N to separate the adhered grains.
[0024] As a preferred embodiment of the method for visually analyzing pitaya section phenotype according to the present invention, the method of removing pitaya bracts by using a second-order Bezier curve comprises the following steps:
[0025] Based on the pitaya cross-section peel image, extracting a contour point set of the peel image;
[0026] Based on the contour point set, the point set is processed continuously, based on the continuous contour curve, the second-order derivative of each point of the contour curve is calculated, and the contour point whose second-order derivative is zero is selected, that is, the contour inflection point;
[0027] Based on the contour inflection point information, the tangent equation of the inflection point is calculated, and all contour inflection point data are traversed in sequence;
[0028] Based on the tangent equation information, the intersection of the tangent equations is calculated, and two tangent equations whose intersection of the tangent equations is outside the inner contour of the peel are selected;
[0029] Based on the two tangent equations, as two base points, and taking the intersection of the two tangent equations as the control point, the second-order Bezier curves where the three points E, F, and C are located are calculated. The specific steps are as follows:
[0030] Let point A on EC, point B on FC, and point D on AB, that is, point D is a point on the second-order Bezier curve. Based on the first-order Bezier curve formula, we can get:
[0031]
[0032] Substituting A and B into D gives the formula for the second-order Bezier curve:
[0033] D(t)=(1-t) 2 E+2t(1-t)F+t 2 C t∈[0,1]
[0034] Based on the second-order Bezier curve, the pitaya bracts are cut off along the two inflection points of the pitaya peel and along the second-order Bezier curve.
[0035] As a preferred embodiment of the method for visually analyzing pitaya cross section phenotypes according to the present invention, the method for calculating the pitaya pulp volume using the central axis rotation estimation method comprises the following steps:
[0036] Based on the central axis of the pitaya pulp, the distance d between each point of the central axis and the edge of the pulp contour is calculated, and the radius set R{d 1 ,d 2 ,...d n};
[0037] Based on the section radius set R{d 1 ,d 2 ,...d n}, use the following formula to estimate the volume V of dragon fruit pulp;
[0038]
[0039] Where h is the physical length of a single pixel.
[0040] Compared with the prior art, the present invention has the following beneficial effects: the present invention applies machine vision to the calculation and analysis of the phenotypic parameters of the pitaya section, which can achieve fast and accurate parameter calculation. At the same time, the method based on machine vision realizes the automation and intelligent calculation of the phenotypic parameters of the pitaya section, reduces the difficulty of manual measurement, saves a lot of manpower and material resources, and greatly improves the measurement efficiency of the phenotypic parameters of the pitaya section. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the present invention will be described in detail below in combination with the accompanying drawings and detailed embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0042] Figure 1 A flow chart of a method for visually analyzing cross-section phenotype of pitaya according to the present invention;
[0043] Figure 2 The cross-sectional image of pitaya provided by the present invention;
[0044] Figure 3 The present invention provides a segmented pitaya peel image;
[0045] Figure 4 The present invention provides a segmented pitaya pulp image;
[0046] Figure 5 A schematic diagram of the principle of the heterogeneous closest point method provided by the present invention;
[0047] Figure 6 A schematic diagram of removing bracts based on a second-order Bezier curve provided by the present invention. DETAILED DESCRIPTION
[0048] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0049] Secondly, the present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention in detail, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0050] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0051] The present invention provides a pitaya section phenotypic analysis method based on vision. Machine vision is applied to the calculation and analysis of pitaya section phenotypic parameters, which can achieve fast and accurate parameter calculation, reduce the difficulty of manual measurement, save a lot of manpower and material resources, and greatly improve the measurement efficiency of pitaya section phenotypic parameters.
[0052] Figure 1 A flowchart showing a method for visually analyzing the cross-section phenotype of pitaya of the present invention is shown in FIG. Figure 1 , a method for analyzing pitaya section phenotype based on vision in this embodiment, the specific steps are as follows:
[0053] S100, obtaining a pitaya cross-section image, obtaining a pitaya cross-section binary image and a pitaya pulp binary image through preprocessing, and extracting a pitaya cross-section contour and a pitaya pulp contour;
[0054] S200, segmenting the pitaya seed region based on the pitaya cross-section binary image, segmenting the pitaya seed adhesion using the heterologous closest point method, and calculating the pitaya seed density;
[0055] S300, based on the cross-sectional profile of the pitaya, calculating the second-order derivative of each point of the profile, determining the inflection point of the cross-sectional profile, calculating the intersection of the tangent equations at the two inflection points, taking the two inflection points and the intersection as control points, calculating the second-order Bezier curve, based on the Bezier curve, removing the pitaya bract area, and calculating the longitudinal diameter, transverse diameter and other parameters of the pitaya;
[0056] S400: Based on the dragon fruit pulp contour, a base point range search method is used to calculate the pulp central axis, and a central axis rotation estimation method is used to calculate the dragon fruit pulp volume.
[0057] The method of the present invention solves the problem of time-consuming and labor-intensive manual calculation of pitaya section phenotypic parameters; realizes automated and intelligent measurement of pitaya section phenotypic parameters, reduces manual measurement errors, and improves the measurement efficiency of pitaya phenotypic parameters; at the same time, the method solves the problem of manual difficulty in calculating the phenotypic parameters of irregular polygonal pitaya sections, thereby achieving the purpose of quickly and accurately obtaining the phenotypic parameters of pitaya section.
[0058] In step S100, a pitaya cross-section image is obtained, and a pitaya cross-section binary image and a pitaya pulp binary image are obtained by preprocessing, and a pitaya cross-section contour and a pitaya pulp contour are extracted, comprising the following steps:
[0059] S110: In this embodiment, due to the physical differences between different pitaya fruits, and the fact that some pitaya fruits are slightly curved, the pitaya fruit is cut with the plane where the main curve of the pitaya fruit is located as the section. The entire section of the pitaya fruit is placed in a scanner, and the image of the pitaya section is obtained by scanning. Figure 2 As shown;
[0060] S120: grayscale processing is performed on the pitaya cross-section image image to obtain a pitaya grayscale image image_gray, and binarization processing is performed on the pitaya grayscale image image_gray to obtain a pitaya cross-section binary image image_binary, wherein the binarization threshold is set to 40;
[0061] S130: Based on the pitaya cross-section image image, separate the red channel image_red to obtain the pitaya peel image image_p, such as Figure 3 As shown, the specific formula for separating the red channel is:
[0062]
[0063] Among them, P(x,y) is the pixel value of the separated red channel image_red at (x,y), and B, R, G are the pixel values of the dragon fruit cross-section image image at 0, 1, and 2 respectively.
[0064] S140: Based on the dragon fruit peel image image_p, perform denoising on the image image_p to obtain a denoised image image_pr. The denoising steps are as follows:
[0065]
[0066] First, an empty set Area is initialized to store the area data of each contour, then the contour set of the image image_pr is extracted, and the area of each contour is calculated, and the area data of each contour is put into the set Area, and the index position of the contour with the largest area in the set Area is calculated in the set Area, and finally the set Area and the contour data of the image image_pr are traversed, and the contour with the least largest area contour and the contour whose parent contour is the largest area contour are filled with pixel value 0 to obtain the denoised image image_pr;
[0067] S150, extracting the denoised contour based on the denoised image image_pr, and performing Gaussian smoothing on the contour curve;
[0068] S160, based on the pitaya cross-section image image, extract the image within the smoothed contour to obtain a pitaya cross-section flesh image image_r, such as Figure 4 As shown, the pitaya cross-section image image is subtracted from the pitaya cross-section image image to obtain the pitaya cross-section peel image image_p;
[0069] In step S200, based on the pitaya section binary image, the pitaya seed region is segmented, the pitaya seed adhesion is segmented using the heterologous nearest point method, and the pitaya seed density and seed area ratio are calculated. The specific steps are:
[0070] S210, segmenting the pitaya seed region based on the pitaya cross-section binary image image_binary;
[0071] S220, based on the pitaya seed region, segmenting the pitaya seed adhesion using a heterologous closest point method, the heterologous closest point method specifically comprising the following steps:
[0072] Step 1: Based on the segmented pitaya seed region, extract the seed region contour;
[0073] Step 2: Based on the extracted seed area contour, calculate the minimum circumscribed rectangle of the contour, such as Figure 5 Shown
[0074] Step 3: Based on the minimum circumscribed rectangle of the seed region outline, two points P and Q on the seed region outline that are away from the diagonal line of the minimum circumscribed rectangle are calculated respectively;
[0075] Step 4: Based on two points P and Q on the contour, the grain area contour is divided into two segments, PQ and QP;
[0076] Step 5: Based on the PQ segment of the area contour, take point P as the base point, traverse the coordinates of each point on the line segment PQ in turn toward point Q, calculate the closest point of each point on the line segment PQ to the line segment QP, take point M on the line segment PQ as an example, calculate the closest point N of point M to the line segment QP, and based on point N, calculate the closest point C of point N to the line segment PQ. If point C is the same point as point M, then point M and point N are heterologous closest points. If the distance between point M and point N is less than the width of the minimum circumscribed rectangle of the grain area contour, cut the grain area contour along point M and point N to separate the adhered grains.
[0077] S230, traversing all seed regions, cutting open all seed adhesion regions, calculating the number of seeds on the pitaya section, calculating the area of the pitaya flesh on the pitaya section, and calculating the distribution density of pitaya seeds;
[0078] In step S300, based on the cross-sectional profile of the pitaya, the second-order derivative of each point of the profile is calculated, the inflection point of the cross-sectional profile is determined, the intersection of the tangent equations at the two inflection points is calculated, the two inflection points and the intersection are used as control points, and the second-order Bezier curve is calculated. Based on the Bezier curve, the pitaya bract area is removed, and the parameters such as the longitudinal diameter and transverse diameter of the pitaya are calculated. The specific steps are:
[0079] S310, based on the pitaya cross-section peel image image_p, extracting a contour point set contours_p of the peel image image_p;
[0080] S320, based on the contour point set contours_p, performing continuity processing on the point set contours_p, based on the continuous contour curve, calculating the second-order derivative of each point of the contour curve, and screening the contour points whose second-order derivative is zero, that is, the contour inflection points;
[0081] S330, based on the contour inflection point information, calculating the tangent equation of the inflection point, and traversing all contour inflection point data in sequence;
[0082] S340, calculating the intersection of the tangent equations based on the tangent equation information, and selecting two tangent equations whose intersection of the tangent equations is outside the inner contour of the peel;
[0083] S350, based on the two tangent equations, as two base points, the intersection of the two tangent equations as a control point, such as Figure 6 As shown, the second-order Bezier curves where the three points (points E, F, and C in the figure) are located are calculated. The specific steps are as follows:
[0084] Let point A on EC, point B on FC, and point D on AB, that is, point D is a point on the second-order Bezier curve. Based on the first-order Bezier curve formula, we can get:
[0085]
[0086] D=(1-t)A+tB
[0087] Substituting A and B into D gives the formula for the second-order Bezier curve:
[0088] D(t)=(1-t) 2 E+2t(1-t)F+t 2 C t∈[0,1]
[0089] S360, based on the second-order Bezier curve, along the two inflection points of the pitaya peel, along the second-order Bezier curve, the pitaya bracts are removed;
[0090] S370, based on the binary image of the cross section of the pitaya peel after removing the bracts, calculating the parameters such as the longitudinal diameter, transverse diameter, perimeter, and area of the pitaya;
[0091] In step S400, based on the dragon fruit pulp contour, the pulp central axis is calculated using the base point range search method, and the dragon fruit pulp volume is calculated using the central axis rotation estimation method. The specific steps are:
[0092] S410, based on the dragon fruit pulp image image_r, extract the contour data of the image image_r, and calculate the pulp center axis by using the base point range search method, the specific steps are as follows:
[0093] Step 1: Based on the dragon fruit pulp image image_r, the dragon fruit pulp contour is divided into C r , C l Two parts;
[0094] Step 2: Based on the contour C r Part, calculate the contour C r Starting point C 0 Distance from the contour C l Recently, P 0 , calculate the point C 0 With P 0 The midpoint is Z, which is the center axis of the dragon fruit pulp 0 ;
[0095] Step 3: Take the point P 0 As the base point, point P 0 With point C 0 The length is the search range, calculate the second point C of the contour 1 Distance from the contour C l The nearest point P 1, calculate the point C 1 With P 1 The midpoint is Z, which is the center axis of the dragon fruit pulp 1 ;
[0096] Step 4: Traverse each point on the contour in turn to extract the center axis of the dragon fruit pulp;
[0097] S420, based on the central axis of the pitaya pulp, using the central axis rotation estimation method, calculating the volume of the pitaya pulp, the specific steps are:
[0098] Step 1: Based on the central axis of the pitaya pulp, calculate the distance d between each point of the central axis and the edge of the pulp contour, and put it into the pitaya pulp section radius set R{d 1 ,d 2 ,...d n}
[0099] Step 2: Based on the section radius set R{d 1 ,d 2 ,...d n}, use the following formula to estimate the volume V of dragon fruit pulp;
[0100]
[0101] Where h is the physical length of a single pixel.
[0102] Various changes and modifications may be made without departing from the spirit and scope of the present invention, and all equivalent technical solutions also belong to the scope of the present invention.
[0103] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0104] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0105] The present invention is described with reference to the flowcharts and / or block diagrams of the method, terminal device (system), and computer program product according to the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0106] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0107] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0108] It should be noted that:
[0109] The "one embodiment" or "embodiment" mentioned in the specification means that the specific features, structures or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present invention. Therefore, the phrases "one embodiment" or "embodiment" appearing in various places throughout the specification do not necessarily refer to the same embodiment.
[0110] In addition, it should be noted that the shapes and names of the parts and components of the specific embodiments described in this specification may be different. Any equivalent or simple changes made based on the structure, features and principles described in the patent concept of the present invention are included in the protection scope of the patent of the present invention. The technicians in the technical field of the present invention can make various modifications or supplements to the specific embodiments described or replace them in a similar manner, as long as they do not deviate from the structure of the present invention or exceed the scope defined by the claims, they should all fall within the protection scope of the present invention.
Claims
1. A method for analyzing pitaya section phenotype based on vision, characterized in that: include: S100, obtaining a pitaya cross-section image, obtaining a pitaya cross-section binary image and a pitaya pulp binary image through preprocessing, and extracting a pitaya cross-section contour and a pitaya pulp contour; S200, segmenting the pitaya seed region based on the pitaya cross-section binary image, segmenting the pitaya seed adhesion using the heterologous closest point method, and calculating the pitaya seed density; S300, based on the cross-sectional profile of the pitaya, calculating the second-order derivative of each point of the profile, determining the inflection point of the cross-sectional profile, calculating the intersection of the tangent equations at the two inflection points, taking the two inflection points and the intersection as control points, calculating the second-order Bezier curve, based on the Bezier curve, removing the pitaya bract area, and calculating the longitudinal diameter, transverse diameter and other parameters of the pitaya; S400: Based on the dragon fruit pulp contour, a base point range search method is used to calculate the pulp central axis, and a central axis rotation estimation method is used to calculate the dragon fruit pulp volume.
2. A method for visually analyzing pitaya section phenotypes according to claim 1, characterized in that: The pre-processing comprises the following steps: Based on the pitaya cross-section image, grayscale processing is performed to obtain a pitaya grayscale image, and the pitaya grayscale image is binarized to obtain a pitaya cross-section binary image, wherein the binarization threshold is set to 40; Based on the pitaya cross-section image, the red channel is separated to obtain an image containing the pitaya peel, wherein the specific formula for separating the red channel is: Among them, P(x,y) is the pixel value of the separated red channel image, B, R, G, are the pixel values of the dragon fruit cross-section image at 0, 1, and 2 respectively; Based on the pitaya peel image, noise reduction and contour smoothing processing are performed on the pitaya peel image.
3. A method for visually analyzing pitaya section phenotypes according to claim 1, characterized in that: The heterologous closest point method comprises the following steps: Based on the segmented pitaya seed region, extracting a seed region contour; Based on the extracted grain region contour, calculating the minimum circumscribed rectangle of the contour; Based on the minimum circumscribed rectangle of the seed region outline, two points P and Q on the seed region outline that are away from the diagonal line of the minimum circumscribed rectangle are calculated respectively; Based on two points P and Q on the contour, the grain region contour is divided into two segments PQ and QP; Based on the PQ segment of the area contour, with point P as the base point, the coordinates of each point on the line segment PQ are traversed in sequence toward point Q, and the coordinates of each point on the line segment PQ are calculated to be the closest point to the line segment QP. Taking point M on the line segment PQ as an example, the closest point N from point M to the line segment QP is calculated. Based on point N, the closest point C from point N to the line segment PQ is calculated. If point C is the same point as point M, then point M and point N are heterologous closest points. If the distance between point M and point N is less than the width of the minimum circumscribed rectangle of the grain area contour, the grain area contour is cut along point M and point N to separate the adhered grains.
4. A method for visually analyzing pitaya section phenotypes according to claim 1, characterized in that: The method of removing pitaya bracts by using a second-order Bezier curve comprises the following steps: Based on the pitaya cross-section peel image, extracting a contour point set of the peel image; Based on the contour point set, the point set is processed continuously, based on the continuous contour curve, the second-order derivative of each point of the contour curve is calculated, and the contour point whose second-order derivative is zero is selected, that is, the contour inflection point; Based on the contour inflection point information, the tangent equation of the inflection point is calculated, and all contour inflection point data are traversed in sequence; Based on the tangent equation information, the intersection of the tangent equations is calculated, and two tangent equations whose intersection of the tangent equations is outside the inner contour of the peel are selected; Based on the two tangent equations, as two base points, and taking the intersection of the two tangent equations as the control point, the second-order Bezier curves where the three points E, F, and C are located are calculated. The specific steps are as follows: Let point A on EC, point B on FC, and point D on AB, that is, point D is a point on the second-order Bezier curve. Based on the first-order Bezier curve formula, we can get: D=(1-t)A+tB Substituting A and B into D gives the formula for the second-order Bezier curve: D(t)=(1-t) 2 E+2t(1-t)F+t 2 C t∈[0,1] Based on the second-order Bezier curve, the pitaya bracts are removed along the two inflection points of the pitaya peel and along the second-order Bezier curve.
5. A method for visually analyzing pitaya section phenotypes according to claim 1, characterized in that: The method of calculating the volume of pitaya pulp by using the central axis rotation estimation method comprises the following steps: Based on the central axis of the pitaya pulp, the distance d between each point of the central axis and the edge of the pulp contour is calculated, and the pitaya pulp section radius set R{d1, d2, ...d n }; Based on the section radius set R{d1, d2, ...d n }, use the following formula to estimate the volume V of dragon fruit pulp; Where h is the physical length of a single pixel.
