A kind of fruit phenotype test method based on computer visionTechnical field
The present invention relates to a kind of fruit phenotype test methods based on computer vision, belong to image recognition technology neckDomain.
Background technique
As people's quality of the life constantly improves, to fruit (such as corncob, wheatear, apple, banana)Quality and output demand are higher and higher, and it is an important link, fruit phenotype that fruit, which surveys production, during plant productionLength, diameter, the color of middle fruit are to survey index important in production.At this stage, fruit, which is surveyed, produces in the process by artificial completeAt fruit phenotype test, great work intensity, working efficiency are low, measurement error rate is high;Fruit table is carried out by instrumentType measurement, accuracy is more manually obviously improved, but minute is long, in addition because by light, irradiating angle etc. it is extraneous becauseElement influences, and the fruit color of measurement also has certain error.Currently, this status can be changed by lacking a method.
Summary of the invention
The present invention to solve the above-mentioned problems, provides a kind of fruit phenotype test side based on computer visionMethod includes the following steps:
Step 1, fruit is taken pictures: fruit being fixed on survey production accessory plate and is taken pictures, fruit is obtainedImage;It includes measured zone and standard color card region that wherein the survey, which produces accessory plate, and the fruit is fixed on the surveyMeasure region;
Step 2, binary conversion treatment: 0 or 255 is set by the gray value of the pixel of the fruit image of step 1, is madeIt obtains entire fruit image and black and white effect is presented;
Step 3, the fruit image after step 2 binary conversion treatment edge detection: is subjected to edge detection;
Step 4, outer profile confirms: after the edge detection of step 3, the outer profile of fruit in two-dimensional surface is extracted,The vertical and horizontal line of measurement plate, scale and fruit plane outer profile are only showed in final image;
Step 5, length and diameter measures: the fruit characteristic image that step 4 generates is calculated by PYTHON OPENCVMethod obtains the minimum external matrix comprising characteristic image, and MINAREARECT algorithm is used to obtain fruit length and diameter;
Step 6, color region divides: the fruit characteristic image that step 1 generates is divided into multiple color regions, thisA little color regions are used for the comparison of next step, and color region division is finer, and measurement result is more accurate;
Step 7, colour measurement: each field color that step 3 is divided is compared with standard color card, finds consistent colour atla,The color value that each region colour atla obtains is reverted into the divided each region of fruit, each colour atla can mark exclusion anyThe actual color value of colour atla after interference, because under the influence of the extraneous factors such as intensity of illumination, lighting angle direction, shooting distance,The color value of reaction and difference is actually had existed, and obtain colour atla label color value, can obtain that be tested fruit phenotype trueReal color.
Further, it is magnetic panel that the survey, which produces accessory plate material,.
Further, the measured zone is by the vertical intertexture component units lattice matrix of several horizontal lines and vertical line, and eachCell has scale.
Further, the minimum scale value of the horizontal line and vertical line is 2.5 pixels.
It further, further include fixator, the fixator magnetic produces auxiliary plate top surface in the survey.
3. beneficial effect
In conclusion the beneficial effects of the invention are that:
(1) the present invention provides a kind of fruit phenotype test method based on computer vision, the method is by surveyIt produces accessory plate to be measured fruit phenotype, image procossing is carried out by series of computation machine vision technique, is passed throughPYTHON OPENCV algorithm obtains the minimum external matrix comprising characteristic image can using function MINAREARECT algorithmAccurately obtain the length and diameter of fruit;
(2) present invention is compared by dividing fruit colour generation region and standard color card, excludes external interference factor, reductionThe actual color of fruit phenotype.A kind of fruit phenotype test method based on computer vision, solves previous plantDeficiency present in the measurement of object fruit phenotype can accomplish that measurement rapidly and efficiently, measurement accuracy rate are high, provide to survey to produce to analyzeAccurate data information.
Detailed description of the invention
Fig. 1 is that survey of the invention produces accessory plate schematic diagram;
Fig. 2 is measurement flow chart of the invention;
Fig. 3 is the fruit length of fruit phenotype of the present invention, diameter algorithm schematic diagram.
Figure label: 1-, which is surveyed, produces accessory plate;2- measurement plate;3- standard color card;4- fixator.
Specific embodiment
The present invention will be further described combined with specific embodiments below, but the present invention should not be limited by the examples.
Embodiment: for using corncob as tested fruit
It refers to shown in attached drawing 1 to attached drawing 3, a kind of fruit phenotype test method based on computer vision, includingFollowing steps:
Step 1, corncob to be measured is put in the measured zone 2 surveyed and produce accessory plate 1, is being measured if you need to stablize corncobThe fixator 4 is mounted in measured zone 2 by 2 position of region, corncob is then inserted into 4 top of fixator, soIt takes pictures afterwards to corncob, obtains corncob image;
Step 2, binary conversion treatment: setting 0 or 255 for the gray value of the pixel of the corncob image of step 1, so thatBlack and white effect is presented in entire corncob image;
Step 3, the corncob image after step 2 binary conversion treatment edge detection: is subjected to edge detection;
Step 4, outer profile confirms: after the edge detection of step 3, extracting the outer profile of corncob in two-dimensional surface, InThe vertical and horizontal line of measurement plate, scale and corncob plane outer profile are only showed in final image;
Step 5, the corncob characteristic image that step 4 generates corncob length and measuring diameter: is passed through into PYTHONOPENCV algorithm obtain include characteristic image minimum external matrix, using MINAREARECT algorithm obtain corncob length withDiameter;
Step 6, color region divides: the corncob characteristic image that step 1 generates is divided into multiple color regions;
Step 7, corncob colour measurement: each field color that step 3 is divided is compared with standard color card, is found consistentThe color value that each region colour atla obtains is reverted to the divided each region of corncob, shows the true face of corncob by colour atlaColor.
Although the present invention has been disclosed in the preferred embodiment as above, it is not intended to limit the invention, any to be familiar with thisThe people of technology can do various changes and modification, therefore protection of the invention without departing from the spirit and scope of the present inventionRange should subject to the definition of the claims.