Summary of the invention
For above-mentioned defect existing in the prior art, can be reduced technical problem to be solved by the invention is to provide a kind of
The water surface method for recognizing impurities of cost and labor intensity is maked an inspection tour in river.
In order to solve the above-mentioned technical problem, a kind of water surface method for recognizing impurities provided by the present invention, which is characterized in that tool
Steps are as follows for body:
1) a yolo characteristic of division model is constructed, the image for being used together by more than one water surface foreign matter is special to yolo classification as training sample
It levies model and carries out pre-training;
2) the remote control submarine navigation device cruise target waters equipped with attitude transducer, camera is utilized, and using under remote-controlled water
The Surface Picture in the camera photographic subjects waters carried in aircraft, and the Surface Picture of shooting is defined as original image,
And record the shooting time of original image, shooting posture information;
And on the picture altitude direction of original image, water surface baseline is located at the middle part of image, and water surface baseline refers in image
The water surface and land, sky line of demarcation;
Shooting inclination angle when the shooting posture information of Surface Picture is the filming surface image obtained by attitude transducer;
3) a original image is replicated, the duplicate plate of original image is converted into gray level image, and resulting grayscale image will be converted
As being defined as an image;
4) define a horizontal alignment line, and each land and water linking area boundary line up and down, and by two land and water linking area boundary line it
Between region be defined as land and water linking region;
Wherein, two land and water linking area boundary line is parallel to horizontal alignment line, and horizontal alignment line is located at two land and waters and is connected regional boundary
Between line;
The horizontal alignment line pass through an image central point, and the height equinoctial line of horizontal alignment line and an image it
Between angle be equal to original image shooting inclination angle;
The height equinoctial line of image is perpendicular to the short transverse of an image, and passes through the straight of an image center
Line;
5) a binaryzation parameter area and a land and water boundary scale value are set, and from the binaryzation parameter area of setting
A binaryzation parameter value is chosen, and the binaryzation parameter value of selection is set as current binaryzation parameter;
6) an a image is replicated, implements binary conversion treatment using duplicate plate of the current binaryzation parameter to an image, obtains
To the binary image of an image;
7) edge detection is implemented to the obtained binary image of step 6);If detecting in the binary image and being located at water
The pixel number that land is connected the edge line in region is greater than the land and water boundary scale value of setting, then the binary image is defined as two
Secondary image, and go to step 8);
Conversely, then choosing a new binaryzation parameter value from the binaryzation parameter area of setting, and by the binaryzation of selection
Parameter value is set as current binaryzation parameter, then goes to this step 6);
8) image segmentation is carried out to an image using Texture Segmentation method, finds out the line in the land and water linking region in an image
Cut-off rule is managed, and Hough transformation straight line is found out from secondary image using the transformation of Hough line;
9) degree of fitting two-by-two is carried out to horizontal alignment line, Texture Segmentation line, Hough transformation straight line using least square method to calculate, and
In the highest two lines of degree of fitting, that line more than pixel is considered as water surface contour line;
10) from the image-region extracted in an image on the downside of water surface contour line, and using the image-region of extraction as one
A new images implement edge detection, the contour line of each suspicious object in image are marked by edge detection method, and will
Resulting image definition is foreign matter anticipation figure after edge detection;
11) a contour area threshold value and a profile perimeter threshold are preset, is calculated each suspicious in foreign matter anticipation figure
Area, the perimeter of object, and the suspicious object of the condition that meets 1 or condition 2 is defined as foreign matter to be identified;
Condition 1: area is greater than preset contour area threshold value;
Condition 2: perimeter is greater than preset profile perimeter threshold;
Foreign matter prejudges in figure, and the area of suspicious object refers to that the contour line of suspicious object encloses the area in region, suspicious object
Perimeter refers to the perimeter of the contour line of suspicious object;
12) using the yolo characteristic of division model after yolo2 object detection sorting algorithm and pre-training to each foreign matter to be identified
Feature identification is carried out, to identify the foreign matter type of the water surface.
Further, in step 10), using the image-region of extraction as a new images after, first to the image use
Opening operation filtering processing, then the image is filtered using black cap operation, edge detection then is implemented to the image again.
Further, the shooting posture information of Surface Picture further includes the filming surface image obtained by attitude transducer
When shooting direction;After the foreign matter type for identifying the water surface, the shooting time of the foreign matter and original image that will identify that, shooting appearance
State information association.
Further, remote control is utilized also equipped with satellite positioning module on the remote control submarine navigation device in cruise target waters
When the camera shooting original image carried on submarine navigation device, the taking location information of original image is recorded, identifies the water surface
Foreign matter type after, the foreign matter that will identify that is associated with the taking location information of original image;Believe the camera site of Surface Picture
Satellite location data when breath is the filming surface image obtained by satellite positioning module.
Water surface method for recognizing impurities provided by the invention, the camera filming surface figure carried using remote control submarine navigation device
Picture, and find out by algorithm the water surface contour line in image;The foreign matter type of the water surface is further identified by algorithm, it can be with
It realizes the long-range tour to target water, river can be reduced and make an inspection tour cost and labor intensity.
Specific embodiment
The embodiment of the present invention is described in further detail below, but the present embodiment is not intended to restrict the invention, it is all
It is that protection scope of the present invention should all be included in using similar structure and its similar variation of the invention, the pause mark in the present invention is equal
Indicate the relationship of sum, the English alphabet in the present invention is case sensitive.
A kind of water surface method for recognizing impurities provided by the embodiment of the present invention, which is characterized in that specific step is as follows:
1) a yolo characteristic of division model is constructed, the image for being used together by more than one water surface foreign matter is special to yolo classification as training sample
It levies model and carries out pre-training;The construction method of yolo characteristic of division model is the prior art;
The image of the water surface foreign matter includes leaf image, bottle body image, branch image, greasy dirt image, bag body image, ship figure
Picture, fishnet image etc.;
2) the remote control submarine navigation device cruise target waters equipped with satellite positioning module, attitude transducer, camera is utilized, and
Using the Surface Picture in the camera photographic subjects waters carried on remote control submarine navigation device, and the Surface Picture of shooting is defined
For original image, and record the shooting time, taking location information, shooting posture information of original image;
And on the picture altitude direction of original image, water surface baseline is located at the middle part of image, and water surface baseline refers in image
The water surface and land, sky line of demarcation, by mechanical structure by camera be fixed on remote control submarine navigation device appropriate location,
Water surface baseline can be made to be located in the middle part of image;
Satellite digit when the taking location information of Surface Picture is the filming surface image obtained by satellite positioning module
According to;
Shooting inclination angle and bat when the shooting posture information of Surface Picture is the filming surface image obtained by attitude transducer
Take the photograph direction;
The satellite positioning module, attitude transducer are the prior art, and satellite positioning module can use GPS satellite positioning mould
Block, big-dipper satellite locating module etc.;
3) a original image is replicated, the duplicate plate of original image is converted into gray level image, and resulting grayscale image will be converted
As being defined as an image;
4) define a horizontal alignment line, and each land and water linking area boundary line up and down, and by two land and water linking area boundary line it
Between region be defined as land and water linking region;
Wherein, two land and water linking area boundary line is parallel to horizontal alignment line, and horizontal alignment line is located at two land and waters and is connected regional boundary
Between line;
The horizontal alignment line pass through an image central point, and the height equinoctial line of horizontal alignment line and an image it
Between angle be equal to original image shooting inclination angle;
The height equinoctial line of image is perpendicular to the short transverse of an image, and passes through the straight of an image center
Line;
In the present embodiment, the spacing between the land and water linking area boundary line and horizontal alignment line of upside is 46 pixels, the water of downside
Spacing between land linking area boundary line and horizontal alignment line is 100 pixels;
5) a binaryzation parameter area and a land and water boundary scale value are set, and from the binaryzation parameter area of setting
A binaryzation parameter value is chosen, and the binaryzation parameter value of selection is set as current binaryzation parameter;
6) an a image is replicated, implements binary conversion treatment using duplicate plate of the current binaryzation parameter to an image, obtains
To the binary image of an image;
Implementing binary processing method to image is the prior art, and an image is a gray level image, binaryzation parameter model
It encloses and can be set as 0~255, it is assumed that the value of binaryzation parameter value is 200, multiple to an image using the binaryzation parameter value
The mode of binary conversion treatment is implemented in plate-making are as follows: by an image duplicate plate, all gray values are more than or equal to the ash of 200 pixel
Angle value is changed to 255, and the gray value of pixel of all gray values less than 200 is changed to 0 so that the image after binary conversion treatment only have it is black
White two kinds of colors;
7) edge detection is implemented to the obtained binary image of step 6);If detecting in the binary image and being located at water
The pixel number that land is connected the edge line in region is greater than the land and water boundary scale value of setting, then the binary image is defined as two
Secondary image, and go to step 8);
Conversely, then choosing a new binaryzation parameter value from the binaryzation parameter area of setting, and by the binaryzation of selection
Parameter value is set as current binaryzation parameter, then goes to this step 6);
The method for implementing edge detection to image is the prior art, and existing edge detection method has very much, and the present embodiment uses
Be canny edge detection algorithm;
It is to find out the binary image that can correctly reflect land and water boundary situation to the purpose that image implements edge detection, it is assumed that land and water
Boundary scale value is set as 1338, then the edge line that land and water is connected in region is detected by edge detection method, if detection
To the edge line for being greater than 1338 pixels, which can be considered as to land and water line of demarcation, illustrate current binary image energy
Correct reflection land and water boundary situation, can carry out the operation of subsequent step, otherwise with regard to explanation on the basis of current binary image
The binaryzation parameter value selection of current binary image is inappropriate, needs to choose a new binaryzation parameter value again to make
One new binary image;
8) image segmentation is carried out to an image using Texture Segmentation method, finds out the line in the land and water linking region in an image
Cut-off rule is managed, and Hough transformation straight line is found out from secondary image using the transformation of Hough line;
9) degree of fitting two-by-two is carried out to horizontal alignment line, Texture Segmentation line, Hough transformation straight line using least square method to calculate, and
In the highest two lines of degree of fitting, that line more than pixel is considered as water surface contour line;
The method for using least square method to calculate two lines degree of being fitted is the prior art;This method definition one is two-dimensional
Image coordinate system, it is assumed that for image coordinate system using the pixel in the image lower left corner as origin, Y-axis is parallel to the short transverse of image, X
Axis is parallel to the width direction of image, then horizontal alignment line, Texture Segmentation line, Hough transformation straight line, this three line corresponding diagrams
As the point in coordinate system, the corresponding Y-axis value of the identical point of X-axis value in the two lines is done difference by the line being fitted for two,
And square summation to the difference, the summation smaller then degree of fitting of resulting value are higher;
10) from the image-region extracted in an image on the downside of water surface contour line, and using the image-region of extraction as one
A new images implement edge detection, the contour line of each suspicious object in image are marked by edge detection method, and will
Resulting image definition is foreign matter anticipation figure after edge detection;
The edge detection method used in this step is also canny edge detection algorithm, and using the image-region of extraction as
After one new images, first the image is filtered using opening operation, then the image is filtered using black cap operation, so
Edge detection is implemented to the image again afterwards;
Opening operation filtering can carry out erosion of burning to the slightly brighter region in suspicious object periphery in image, filter out suspicious object periphery
Some isolated noises, black cap operation filtering can be with a bit dark patches of the neighbour near point in separate picture, to strengthen image
In suspicious object profile;
11) a contour area threshold value and a profile perimeter threshold are preset, is calculated each suspicious in foreign matter anticipation figure
Area, the perimeter of object, and the suspicious object of the condition that meets 1 or condition 2 is defined as foreign matter to be identified;
Condition 1: area is greater than preset contour area threshold value;
Condition 2: perimeter is greater than preset profile perimeter threshold;
Foreign matter prejudges in figure, and the area of suspicious object refers to that the contour line of suspicious object encloses the area in region, suspicious object
Perimeter refers to the perimeter of the contour line of suspicious object;
12) using the yolo characteristic of division model after yolo2 object detection sorting algorithm and pre-training to each foreign matter to be identified
Feature identification is carried out, to identify the foreign matter type (leaf, bottle body, branch etc.) of the water surface;Yolo2 object detection sorting algorithm
For the prior art.
In the embodiment of the present invention, after the foreign matter type for identifying the water surface, the bat of the foreign matter and original image that can will identify that
Time, taking location information, shooting posture information association are taken the photograph, taking location information therein, shooting posture information are for marking
Waters locating for foreign matter.