Summary of the invention
The object of this invention is to provide a kind of method that Dynamic Recognition gathers Z-code, can realize under dynamically and gather Z-code.
The technical solution used in the present invention is: a kind of Dynamic Recognition gathers the method for Z-code, comprises the steps:
(1) camera is connected with image analysis processing unit;
(2) open image analysis processing unit, after completing initialization and camera being detected, start camera, gather background image, and preserve the pixel of background image;
(3) article that contain Z-code are moved to before camera, image analysis processing unit is analyzed the image of camera collection, show that image opens the motor image vegetarian refreshments sum of image relatively thereon, if the motor image vegetarian refreshments sum of several images that obtain in turn has from few change many, then from changeable few trend, and by the pixel contrast of the background image of preserving in static pixel and step (2), not identical pixel is greater than setting value, jump to step (4), otherwise jump to step (6);
(4), when the motor image vegetarian refreshments sum of relatively opening thereon respectively image when several images is all less than setting value, starts to gather image and decode; Otherwise return to step (3) and proceed images of items collection comparative analysis;
(5), after successfully decoded, the frequency of failure of decoding is clear 0, go to step (6), otherwise add up the current decoding frequency of failure, if in set point number successfully decodeds not all, the frequency of failure of decoding is clear 0, jumps to step (3);
(6) stop gathering, return to initial state to be collected.
In described step (2), after camera has started, by preservation background operation is set manually.The principle of preserving background is that all pixels of not putting the current picture of camera before article are left.
In described step (3), the article that contain Z-code are moved to before camera, image analysis processing unit contrasts adjacent two images of camera collection, from left to right, contrast from top to bottom the pixel of all same positions of two images, as: image 1 coordinate (0, 0) position pixel color is a, image 2 coordinates (0, 0) position pixel color is b, if color is the same, (a equals b), look this position (0, 0) be static, otherwise this position is motion, it is position (0, 0) be motor image vegetarian refreshments. in the time getting next frame image, previous frame image calculates total total how many motor image vegetarian refreshments relatively.Because every frame period may be too fast, can get the some frames in interval and just calculate motor image vegetarian refreshments sum one time, when the motor image vegetarian refreshments that calculates after this motor image vegetarian refreshments sum is than next some frames is few, forwards step (4) to, otherwise forward step (6) to.
Preferably, in described step (3), not identical pixel is greater than setting value and refers to that the ratio of same pixel point is not more than setting value, and setting value is 8% ~ 15%; More preferably, described setting value is 10%.
Preferably, in described step (3), image analysis processing unit is analyzed between adjacent two images that refer to 14 ~ 20 frames of interval in turn of image analysis processing unit to camera collection and is analyzed the image of camera collection;
Show that image opens relatively thereon the motor image vegetarian refreshments sum of image and refer to and show that image is with respect to before it and the motion pixel of the image of 14 ~ 20 frames with interval.
Preferably, in described step (3), image analysis processing unit is analyzed between adjacent two images that refer to 16 frames of interval in turn of image analysis processing unit to camera collection and is analyzed the image of camera collection;
Show that image opens relatively thereon the motor image vegetarian refreshments sum of image and refer to and show that image is with respect to before it and the motion pixel of the image of 16 frames with interval.
In described step (4), when motor image vegetarian refreshments sum is less than certain value always, can thinks in the image that current camera photographed and not change, the object before camera is stable, gets the decoding of present frame picture, forwards step (5) to.Otherwise think that the front object of camera is also moving, then go back to step (3).
In described step (5), the frequency of failure clear 0 of decoding after successfully decoded, go to step (6), if otherwise add up the current explanation frequency of failure. the current frequency of failure is greater than set point number, goes to step (6), and by clear the frequency of failure 0, otherwise go to step (3), described set point number is preferably 3 ~ 5 times.
With respect to prior art, beneficial effect of the present invention is:
Method of the present invention is applicable to the fields such as the checking of information acquisition, pass-check admission ticket and supermarket item scan of registering, meeting-place, can under motion state, identify collection Z-code, thus more convenient use.
Embodiment
The inventive method is mainly by software, motion identification and collection solution to be combined; Only contrast by the image of a camera collection, judge before camera whether have detection object (if any the admission ticket of Z-code) or detect object whether oneself takes away, in the time Z-code being detected, information recording is got up to import into system.
embodiment 1:
Dynamic Recognition gathers a method for Z-code, comprises the steps:
(1) camera is connected with image analysis processing unit, camera can be image analysis processing unit the current picture photographing is provided, such as the camera meeting per second of 24 chastity provides 24 pictures to image analysis processing unit;
(2) open image analysis processing unit, after completing initialization and camera being detected, start camera;
(3) article that contain Z-code are moved to before camera, image analysis processing unit contrasts adjacent two images of camera collection, from left to right, contrast from top to bottom the pixel of all same positions of two images, as: image 1 coordinate (0,0) position pixel color is a, image 2 coordinates (0,0) position pixel color is b, if color is the same, (a equals b), looks this position (0,0) be static, otherwise this position is motion, and position (0,0) is motor image vegetarian refreshments.So in the time getting next frame image, previous frame image calculates total total how many motor image vegetarian refreshments relatively;
Draw the motor image vegetarian refreshments sum of image with respect to its previous frame image, if the motor image vegetarian refreshments sum of several images that obtain in turn has from few change many, then from changeable few trend, and by the pixel contrast of the background image of preserving in static pixel and step (2), the ratio of not identical pixel is greater than 10%, jump to step (4), otherwise jump to step (6);
(4), when the motor image vegetarian refreshments sum of relatively opening thereon respectively image when several images is all less than 10, starts to gather image and decode; Otherwise return to step (3) and proceed images of items collection comparative analysis;
(5), after successfully decoded, the frequency of failure of decoding is clear 0, go to step (6), otherwise add up the current decoding frequency of failure, if in 3 times successfully decodeds not all, the frequency of failure of decoding is clear 0, jumps to step (3);
(6) stop gathering, return to initial state to be collected.
embodiment 2:
Except step (3), all the other steps are with embodiment 1, and the step (3) in this embodiment is:
The article that contain Z-code are moved to before camera, adjacent two images of interval 16 frames of image analysis processing unit to camera collection contrast, from left to right, contrast from top to bottom the pixel of all same positions of two images, as: image 1 coordinate (0,0) position pixel color is a, image 2 coordinates (0,0) position pixel color is b, if color is the same, (a equals b), looks this position (0,0) be static, otherwise this position is motion, and position (0,0) is motor image vegetarian refreshments;
Draw the motor image vegetarian refreshments sum of image with respect to the image of 16 frames with interval, if the motor image vegetarian refreshments sum of several images that obtain in turn has from few change many, then from changeable few trend, and by the pixel contrast of the background image of preserving in static pixel and step (2), the ratio of not identical pixel is greater than 10%, jump to step (4), otherwise jump to step (6).