One grows cotton splits bell phase automatic testing method
Technical field
The invention belongs to the field that Digital Image Processing and agrometeorological observation intersect, be specifically related to one and grow cotton and split bell phase automatic testing method.
Background technology
Cotton is one of main industrial crops of China, and the output of cotton of China is also in rank first.Bell phase of splitting of cotton is the important puberty of in cotton growth, and this puberty is key period of output of cotton quality responses, is therefore also the important period of cotton field management.In this phase, cotton root system activity weakens gradually, and the ability absorbing nutrient obviously declines, and the emphasis in production is Bao Genye, anti-early ageing, increasing bell weight and diseases prevention worm.Therefore, cotton is split the monitoring of bell phase and identifies that just to seem very important.Cotton grower can apply fertilizer to cotton field according to the growing state of cotton and the process such as diseases prevention worm timely, has positive meaning for the total production ensured and increase cotton.Generally speaking, the bell phase of splitting of cotton is an important content of agrometeorological observation.
For a long time, the main mode of artificial observation record that adopts carries out record to cotton development stage relevant information, and observed result, owing to can be subject to the impact of observation person's subjective factor, causes application condition large; Meanwhile, because the growth cycle of cotton is longer, the scope of cotton planting is comparatively wide, solely utilizes the method manually carrying out observing to take time and effort.There is no method energy automatic Observation cotton at present and split the bell phase, and forecast.
Summary of the invention
For above defect or the Improvement requirement of prior art, the invention provides a kind of cotton based on image and split bell phase automatic identifying method, its object is to utilize the cotton digital picture of field Real-time Obtaining to detect exactly, whether cotton enters splits the bell phase, solves the technical matters that there is no robotization at present thus.
For achieving the above object, according to the present invention, provide one and grow cotton and split bell phase automatic testing method, comprise the following steps:
(1) cotton boll position in picture is obtained: gather cotton field image, and include described image in cotton field image sequence; By all images in the image sequence of cotton field, according to a fixed step size, split into M × N pixel subimage; To all subimages, use cotton boll sorter to judge whether to comprise cotton boll: for the subimage comprising cotton boll, record its position in original image as final cotton boll position; Described cotton boll sorter is set up as follows: select the picture of M × N pixel as the positive negative sample of training, wherein positive sample is the cotton boll picture of different attitude, negative sample is non-cotton boll picture in cotton field, extract SIFT feature amount, Training Support Vector Machines, make support vector machine false positive rate minimum, thus build cotton boll sorter;
(2) cotton boll image is split: in the cotton field image gathered in step (1), obtain the subimage of all final cotton boll positions, RGB color mode or HSI color mode is adopted to be converted to gray level image, then greyscale image transitions is become continuous print bianry image, morphological images disposal route is adopted to detect cotton boll edge, segmentation cotton boll image;
(3) judge to split the bell phase: the cotton boll image that step (2) is partitioned into, carry out white Crack Detection, and extract white crack, according to the shape facility in white crack, determine whether cotton boll crack; Then think to enter if there is cotton boll crack and split the bell phase, otherwise think not enter and split the bell phase.
Preferably, described cotton splits bell phase automatic testing method, the positive sample of cotton boll sorter described in it be edge contour clearly, the cotton boll picture that full, human eye also can be observed to split bell-shaped condition.
Preferably, described cotton splits bell phase automatic testing method, carries out local restriction uniform enconding to SIFT feature amount.
Preferably, described cotton splits bell phase automatic testing method, and its step (1) comprises following sub-step:
(1-1) gather cotton field image, and include described image in cotton field image sequence;
(1-2) coarse search cotton boll position:
First, according to certain coarse search order, with coarse search step-length, all images in the image sequence of cotton field are split into the subimage of M × N pixel; Then, using cotton boll sorter to judge splitting the subimage obtained, obtaining the mark value of each subimage; Finally, record the subimage position that its mark value exceedes coarse search threshold value, as coarse search cotton boll position;
(1-3) fine searching cotton boll position
First, for each coarse search cotton boll position, using a certain size scope near coarse search cotton boll position as fine searching scope; Then, within the scope of fine searching, according to certain fine searching order, with fine searching step-length, image is split into the subimage of M × N pixel; Next, using cotton boll sorter to judge splitting the subimage obtained, obtaining the mark value of each subimage; Finally, record the subimage position that its mark value exceedes fine searching threshold value, as fine searching cotton boll position;
(1-4) record and follow the tracks of cotton boll position
To the fine searching cotton boll position of record in step (1-3), adopt non-maxima suppression to remove the cotton boll position of redundancy, only retain the maximum position of cotton boll sorter mark value as cotton boll final position, and record this position as cotton boll position;
(1-5) all cotton boll positions are obtained
In records series, the cotton boll position of all images is as final cotton boll position, in the cotton field image that step (1-1) gathers, selects the subimage of final cotton boll position as the process of subsequent singulation cotton boll.
Preferably, described cotton splits bell phase automatic testing method, cotton field image described in its step (1-1) is the longitudinal front view in cotton field, its light intensity is identical with cotton boll sorter training sample, by the collected by camera being not less than 4,000,000 pixels, described camera is overhead high 0.3 meter, focal length 14 millimeters, northwards arrange, level is taken; The preferred image collection moment is when being 20.
Preferably, described cotton splits bell phase automatic testing method, and the thick fractionation order described in its step (1-2) is from left to right, from top to bottom; Described coarse search step-length is 30 pixels; Described coarse search threshold value be make false positive rate be 6% ~ 9% cotton boll sorter threshold value.
Preferably, described cotton splits bell phase automatic testing method, and the fine searching scope described in its step (1-3) is the image-region that coarse search cotton boll position respectively expands 5 pixels to the right downwards; Described thin fractionation order is from left to right, from top to bottom; Described fine searching step-length is 1 pixel; Described fine searching threshold value is make false positive rate be cotton boll sorter threshold value within 1%.
Preferably, described cotton splits bell phase automatic testing method, and its step (2) comprises following sub-step:
(2-1) judge cotton boll position: when in the region that cotton boll position is in entire image 1/3, then retain the cotton boll position subimage of RGB color mode; Otherwise, be converted into the cotton boll position subimage of HSI color mode;
(2-2) obtain cotton boll gray level image: for the cotton boll position subimage of RGB color mode, select the green component image in RGB color mode to convert gray level image to; For the cotton boll position subimage of HSI color mode, the saturation degree component image in HSI color mode is selected to convert gray level image to;
(2-3) cotton boll bianry image is obtained: setting threshold value, becomes bianry image by cotton boll position subimage greyscale image transitions;
(2-4) obtain cotton boll primary segmentation image: first, by holes filling in the middle of the multiple connected domains in the image of described binaryzation, obtain connected region; Then, use edge detector, rim detection is carried out to cotton boll position subimage gray level image, obtain cotton boll image border; Finally, calculation is shipped to the connected region of described bianry image and cotton boll image border, obtains cotton boll primary segmentation image;
(2-5) obtain cotton boll segmentation and cut image: for cotton boll primary segmentation image, utilize morphological images disposal route to carry out thin Iamge Segmentation, finally obtain cotton boll segmentation image.
Preferably, described cotton splits bell phase automatic testing method, and the edge detector described in its step (2-4) is canny edge detector.
Preferably, described cotton splits bell phase automatic testing method, and its step (3) comprises following sub-step:
(3-1) in the cotton boll interior zone split, white image is extracted: the cotton boll region split, adopt environment self-adaption dividing method, super green operator dividing method, the method such as crop image partition method based on Mean Shift, again carrying out white splits;
(3-2) detect white crack: for the white image be partitioned in step (3-1), extract the length breadth ratio of its minimum enclosed rectangle or the axial ratio of its minimum external ellipse, as shape facility descriptor; Threshold value is set, retains its shape facility descriptor and be more than or equal to the white image of threshold value as white crack;
(3-3) judge whether cotton arrives and split the bell phase: in a cotton boll position subimage, add up white crack number, if white crack number is more than or equal to 1, then judges that cotton field enters and split the bell phase; Otherwise, to the cotton field image taken next time, repeat step (1) to step (3).
In general, the above technical scheme conceived by the present invention compared with prior art, because the present invention carries out image procossing to gathered real-time forward sight cotton field image automatically, the method of machine learning is utilized to build cotton boll sorter, and in conjunction with splitting the change of bell phase cotton boll morphological feature, utilize color mode to change and morphological images disposal route, and then judge whether cotton enters and split the bell phase.The method, using the cracking situation of cotton cotton boll as basis for estimation, judges cotton growing stage in real time, and testing result accuracy rate is high, has important directive significance to the farming activities of cotton.
Meanwhile, the present invention adopts SIFT feature amount to be the local feature of image, and it maintains the invariance to rotation, scaling, brightness change, to the stability that visual angle change, affined transformation, noise also keep to a certain degree; Moreover, SIFT feature uniqueness is good, informative, is applicable to mate fast and accurately in magnanimity property data base.
Preferred version, select edge contour clearly, full, human eye also can be observed to split the cotton boll picture of bell-shaped condition as positive sample, the classifying quality of sorter can be significantly improved, thus from the cotton field image of complexity, cotton boll position subimage detected accurately.
Preferred version, adopts LLC coding method, encodes to SIFT feature, significantly can shorten cotton boll detection time.
Preferred version, adopts the method that coarse search and fine searching combine, can under the prerequisite ensureing cotton boll detection accuracy, shortens cotton boll detection time.
Preferred version, according to cotton boll position, adopts different color modes to do image procossing, can ensure the accuracy of cotton boll Iamge Segmentation to greatest extent.
Preferred version, detects white crack in cotton boll inside, can avoid the white crack image disruption in non-cotton boll region, reduce false positive rate, thus accurately observation cotton boll splits the bell phase.
Accompanying drawing explanation
Fig. 1 is that cotton provided by the invention splits bell phase automatic testing method process flow diagram;
Fig. 2 is longitudinal front view between 20 Cotton Fields taken on August 24th, 2012 of cotton field;
Fig. 3 is the embodiment 2 coarse search cotton boll location drawing;
Fig. 4 is the final cotton boll location drawing of embodiment 2;
Fig. 5 is embodiment 2 cotton boll image to be split;
Fig. 6 is to cotton boll position subimage result figure under RGB color mode;
Fig. 7 is the result figure that embodiment 2 detects white crack;
Fig. 8 is longitudinal front view between 20 Cotton Fields taken on August 31st, 2012 of cotton field;
Fig. 9 is the embodiment 3 coarse search cotton boll location drawing;
Figure 10 is the final cotton boll location drawing of embodiment 3;
Figure 11 is embodiment 3 cotton boll image to be split;
Figure 12 is to cotton boll position subimage result figure under HSI color mode;
Figure 13 is the result figure that embodiment 2 detects white crack.
Wherein, Fig. 6 (a) is embodiment 2 edge detection results image, Fig. 6 (b) is the cotton boll image that embodiment 2 primary segmentation is good, Fig. 6 (c) is the cotton boll image after the operation of embodiment 2 morphological erosion, Fig. 6 (d) is the image that embodiment 2 obtains largest connected territory, Fig. 6 (e) is embodiment 2 finally segmentation cotton boll bianry image, and Fig. 6 (f) is embodiment 2 finally segmentation cotton boll image;
Fig. 7 (a) is the white segmentation result image of embodiment 2, and Fig. 7 (b) is the white Crack Detection result images of embodiment 2;
Figure 12 (a) is embodiment 3 edge detection results image, Figure 12 (b) is the cotton boll image that embodiment 2 primary segmentation is good, Figure 12 (c) is the cotton boll image after the operation of embodiment 3 morphological erosion, Figure 12 (d) is the image that embodiment 3 obtains largest connected territory, Figure 12 (e) is embodiment 3 finally segmentation cotton boll bianry image, and Figure 12 (f) is embodiment 3 finally segmentation cotton boll image;
Figure 13 (a) is the white segmentation result image of embodiment 3, and Figure 13 (b) is the white Crack Detection result images of embodiment 3.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.In addition, if below in described each embodiment of the present invention involved technical characteristic do not form conflict each other and just can mutually combine.
Provided by the invention one grows cotton splits bell phase automatic testing method, comprises the following steps:
(1) cotton boll position in picture is obtained
Cotton boll position, refers to the cotton field subimage comprising cotton boll, is preferably the cotton field subimage scope of 90 × 90.
(1-1) cotton field image is gathered
In the present invention preferred cotton field image sequence cotton field longitudinal direction front view picture of (when evening 8) when being every day 20.Image acquisition request: camera is overhead high 0.3 meter, focal length 14 millimeters, northwards, be 0 degree with local horizon angle, resolution is not less than 4,000,000 pixels to horizontal shooting direction.Due to the illumination that the growth needs of cotton is strong, cotton boll and the smooth surface of blade can produce mirror-reflection, can cause negative impact to the identification in cotton boll and white crack.Therefore with in the whole day of fixed position and attitude shooting not longitudinal front view in the same time, we select to every day 20 time the image that gathers carry out image procossing, thus improve and identify accuracy, reduce cotton and split the difficulty that the bell phase identifies.
Include the cotton field image of collection in cotton field image sequence.
(1-2) coarse search cotton boll position.
First according to certain coarse search order, with coarse search step-length, all images in the image sequence of cotton field are split into the subimage of M × N pixel.Using cotton boll sorter to judge splitting the subimage obtained, obtaining the mark value of each subimage.Record the subimage position that its mark value exceedes the coarse search threshold value of setting, as coarse search cotton boll position.
Coarse search order has influence on search utility design, and coarse search order is preferred from left to right, from top to bottom; Coarse search step-size influences is to the time that cotton boll is searched for and precision, and the faster precision of step-length larger fractionation speed is lower, and the slower precision of step-length less fractionation speed is higher, and coarse search step-length is 30 pixels preferably; Coarse search threshold value, have influence on the performance of coarse search, coarse search threshold value is higher, specificity is higher, and susceptibility is lower, and coarse search threshold value is lower, specificity is lower, susceptibility is higher, in order to equilibrium sensitive and specificity are selected, makes false positive rate be that the cotton boll sorter threshold value of 6% ~ 9% is as coarse search threshold value.Threshold value when false positive rate is 6% ~ 9%, threshold value specifically determine that mode can regulate voluntarily according to picture size and accuracy requirement.
(1-3) fine searching cotton boll position
For each coarse search cotton boll position, using a certain size scope near it as fine searching scope.Within the scope of fine searching, according to fine searching order, with fine searching step-length, image is split into M × N pixel subimage.Using cotton boll sorter to judge splitting the subimage obtained, obtaining the mark value of each subimage.Fine searching threshold value is set, records the subimage position that its mark value exceedes fine searching threshold value, as fine searching cotton boll position.
Fine searching scope, affects cotton boll search speed, and preferred fine searching scope is the image-region that coarse search cotton boll position respectively expands 5 pixels to the right downwards; Fine searching order has influence on search utility design, and fine searching order is preferred from left to right, from top to bottom; Fine searching step-size influences is to the time that cotton boll is searched for and precision, the faster precision of step-length larger fractionation speed is lower, and the slower precision of step-length less fractionation speed is higher, because fine searching requires that search precision is higher, and hunting zone is less, therefore preferably fine searching step-length is 1 pixel; Fine searching threshold value, have influence on the performance of fine searching, fine searching threshold value is higher, specificity is higher, and susceptibility is lower, and fine searching threshold value is lower, specificity is lower, susceptibility is higher, for ensureing that the cotton boll that searches is real cotton boll, selects to make false positive rate to be that cotton boll sorter threshold value within 1% is as fine searching threshold value.Make false positive be cotton boll sorter threshold value within 1%, threshold value specifically determine that mode can regulate voluntarily according to picture size and accuracy requirement.
(1-4) record and follow the tracks of cotton boll position.
Owing to blocking by wind direction, blade and camera shake and the impact of cotton boll position skew that causes, also in order to reduce the loss of cotton boll, the fine searching step-length arranged can not be less, same cotton boll is avoided to be arrived by repeated detection in a width figure, to the result of fine searching, the method of non-maxima suppression is adopted to remove the cotton boll position of redundancy, the cotton boll position of namely recording within the scope of fine searching, only retain the maximum position of cotton boll sorter mark value as cotton boll final position, and record this position as cotton boll position.
(1-5) all cotton boll positions are obtained.
Cotton boll position in record image sequence in all images, as final cotton boll position, in the image that step (1-1) gathers, selects the subimage of final cotton boll position as the process of subsequent singulation cotton boll.
Because camera is fixing, the upgrowth situation of cotton boll is also relatively stable, therefore for using same scene as the sequence image of object of finding a view, select to carry out tracking observation to all cotton boll positions detected, further can guarantee the verification and measurement ratio of cotton boll, reduce loss, simultaneously can than the situation of growing of more comprehensive tracking observation cotton boll, reduce the impact due to blocking of causing of wind direction, leaf growth and other factors.
Described cotton boll sorter builds in accordance with the following methods:
First, the picture of M × N pixel is as the positive negative sample of training.Wherein positive sample is the cotton boll picture of different attitude, in order to reduce false positive rate, only select edge contour comparatively clearly, full, human eye also can be observed the cotton boll picture splitting bell-shaped condition, can be observed the crack of cotton boll after cracking; Choose the negative sample of subimage picture as training of non-cotton boll in the longitudinal front view in shooting cotton field.The positive negative sample of training will adapt with cotton boll image, can know complete reflection cotton boll pattern, its preferred image size 90 × 90 pixel.
Then, extract the SIFT feature amount in acquired positive and negative samples pictures, and SIFT feature amount is carried out local restriction uniform enconding, obtain the positive training sample of input sorter and negative training sample characteristic quantity.SIFT(scale invariant feature transform) characteristic quantity, i.e. Scale invariant features transform characteristic quantity, see document David G.Lowe.Object recognition from localscale-invariant features [C] .International Conference on Computer Vision, Corfu, Greece, 1999 (9): 1150-1157. and document David G.Lowe.Distinctive Image Featuresfrom Scale-Invariant Keypoints [C] .International Journal of Computer Vision, 60, 2 (2004): 91-110.In order to improve the efficiency of algorithm, adopt LLC(Locality-constrainedLinear Coding) i.e. local restriction uniform enconding, the SIFT feature extracted is encoded, obtains the local feature reconstructed after encoding.For feature coding, have the methods such as hard ballot, sparse coding, wherein LLC coding is a kind of coding characteristic method of feature based bag (bag-of-features) model or code book (codebook) model, in the classification task of natural image, show excellence.See document Wang J J, Yang J C, Yu K, et al.Locality-constrained linear coding for imageclassification [ C ] .IEEE Conference on Computer Vision and PatternRecognition (CVPR) .2010:3360-3367.SIFT feature is only local feature via the LLC feature obtained of encoding, and is the equal of that LLC coding reconstructs original SIFT feature.
Finally, use support vector machine (SVM) as sorter, select radial basis (RBF) kernel function, input the characteristic quantity of positive training sample and negative training sample, sorter is trained, obtain cotton boll sorter.Support vector machines (Support Vector Machine) is that first Vapnik proposed in nineteen ninety-five.As the trainable machine learning method of one, SVM has certain advantage in solution small sample, non-linear and high dimensional pattern.Support vector machine method between the complicacy and learning ability of model, seeks best compromise, to obtaining best Generalization Ability (generalization ability) according to limited sample information.Due to the restriction of image, the positive number of samples of cotton boll of the multi-pose obtained is few, uses SVM method to carry out training and can obtain suitable cotton boll sorter.If expand the capacity of positive sample and negative sample, the better cotton boll sorter of classifying quality can be obtained.
(2) cotton boll image is partitioned into
The content that sky, cotton plants, soil, weeds etc. are abundant is included in the cotton field image that step (1-1) obtains, the corresponding also more complicated of local environment residing for cotton boll of diverse location place growth and being not quite similar, therefore the environmental factor in subimage still can affect the effect of segmentation.Therefore we carry out dividing processing to the cotton boll in subimage in different color modes, obtain cotton boll image.
(2-1) position of cotton boll is judged.
The cotton boll being in diverse location place is put in different color modes and carries out image procossing.
If cotton boll position is in the region of in entire image 1/3, then think that cotton boll image contacts with sky, then just in RGB color mode, cotton boll position subimage is processed, retain the cotton boll position subimage of RGB color mode; Otherwise, think that cotton boll image does not contact with sky, then cotton boll position subimage be transformed into HSI color mode from RGB color mode and process, be namely converted into the cotton boll position subimage of HSI color mode.
(2-2) cotton boll gray level image is obtained.
Cotton boll is partitioned in rgb space:
By the subimage in the rectangle frame of cotton boll position, be transformed into RGB color mode, namely coloured image is converted to red, green, blue component image.In order to make the effect of Iamge Segmentation process reach best, selecting the green component image in RGB color mode to deal with, converting gray level image to by cotton boll position subimage RGB color image.
Cotton boll is partitioned in HSI space:
By the subimage in the rectangle frame of cotton boll position, be transformed into HSI color mode, i.e. colourity, saturation degree, luminance component image.In order to make the effect of Iamge Segmentation process reach best, selecting the saturation degree component image in HSI color mode to deal with, convert gray level image to by cotton boll position subimage coloured image and carried out histogram equalization operation, obtaining cotton boll gray level image.
(2-3) cotton boll bianry image is obtained.
By cotton boll position subimage gray level image, according to the threshold value of setting, convert bianry image to: due to we want to cotton boll region be a large connected domain, therefore in order to the complete of cotton boll connected domain and subsequent operation will be ensured conveniently, every gray-scale value is greater than the pixel of threshold value, then the gray-scale value of this pixel is become 0, otherwise the gray-scale value of this pixel is become 255, make large connected region be the image of white as cotton boll bianry image, otherwise using image negate as cotton boll bianry image.
(2-4) cotton boll primary segmentation image is obtained.
First, by holes filling in the middle of the multiple connected domains in the image of described binaryzation, connected region is obtained; Then, use edge detector, as canny edge detector, rim detection is carried out to cotton boll position subimage gray level image, obtain cotton boll image border; Finally, calculation is shipped to the connected region of described bianry image and cotton boll image border, obtains cotton boll primary segmentation image.
(2-5) obtain cotton boll segmentation and cut image.
Thin Iamge Segmentation is carried out for cotton boll primary segmentation imagery exploitation morphological images disposal route, finally obtains cotton boll segmentation image.
(3) judge to split the bell phase.
(3-1) in the cotton boll interior zone split, white image is extracted.
Again carry out white segmentation in the cotton boll region split, concrete dividing method can adopt environment self-adaption dividing method, super green operator dividing method, the method such as crop image partition method based on Mean Shift.(see [1] Lei F.Tian.Environmentally adaptive segmentationalgorithm for outdoor image segmentation.Computers and electronics inagriculture, 1998,21:153 ~ 168); [2] D.M.Woebbecke, G.E.Meyer, K.VonBargen, D.A.Mortensen.Color Indices for weed identification under varioussoil, residue, and lighting conditions.Transactions of the ASAE, 1995,38 (1): 259 ~ 269); [3] Zheng L, Zhang J, Wang Q.Mean-shift-based colorsegmentation of images containing green vegetation.Computers and Electronicsin Agriculture, 2009,65:93-98.)
(3-2) white crack is detected.
Utilize dividing method to cut on image in cotton boll segmentation and carry out white detection, the features of shape being aided with white crack self " long and narrow property " is split cotton boll region.
Because blade height is reflective and the impact of the accuracy of separation, the white detected after white cutting operation is also not all the white crack occurred after cotton boll splits bell, therefore will process image according to the shape facility of the connected domain that will split.
For the white image be partitioned in step (3-1), extract the length breadth ratio of its minimum enclosed rectangle or the axial ratio of its minimum external ellipse, as shape facility descriptor; Retain its shape facility descriptor and be more than or equal to the white image of set threshold value as white crack.
Shape facility descriptor can adopt length breadth ratio (axial ratio) of Fourier descriptor, eccentricity, connected domain minimum enclosed rectangle (or oval) etc.
Preferred version, according to the shape facility of the white connected domain (white crack) that will detect, white crack self " long and narrow property " is utilized to split the white portion detected, the shape descriptor of corresponding selection is the axial ratio of the minimum external ellipse of connected domain, white connected domain axial ratio being less than threshold value is removed, and retains the connected domain that axial ratio is more than or equal to set threshold value.
(3-3) judge whether cotton arrives and split the bell phase.
After obtaining the white crack pattern picture finally split, add up the number of white crack (white long and narrow connected domain).Owing to only comprising a cotton boll in each positive sample for training, when the sorter therefore obtained after using training detects image, the number including cotton boll in the rectangular area of cotton boll at every turn detected only has one.A cotton boll has at most 5 cracks, but may owing to can be subject to the impact of taking cotton boll angle, and the crack can observed from image may only have 1 ~ 2.Therefore, if detect that namely adularescent crack judges that cotton enters and split the bell phase; Otherwise, judge that cotton does not enter and split the bell phase.
Be below embodiment:
Embodiment 1
Build cotton boll sorter:
First, size is selected to be that the picture of 90 × 90 pixels is as the positive negative sample of training.Wherein, positive sample is the cotton boll picture of different attitude, and the cotton boll edge contour in cotton boll picture is clear, full, human eye also can be observed to split bell-shaped condition; Negative sample is the subimage picture of non-cotton boll in the longitudinal front view in cotton field.
Then, extract the SIFT feature amount in acquired positive and negative samples pictures, and SIFT feature amount is carried out local restriction linear (LLC) coding, obtain the positive training sample of input sorter and negative training sample characteristic quantity.
Finally, use support vector machine (SVM) as sorter, select radial basis (RBF) kernel function, input the characteristic quantity of positive training sample and negative training sample, sorter is trained, obtain cotton boll sorter.
Embodiment 2
Whether the cotton using method provided by the invention to judge in Fig. 2 enters splits the bell phase:
(1) cotton boll position in picture is obtained.
(1-1) the longitudinal front view image sequence in cotton field is gathered.
Camera is overhead high 0.3 meter, focal length 14 millimeters, and horizontal shooting direction northwards, is 0 degree with local horizon angle, resolution 4,000,000 pixel, when gathering 20 the cotton field of (when evening 8) longitudinally before image, as shown in Figure 2.
(1-2) coarse search cotton boll position.
First according to order from left to right from top to bottom, with 30 pixels for step-length, the image obtained is split the subimage obtaining 90 × 90 pixels in step (1-1).Use the cotton boll sorter obtained in embodiment 1 to judge described subimage, obtain the mark value of each subimage.Arranging coarse search threshold value is the cotton boll sorter threshold value of false positive rate 6% to 9% time.Record the subimage position that its mark value exceedes coarse search threshold value, as coarse search cotton boll position, as shown in Figure 3.
(1-3) fine searching cotton boll position
For each coarse search cotton boll position in Fig. 3, will respectively expand the image-region of 5 pixels near coarse search cotton boll position to the right downwards as fine searching scope.Within the scope of fine searching, according to from left to right order from top to bottom, with 1 pixel step length, image is split into the subimage of 90 × 90 pixels.Using the cotton boll sorter obtained in embodiment 1 to judge splitting the subimage obtained, obtaining the mark value of each subimage.Arranging fine searching threshold value is the cotton boll sorter threshold value of false positive rate when equaling 1%, records the subimage position that its mark value exceedes fine searching threshold value, as fine searching cotton boll position.
(1-4) record and follow the tracks of cotton boll position.
For each coarse search cotton boll position that step (1-2) coarse search obtains, in the hunting zone of its expansion, maximum value constraint is carried out in all fine searching cotton boll positions, be about to the mark value that wherein all fine searching cotton boll positions provide according to its cotton boll sorter sort, only retain the maximum fine searching cotton boll position of mark value, as cotton boll final position, and record this position as cotton boll position.
(1-5) all cotton boll positions are obtained.
In the longitudinal front view picture in cotton field, follow-up segmentation cotton boll image procossing is carried out to all final cotton boll position subimage detected before recorded detection same day, as shown in Figure 4.
(2) cotton boll image is partitioned into.
(2-1) position of cotton boll is judged.
As shown in Figure 5, be wherein the cotton boll that will detect in black surround, cotton boll position is in the scope of entire image top 1/3rd, thinks that cotton boll contacts with sky, processes at the subimage of RGB color mode to cotton boll position.
(2-2) cotton boll gray level image is obtained.
By the subimage in the rectangle frame of cotton boll position, be transformed into RGB color mode, namely coloured image is converted to red, green, blue component image.Select the green component image in RGB color mode to deal with, convert cotton boll position subimage RGB color image to gray level image.
(2-3) cotton boll bianry image is obtained.
Setting threshold value is 240, cotton boll position subimage greyscale image transitions is become bianry image: due to we want to cotton boll region be a large connected domain, therefore in order to the complete of cotton boll connected domain and subsequent operation will be ensured conveniently, every gray-scale value is greater than the pixel of threshold value, then the gray-scale value of this pixel is become 0, otherwise the gray-scale value of this pixel is become 255.
(2-4) cotton boll primary segmentation image is obtained.
By the holes filling in the middle of the multiple connected domains in the image of binaryzation, thus obtain large connected region.Use canny edge detector, rim detection is carried out to cotton boll position subimage gray level image, as shown in Fig. 6 (a), and carries out shipping calculation, obtain cotton boll primary segmentation image, as shown in Fig. 6 (b).
(2-5) obtain cotton boll segmentation and cut image.
Thin Iamge Segmentation is carried out for cotton boll primary segmentation imagery exploitation morphological images disposal route, finally obtains cotton boll segmentation image.
First etching operation is carried out to image, select the rectangle frame of 3 × 3 pixel sizes as corroding structural element used, this is because ship the image after calculation well can not distinguish two different connected domains, after etching operation is carried out to image, although the area of connected domain can be reduced, but maximum cotton boll connected domain and other little connected domain can be separated, as much as possible as shown in Fig. 6 (c).
Then find the maximum connected domain obtained after carrying out etching operation to image, the grey scale pixel value in whole connected domain is labeled as 0, the gray-scale value of other pixels in rectangular area is labeled as 1, as shown in Fig. 6 (d).
Then expansive working is carried out to image, select the rectangle frame of 4 × 4 pixel sizes as the structural element used that expands, and fill up the hole in this largest connected territory.In order to keep the target object shape invariance after corrosion and expansive working as far as possible, the structural element that the structural element that expansive working uses will use with etching operation is identical, select the rectangle frame of 4 × 4 pixel sizes as corroding structural element used, obtaining cotton boll area grayscale value is 0, other position gray-scale values of rectangular area are the bianry image of 1, as shown in Fig. 6 (e).
Finally, each passage of the bianry image of acquisition and cotton boll position subimage RGB image is done dot product, finally obtains the cotton boll image split, as shown in Fig. 6 (f).
(3) judge to split the bell phase.
(3-1) in the cotton boll interior zone split, white crack is detected.
The cotton boll region split, adopts environment self-adaption dividing method, and again carry out white segmentation, object is that the result of segmentation is as shown in Fig. 7 (a) in order to detect and extract the white crack in cotton boll.
(3-2) white crack is detected.
According to the shape facility of the white connected domain (white crack) that will detect, white crack self " long and narrow property " is utilized to split the white portion detected, the shape descriptor of corresponding selection is the axial ratio of the minimum external ellipse of connected domain, arranging threshold value is 5.8, white connected domain axial ratio being less than threshold value is removed, and retains the connected domain that axial ratio is more than or equal to threshold value.
(3-2) judge whether cotton arrives and split the bell phase.
After obtaining the white crack pattern picture finally split, add up the number of white crack (white long and narrow connected domain), as shown in Fig. 7 (b).Crack do not detected, cotton does not enter splits the bell phase.
Embodiment 3
Whether the cotton using method provided by the invention to judge in Fig. 8 enters splits the bell phase:
(1) cotton boll position in picture is obtained:
(1-1) cotton field image is gathered
Camera is overhead high 0.3 meter, focal length 14 millimeters, and horizontal shooting direction northwards, is 0 degree with local horizon angle, resolution 4,000,000 pixel, when gathering 20 the cotton field of (when evening 8) longitudinally before image, as shown in Figure 8.
(1-2) coarse search cotton boll position.
First according to order from left to right from top to bottom, with 30 pixels for step-length, the image obtained is split the subimage obtaining 90 × 90 pixels in step (1-1).Use the cotton boll sorter obtained in embodiment 1 to judge described subimage, obtain the mark value of each subimage.Arranging coarse search threshold value is the cotton boll sorter threshold value of false positive rate when equaling 9%.Record the subimage position that its mark value exceedes coarse search threshold value, as coarse search cotton boll position, as shown in Figure 9.
(1-3) fine searching cotton boll position
For each coarse search cotton boll position in Fig. 9, will respectively expand the image-region of 5 pixels near coarse search cotton boll position to the right downwards as fine searching scope.Within the scope of fine searching, according to from left to right order from top to bottom, with 1 pixel step length, image is split into the subimage of 90 × 90 pixels.Using the cotton boll sorter obtained in embodiment 1 to judge splitting the subimage obtained, obtaining the mark value of each subimage.Arranging fine searching threshold value is the cotton boll sorter threshold value of false positive rate when equaling 1%, records the subimage position that its mark value exceedes fine searching threshold value, as fine searching cotton boll position.
(1-4) record and follow the tracks of cotton boll position.
For each coarse search cotton boll position that step (1-2) coarse search obtains, in the hunting zone of its expansion, maximum value constraint is carried out in all fine searching cotton boll positions, be about to the mark value that wherein all fine searching cotton boll positions provide according to its cotton boll sorter sort, only retain the maximum fine searching cotton boll position of mark value, as cotton boll final position, and record this position as cotton boll position.
(1-5) all cotton boll positions are obtained.
In the longitudinal front view picture in cotton field, follow-up segmentation cotton boll image procossing is carried out to all final cotton boll position subimage detected before recorded detection same day, as shown in Figure 10.
(2) cotton boll image is partitioned into.
(2-1) position of cotton boll is judged.
As shown in figure 11, be wherein cotton boll to be detected in black surround, cotton boll position is in the scope of entire image middle and lower part 2/3rds, thinks that cotton boll does not contact with sky, processes in HSI color mode to cotton boll position subimage.
(2-2) cotton boll gray level image is obtained.
By the subimage in the rectangle frame of cotton boll position, be transformed into HSI color mode, i.e. colourity, saturation degree, luminance component image.In order to make the effect of Iamge Segmentation process reach best, selecting the saturation degree component image in HSI color mode to deal with, convert gray level image to by cotton boll position subimage coloured image and carried out histogram equalization operation, obtaining cotton boll gray level image.
(2-3) cotton boll bianry image is obtained.
Setting threshold value is 240, cotton boll position subimage greyscale image transitions is become bianry image: due to we want to cotton boll region be a large connected domain, therefore in order to the complete of cotton boll connected domain and subsequent operation will be ensured conveniently, every gray-scale value is greater than the pixel of threshold value, then the gray-scale value of this pixel is become 0, otherwise the gray-scale value of this pixel is become 255.
(2-4) cotton boll primary segmentation image is obtained.
By the holes filling in the middle of the multiple connected domains in the image of binaryzation, thus obtain large connected region.Use canny edge detector, rim detection is carried out to cotton boll position subimage gray level image, as shown in Figure 12 (a), and carries out shipping calculation, obtain cotton boll primary segmentation image, as shown in Figure 12 (b).
(2-5) obtain cotton boll segmentation and cut image.
Thin Iamge Segmentation is carried out for cotton boll primary segmentation imagery exploitation morphological images disposal route, finally obtains cotton boll segmentation image.
First etching operation is carried out to image, select the rectangle frame of 3 × 3 pixel sizes as corroding structural element used, this is because ship the image after calculation well can not distinguish two different connected domains, after etching operation is carried out to image, although the area of connected domain can be reduced, but maximum cotton boll connected domain and other little connected domain can be separated, as much as possible as shown in Figure 12 (c).
Then find the maximum connected domain obtained after carrying out etching operation to image, the grey scale pixel value in whole connected domain is labeled as 0, the gray-scale value of other pixels in rectangular area is labeled as 1, as shown in Figure 12 (d).
Then expansive working is carried out to image, select the rectangle frame of 4 × 4 pixel sizes as the structural element used that expands, and fill up the hole in this largest connected territory.In order to keep the target object shape invariance after corrosion and expansive working as far as possible, the structural element that the structural element that expansive working uses will use with etching operation is identical, select the rectangle frame of 4 × 4 pixel sizes as corroding structural element used, obtaining cotton boll area grayscale value is 0, other position gray-scale values of rectangular area are the bianry image of 1, as shown in Figure 12 (e).
Finally, each passage of the bianry image of acquisition and cotton boll position subimage RGB image is done dot product, finally obtains the cotton boll image split, as shown in Figure 12 (f).
(3) judge to split the bell phase.
(3-1) in the cotton boll interior zone split, white crack is detected.
The cotton boll region split, adopts environment self-adaption dividing method, and again carry out white segmentation, object is that the result of segmentation as shown in Figure 13 (a) in order to detect and extract the white crack in cotton boll.
(3-2) white crack is detected.
According to the shape facility of the white connected domain (white crack) that will detect, white crack self " long and narrow property " is utilized to split the white portion detected, the shape descriptor of corresponding selection is the axial ratio of the minimum external ellipse of connected domain, arranging threshold value is 5.8, white connected domain axial ratio being less than threshold value is removed, and retains the connected domain that axial ratio is more than or equal to threshold value.
(3-2) judge whether cotton arrives and split the bell phase.
After obtaining the white crack pattern picture finally split, add up the number of white crack (white long and narrow connected domain), as shown in Figure 13 (b).A crack detected, cotton enters splits the bell phase.
Those skilled in the art will readily understand; the foregoing is only preferred embodiment of the present invention; not in order to limit the present invention, all any amendments done within the spirit and principles in the present invention, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.