A kind of fast tracking method and device based on color of object surface
Technical field
The invention belongs to the vision tracking technique field among the robot field, specifically be used to obtain the surface image of moving object, according to the color characteristic of image, the method and apparatus that selects certain objects and realize following the tracks of fast.
Background technology
At present, in rapid movement object tracking research based on vision, need tracked object to have the obvious color feature, so, method (its typical structure is seen " Hu Ying, Zhao Shuying, Xu Xinhe; colour code design and identification algorithm research; Chinese image graphics journal, the 7th volume (A version), 12 phases; in December, 2002,1291 ~ 1295 pages ") all adopted at object exterior pasting solid color colour code.The method of pasting colour code has certain limitation, can not be applicable to occasions such as intelligent monitoring, the tracking of streamline part.
Summary of the invention
The purpose of this invention is to provide a kind of fast tracking method based on color of object surface, applicable to vision follow the tracks of simply, image processing method fast and effectively.
Another object of the present invention provides a kind of device of realizing based on the fast tracking method of color of object surface.
To achieve these goals, technical scheme of the present invention provides a kind of fast tracking method based on color of object surface, and it carries out image recognition according to following steps in the object of which movement process:
The first step: at first the object that needs are discerned and followed the tracks of is separated from background, gathers image then in real time, to each width of cloth image, through with the threshold ratio of the HSV that calculates, will meet
ColorThe pixel area of scope remains, and remainder is rejected as a setting, and subject image is split:
F(x,y)=1(t1<=F(x,y)<=t2)
F (x, y)=0 (other);
Second step: the object binaryzation that will cut apart generates the black white image of binaryzation, and to this bianry image filtering processing, obtains level and smooth
Black and whiteImage;
The 3rd step: with Canny operator sharpen edges, and with expansion algorithm to reach the effect of removal aperture;
The 4th step: use the edge extracting algorithm, obtain the profile of object;
The 5th step: based on the image recognition of shape facility,, reject the pixel region that does not meet geometrical model, find the barycenter of tracked subject image according to the geometrical model of tracked object;
The 6th step: after determining the barycenter of subject image, with the difference of the position of subject image barycenter and given image point locations as the FEEDBACK CONTROL amount, the control robot drives camera motion, and the image of object is remained in the visual field of video camera, follows the tracks of this moving object.
Described fast tracking method, its described the 5th step: the image recognition based on shape facility, be to use form parameter, form parameter F has described regional compactedness to a certain extent, and it is to calculate according to the area A in the girth B in zone and zone:
F=B*B/(4*PI*A)
Wherein, form parameter is got minimum of a value 1 to border circular areas, and when the zone when being other shape F always greater than 1.
Described fast tracking method, it also is included in before the motion tracking, learns, and it adopts the method for on-line study: a) before carrying out tracing task, through image collection card, obtain a digitized RGB coloured image; B) user uses the mouse selection to need the rectangular area of the object of tracking; C) operating system with the topography that chooses on computers with the storage of BMP document form, the foundation of discerning needed threshold value and the image of real-time collection being cut apart as the back; D) this partial color image is converted into the HSV model, two components of its H, S are done histogram respectively, obtain H, the S threshold value of selection area.
Described fast tracking method, its described H, S threshold value, in realtime graphic identification subsequently, this threshold value can not change as the standard of object segmentation, learns again up to the user.
Described fast tracking method, it is under the situation of video camera not being demarcated, and the error of utilizing set point in the image and object mass center is the control feedback quantity, realizes that vision is followed the tracks of fast and accurately.
Described fast tracking method, it is a foundation with color of object surface information, recognition object carries out vision and follows the tracks of.
A kind of device of realizing based on the fast tracking method of color of object surface, comprise robot, robot control system, vision processing system is formed, its robot control system is made up of main control computer and robot controller, vision processing system is by video camera, image pick-up card and pattern process computer are formed, wherein, video camera is installed in the robot end, the map interlinking of video camera output is as capture card, IMAQ is placed in the pattern process computer, robot is electrically connected with robot controller, and robot controller is electrically connected with master computer respectively with pattern process computer.
Described device, the artificial robot with five degrees of freedom of its described machine, be made up of the Cartesian robot of a Three Degree Of Freedom and the rotation wrist of a two-freedom, the rotation wrist is installed in the vertical the tip of the axis of Cartesian robot, is connected with video camera on this rotation wrist; Robot is by a main control computer and robot controller control.
Described device, its described image pick-up card and pattern process computer are to select the pci bus image collection card for use, image card are installed in the general purpose PC of dominant frequency for 〉=2.8G the composing images treatment system.
Outstanding feature of the present invention is that video camera does not need to demarcate, and does not need to paste colour code, can follow the tracks of fast the object of the multiple color of surface coverage.
Image processing method of the present invention is succinct, and speed is fast, and is effective, independently becomes a unit, and adaptability is strong, and transplantability is strong.Adopted learning method during image is handled based on colouring information, to object change, the change of ambient light has excellent adaptability.Under the situation of video camera not being demarcated, use video camera and image pick-up card, obtain the image of moving object, adopt special image processing algorithm, the color characteristic of body surface and the area of color block are learnt, the result of study is as in the moving body track process, recognition object and define the standard of object.After obtaining the image of tracked object, calculate image centroid position c (u
c, v
c), with subject image centroid position c (u
c, v
c) with image in set point s (u
s, v
s) between pixel difference e, as the visual feedback amount, the control robot drives camera motion, utilizes the rotary joint pursuit movement object of robot, reflection rapidly, tracking velocity is fast, the image that can remain object is in the visual field of video camera.The visual processing method that the present invention sets forth, insensitive to the variation of ambient light, and be applicable to the moving body track that surperficial multiple color covers.
The present invention is suitable for fields such as intelligent monitoring, industrial products detect automatically, the control of streamline vision.
Description of drawings
Fig. 1 is the schematic diagram of the present invention's realization based on the device of the fast tracking method of color of object surface;
Fig. 2 the present invention is based on the fast tracking method of color of object surface to moving image processing procedure schematic diagram.
The specific embodiment
A kind of device of realizing based on the fast tracking method of color of object surface comprises robot, robot control system, and vision processing system is formed, and the principle of single unit system as shown in Figure 1.The robot control system device is made up of main control computer and robot controller, and vision processing system is by video camera, image pick-up card, and pattern process computer is formed.Wherein, the present invention is installed in the robot end with video camera, and the map interlinking of video camera output is as capture card, and IMAQ is placed in the pattern process computer, robot is electrically connected with robot controller, and robot controller is electrically connected with master computer respectively with pattern process computer.
In image processing algorithm, adopt the method for on-line study, before carrying out tracing task,, obtain a digitized RGB coloured image through image collection card.The user uses the mouse selection to need the rectangular area of the object of tracking.System stores the topography that chooses on computers with the BMP document form, discerns threshold value that needs and the foundation that the image of real-time collection is cut apart as the back.This partial color image is converted into the HSV model, two components of its H, S are done histogram respectively, obtain H, the S threshold value of selection area.In realtime graphic identification subsequently, this threshold value can not change as the standard of object segmentation, learns again up to the user.
The benefit of this learning process is under the situation of following the tracks of the object variation, need not program inside is made any change, each when the condition variation, such as light generation significant change, under the situation that tracked object changes, as long as before tracking, take a width of cloth photo current, choose tracked object just to finish the process of study with mouse.
When following the tracks of beginning, program at first reads the picture BMP of the district portion file of object, this BMP file is generated the HSV histogram and the threshold value of following the tracks of object, image card is gathered image in real time in the mode of concurrent working, every width of cloth image all compares with this threshold value, reject background, cut apart object, find the image border and the central point of object.Do not change at tracked object, light does not have under the situation of strong variations yet, does not need to relearn, and finishes until tracing process.Complete processing procedure as shown in Figure 2.
When moving body track, robot drives camera motion, makes moving object be in video camera all the time within sweep of the eye, and in this process, the step of object image identification is as follows:
The first step: at first the object that needs are discerned and followed the tracks of is separated from background.Background is the set of actionless pixel on the image, and it does not belong to any object that moves before video camera.Gather image then in real time, to each width of cloth image, through with the threshold ratio of the HSV that calculated just now, will meet
ColorPixel area in the scope remains, and remainder is rejected as a setting, object is got image split.
F(x,y)=1(t1<=F(x,y)<=t2)
F (x, y)=0 (other)
Second step: the object binaryzation that will cut apart, the black white image of generation binaryzation.Obtain level and smooth to this bianry image filtering processing
Black and whiteImage.
The 3rd step: with Canny operator sharpen edges, and with expansion algorithm to reach the effect of removal aperture.
The 4th step: use the edge extracting algorithm, obtain the profile of object.
The 5th step:,, find the central point of object according to the geometrical model of object based on the image recognition of shape facility.Use form parameter, form parameter F has described regional compactedness to a certain extent, and it is to calculate according to the area A in the girth B in zone and zone:
F=B*B/(4*PI*A)
Wherein, form parameter is got minimum of a value 1 to border circular areas, and when the zone was other shape, F was always greater than 1.For example in the identification spherical body, at first consider and remove by the area threshold noise that area is too small.Consider that then F near 1 zone, can distinguish circle and other shape of rule in the picture.Shi Bie Else Rule shape such as square, can obtain foursquare F value by foursquare feature and approach 4/PI (=1.3) if desired.
The 6th step: after determining the central point of object, the control robot drives camera motion, and the image of object is remained in the visual field of video camera, follows the tracks of this moving object.
Provide an example of the present invention below.In the example, video camera is installed in the robot end of a five degree of freedom, robot is made up of the Cartesian robot of a Three Degree Of Freedom and the rotation wrist of a two-freedom, the rotation wrist is installed in the vertical the tip of the axis of Cartesian robot, and robot is by a main control computer and controller control.An industry standard colour TV camera is fixed on the rotation wrist, selects OK series pci bus image collection card for use, image card is installed in the general purpose PC that dominant frequency is 2.8G the composing images treatment system.The operation principle of whole device as shown in Figure 1.
The application example system under the natural lighting irradiation, follows the tracks of a remote control car.The telecar surface is yellowish green alternate color, and the front and back vehicle window is a black, uses the learning method of describing among the present invention, before motion tracking, learns, and obtains H, the S threshold value of telecar surface color.The control moving of car that uses a teleswitch according to flow process shown in Figure 2, adopts the first step to the image-recognizing method in six steps, has realized the motion tracking of remote operated vehicle.
As seen, the method and apparatus among the present invention can not have under the demarcation situation at video camera, does not need to paste colour code, to the surface color complex objects, realizes quick vision tracking.