The side that masking acquires the marked body of foreign matter in image, identifies foreign matter marked body in image
Method and book scanning method
Technical field
The present invention relates to a kind of marked bodies for the foreign matter that leaf through a book is covered in image collection type scanning process, identify in image
The algorithm and book scanning method of marked body, and the books page turning scan method of corresponding image collection type.It is related to patent point
Class-mark G06 is calculated;It calculates;G06F electricity Digital data processing G06F9/00 presetting apparatus is counted, for example, controller G06F9/
The program of 06 application deposit, i.e., it receives program using the storage inside of processing equipment and the G06F9/44 of program is kept to be used for
Execute the device of special procedure.
Background technique
Scanner based on video image acquisition passes through the camera being located above scanning object and acquires page photo, passes through view
Frequency is that scanning can be completed after algorithm handles image, eliminates and manually presses printed matter to be scanned in scanning surface
Traditional scanning mode bring hard work amount.
But such scanning means needs handspring in the thicker books of scanning thickness or during quick scanning
Page, and need the page with hand/finger pressing unilateral side or bilateral in order to keep page smooth during the scanning process, lead
The page image of algorithm acquisition is caused inevitably to have finger-image.
Area of skin color is extracted using oval complexion model to remove colour of skin near zone to position finger.The oval colour of skin
Model: transforming to YCrCb color space from rgb space for colour of skin image, and on the two-dimensional space of CrCb, sample areas presents ellipse
Round shape feature, thus people using a CrCb spatially approximate elliptic region as determine the colour of skin foundation.
But it is influenced due to the book contents multiplicity for scanning, and by light variation, is known with color characteristic merely
Other finger areas easily causes erroneous detection and missing inspection.
Summary of the invention
The it is proposed of the present invention in view of the above problems, and a kind of masking developed acquires the marked body of foreign matter in image, comprising:
Mark portion, surface have the two side's continuous patterns at least formed by one or more kinds of meta graph recognitions;Fixed part, will
Marked body is fixed on the foreign matter occurred in acquisition target, such as finger or the similar disclosed automatic page turning equipment appearance of flipbook
On the surface of the flipbook mechanism on page surface, so that foreign matter surface is covered by the mark portion in acquired image, it is convenient for
Algorithm identification and label.
For the ease of algorithm identification, as preferred embodiment, the pel includes the isometric straight line being parallel to each other
Section and quadrant or open circles.
For the ease of the pattern range of algorithm defined label body entirety, as preferred embodiment, two sides connect
Continuous pattern concentrates in the rectangle identification region that one is located in the middle part of mark portion, the length of each equal length segment and rectangular area
Side is vertical, and the elliptic focus (or central point of focal length) line is parallel with the long side of the rectangular area;
Further, in order to reinforce the contrast difference of pel and background, enhance edge variation gradient, to make pel
Can be more obvious under different light, as preferred embodiment, the color of the rectangle identification region is described two
The inverse of pel color in square continuous pattern.
Further, the calculation in order to make accurately is positioned and is identified (principle will be in algorithm portion details),
When the mark portion includes a variety of pels, each two side's continuous patterns are made of a kind of pel;Multiple two sides connect
Continuous pattern is parallel with rectangular area long side.
Including at least two side's continuous patterns of the Line Segment and four points in two side's continuous pattern of multirow
Two side's continuous patterns of circle/open circles.
The method of foreign matter marked body, includes the following steps: in a kind of identification image
Firstly, acquisition includes the flat image of the marked body;It completes to include at least binaryzation and the image of denoising is pre-
Processing.
Then, edge detection is carried out to flat image, obtains the edge graph in flat image;It extracts complete in the edge graph
Contouring.
By carrying out straight line screening to whole profiles, two side's connection figures of the Line Segment in the marked body are obtained
Case;
After again, the area image where Line Segment is extracted in the flat image of acquisition.
As preferred embodiment, a certain number of alternative straight sections are determined by algorithm first, according to every alternative
The position of straightway determines the region, is expanded outwardly using a biggish size by initial straight line fragment position, then
Each connected region (may be connection region caused by the overlapping of many straightway zone broadenings) after expansion is taken one
Method as a boundary rectangle obtains final area image.
By area image described in edge detection, the corresponding local edge figure of marked body is obtained, the local edge is extracted
It is alternately oval to obtain all elliptical local configurations by the screening to local configuration for local configuration in figure;It calculates every
The elliptic focus and length shaft length of a elliptic contour;
Examine the median of the neighbouring length and angle of straightway of each alternative circle (it is considered that detecting sometimes
In interference straightway on certain non-fingerstall patterns on side, such as the straight line and signage that occur in books compared with, maximum probability
The length and angle diversity ratio of straightway is larger, calculates average, it is most likely that sees in error, therefore uses median), lead to
It crosses by every straightway compared with angle and length median, removal deviation exceeds the alternative straight section of threshold range.
The position for considering Line Segment and elliptical pixel center respectively, selects the picture more close to the pattern of marked body
Two side's continuous patterns at plain center, calculate the pixel center of pattern, and in the embodiment of subsequent descriptions, Line Segment is more
Close to center, the pixel center C of Line Segment is selected, as marked body center benchmark;It calculates all elliptical flat
Equal long axis length R, the index as judge mark body apart from camera lens distance;The average length L for calculating all straight lines, as finger
Tilt down the foundation of size.
The image range of marked body is calculated according to the pixel center C, average major axis length R and average length L.
As preferred embodiment, edge detection is carried out to flat image and uses Canny edge detection;By determining to take turns
The length-width ratio of the external minimum rectangle size of wide surround the area threshold range, profile and boundary rectangle, rejects non-straight line segment profile.
In order to guarantee arithmetic accuracy, as preferred embodiment, final all qualified straightway pixels are calculated
Also there is alternative circle and alternative straight section corresponding relationship screening step before center.
Each straight line found is compared with each alternative circle, find each circumference enclose the condition of satisfaction association it is straight
Line.Usual marked body is remoter apart from camera lens, and the image pixel between point and point is apart from smaller;Marked body inclined degree is bigger, point with
Image pixel between point is apart from smaller.
Every straight line meets bound threshold requirement with respect to the proximal end of focus at a distance from focus, comprehensively considers acquisition page
Distance and marked body inclined degree and camera resolution of the height, marked body of image pickup head apart from camera lens.In conjunction with upper
Factor is stated, provides following parameter threshold: 8 pixel of lower limit, 45 pixel of the upper limit, meanwhile, distal end of the every straight line away from focus and coke
The distance of point meets threshold requirement: lower limit requirement: not less than 25 pixel of lower limit, can satisfy conventional mainstream resolution ratio 720p,
1080p and 2k even the Image Acquisition precision and the algorithm speed of service of 4k.
The association straight line that each circumference encloses is found according to the above method, is lower than if the circumference encloses the association straight line number found
4, then delete the alternative circle.
As preferred embodiment, determine before calculating final all qualified straightway pixel centers alternative straight
Whether line segment passes through corresponding alternative circle;If passing through, the alternative straight section is rejected.
Further, it is contemplated that in the books in practical situations, such as around the finger pressing of wear markers body
There may be certain circle (such as attached drawing) in appearance, the linear distance on round or Elliptical distance fingerstall is significantly greater than in marked body
Ellipse/circle, pretend as preferred embodiment, these external interferences circle weeded out using threshold value: calculating final all symbols
Before the straightway pixel center of conjunction condition, the line of alternative circle row where whether the alternative circular focus deviates is determined;If partially
From being more than threshold distance, then the alternative circle is rejected.
Further, calculate before calculating final all qualified straightway pixel centers relevant straight line
Central line degree, i.e. every straight central to relevant straight line the center line being centrally formed average distance;
If above-mentioned average distance is greater than 3 pixels, it is associated with straight line group and is deleted, while corresponding alternative circle is deleted.
A kind of book scanning method includes the following steps:-is directed to the book pages of the marked body with marked body masking
Two dimensional image, determine the image range of marked body;- using the region of the similar area above or below marked body, it extends to
The image range of the marked body, removal complete the marked body image of current page, complete the scanning of current page.
Detailed description of the invention
For the clearer technical solution for illustrating the embodiment of the present invention or the prior art, to embodiment or will show below
There is attached drawing needed in technical description to do one simply to introduce, it should be apparent that, the accompanying drawings in the following description is only
Some embodiments of the present invention without creative efforts, may be used also for those of ordinary skill in the art
To obtain other drawings based on these drawings.
Fig. 1 is the fingerstall schematic diagram in the embodiment of the present invention as marked body
Fig. 2 is straightway pattern schematic diagram in the embodiment of the present invention
Fig. 3 is quadrant pattern schematic diagram in the embodiment of the present invention
Fig. 4 is preferred pattern schematic diagram in the embodiment of the present invention
Fig. 5 is flat image schematic diagram of the present invention
Fig. 6 is topography's schematic diagram that the present invention extracts
Fig. 7 is marked body (fingerstall) image range exposure mask figure in inventive algorithm embodiment
Fig. 8 is exposure mask analysis diagram in inventive algorithm embodiment
Fig. 9 is the detail structure chart of exposure mask in inventive algorithm embodiment
Figure 10 is that marked body parameter calculates schematic diagram in inventive algorithm embodiment
Figure 11 is the scan image schematic diagram that algorithm eliminates after marked body in inventive algorithm embodiment
Figure 12 is the application scenarios schematic diagram of inventive algorithm embodiment 2
Figure 13 is recognition result schematic diagram in inventive algorithm embodiment 2
Figure 14 is image-forming principle schematic diagram in inventive algorithm embodiment
Figure 15 is the algorithm flow chart of book scanning of the present invention
Specific embodiment
To keep the purposes, technical schemes and advantages of the embodiment of the present invention clearer, below with reference to the embodiment of the present invention
In attached drawing, technical solution in the embodiment of the present invention carries out clear and complete description:
As shown in Figure 1, what is provided in the present embodiment is for the fingerstall scheme using finger flipbook, the fixed part is
Circle is similar to plastic cement/rubber fingerstall of revolving body, and convenient for being socketed on user's flipbook finger, while plastic cement has with papery page
Biggish frictional force.
At the middle part of figure as shown in Figure 1, equipped with the rectangle identification region perpendicular to central axes, itself is equipped in region
Two enough side's continuous patterns of the isometric straightway being parallel to each other, and the two row two side continuous pattern enough by open circles, two
Row open circles are staggered.The scheme of the circle of elliptical special case is only considered as in the present embodiment.
In color selection, (i.e. parallel equal length segment and open circles is white, the background of rectangle identification region to pel
Color is inverse-black of white), fingerstall generally yellow (as preferred embodiment, can also be used and books papery area
Not biggish other colors).
In order to facilitate wearing, be additionally provided with the rubber/plastic tooth of dense arrangement in fingerstall/marked body inner surface, with rubber/
The elastic collective effect of plastic cement material guarantees the secured of wearing, while will not generate excessive pressure to finger and cause discomfort
(when finger diameter dimension is larger, rubber teeth itself can deformation occurs, reduces to finger pressure).
Meanwhile rubber/plastic tooth enters fingerstall direction along finger and is arranged, and convenient for wearing and taking off fingerstall, while guaranteeing hand
Refer to that the fastness during transverse movement flipbook, the especially frictional force after finger perspiration between rubber material are likely less than
The frictional force of papery page, the case where causing fingerstall to deflect.
Embodiment 1, book scanning application scenarios, the present embodiment mainly solve in image collection type scanning process, finger etc.
Influence during page turning to books image, as shown in Fig. 2-15:
(1) straightway of suitable size is found from image:
1. image is switched to grayscale image;
2. carrying out the median filtering denoising of [5,5] size;
3. carrying out Canny edge detection, gradient lower limit 75, the upper limit 120 obtains the edge graph of image;
4. extracting profile from edge graph;
5. analyzing whether each little profile meets the size and shape requirement of fingerstall straight line, to reject non-straight line segment
Profile:
A) area that profile surrounds need to meet bound requirement: 10 pixel of area lower limit, 500 pixel of the area upper limit;
B) ask the minimum circumscribed rectangle of profile corresponding wide and high, it is desirable that the long side of boundary rectangle needs to meet straight length
Bound requirement: length lower limit: 12 pixels, length limit: 70 pixels;
C) length-width ratio of boundary rectangle need to be greater than 3;
For the profile for meeting above-mentioned geomery requirement, two ends of corresponding straightway are acquired according to its boundary rectangle
Point, by each straightway indicated with two endpoints, alternately straightway is stored.
6. the rejecting that pair alternative straight found carries out double line: if judgment basis is two straight line two endpoints
Distance both less than 3 pixels, then it is assumed that they are overlapped.
Yellow line segment in this figure is the qualified straight line that the step is found.
(2) fingerstall regional area that may be present is positioned according to straightway closeness
1. traversing every straightway, the center of the straightway, slope and length is calculated;
2. the straightway is successively compared with the feature of other every straightway, both see whether to meet following all want
It asks:
A) the distance between the center of two straightways meets bound requirement: 4 pixels of lower limit, 60 pixel of the upper limit;
B) the slope difference of two straightways is less than 0.05;
C) difference in length of two straightways is less than 0.3 times of any length of straigh line.
If the relationship of certain straightway and the straightway meets all above requirement, the straightway is corresponding similar straight
Line segment, which counts, increases by 1.
3. the region for being more than threshold value 5 for similar straight line accumulative total extracts, general fingerstall region is obtained.
(3) circle is found in above-mentioned zone
1. local positioning figure above is transformed to grayscale image;
2. pair grayscale image carries out Canny edge detection, gradient lower limit 50, the upper limit 100 obtains edge graph;
3. extracting profile for edge graph;
4. pair each profile is analyzed, to search the profile for meeting oval feature:
A) area of profile need to meet threshold range requirement: 200 pixel of lower limit, 2500 pixel of the upper limit;
B) according to the two-dimentional point set fitted ellipse of profile, the area of fitted ellipse and the difference of actual profile area, the two are asked
Difference in areas needs to meet: less than 10 pixels;Otherwise it is assumed that the ovality of the profile is insufficient.
The profile for meeting both the above condition is retained, it is believed that they are alternative fingerstall circular patterns, and are recorded every
Elliptic focus, the length shaft length of a profile.
The part of figure blue is the alternative circle found.
(4) circle is combined with straight line information, alternative circle and straight line is screened
1. screening for the first time:
A) each straight line found is compared with each alternative circle, find each circumference enclose the condition of satisfaction association it is straight
Line.Condition is every straight line meets bound requirement: 8 pixel of lower limit, 45 picture of the upper limit with respect to the proximal end of focus at a distance from focus
Element;Meanwhile distal end of the every straight line away from focus meets lower limit requirement at a distance from focus: being not less than 25 pixel of lower limit;
B) the association straight line that each circumference encloses is found according to the above method, if to enclose the association straight line number found low for the circumference
In 4, then the alternative circle is deleted;
C) by the remaining angle, length and central store for alternatively justifying surrounding associated straight line for meeting condition.
2. programmed screening:
A) median for calculating the neighbouring length and angle of straight line of each alternative circle, by the angle of every straight line and length with
The two medians compare, and difference need to meet bound requirement: the angle and median angle degree difference of every straight line cannot be greater than 5
Degree;The difference of every line and middle bit length cannot be greater than the 5% of middle bit length;
B) straight line for being unsatisfactory for bound requirement is deleted from association rectilinear alignments.
If c) screened by upper step, some circumference encloses remaining association straight line number if it is less than 4, then it is standby to delete this
Choosing circle.
3. third time is screened:
A) otherwise two endpoints of every straight line illustrate that this is passed in straight line through not across the both ends associated with it alternatively justified
The circle, and have the circle passed in straight line through that will be deleted.
4. the 4th screening:
A) calculate alternatively circle relevant straight line central point, fit a center line using these central points;
B) each center alternatively justified is calculated at a distance from above-mentioned center line, which cannot be less than in circle association straight line
0.8 times of bit length.The circle that condition is not satisfied is deleted.
5. the 5th screening:
A) calculate relevant straight line central line degree, i.e. every straight central to relevant straight line be centrally formed
Center line average distance;
If b) above-mentioned average distance is greater than 3 pixels, it is associated with straight line group and is deleted, while corresponding alternative circle is deleted.
Through above-mentioned totally five wheel screening, the circle on fingerstall that retained circle as finally determines, while also saving each
The information of the corresponding association straight line for meeting condition of circle.
After completing positioning, you can get it complete fingerstall image masks, as shown in Figure 10, typical exposure mask range is by such as
Lower four parts composition: a rectangle (for limiting fingerstall width), the ellipse of finger middle section, finger fingertip part it is ellipse
Round and Fingers root portion ellipse.
For three elliptical short axles all along finger A-B line direction, the direction corresponds to the length or length of finger areas in figure
Spend direction.The length of three ellipse short shafts all relies on L: when finger tilt degree is certain, and it is closer apart from camera lens when, L becomes larger, this
When finger areas length increase;When finger is certain with distance of camera lens, finger fingertip tilts down that amplitude is bigger, and L is smaller, at this time hand
Refer to that zone length is shorter.
Diagram three elliptical long axis and rectangle width be all perpendicular to A-B line (i.e. the central axial direction of fingerstall,
In the non-use state, cross section is integrally in symmetrical image to rubber/plastic fingerstall, similar oval) direction, this direction corresponds to hand
Refer to the width in region.The length of the amount all relies on R, because R is because be elliptical long axis, with finger tilt size
Unrelated, the distance only with finger apart from camera lens is related.When finger is closer apart from camera lens, R becomes larger, and finger width increases at this time.
Wherein the size of each part and position correspond to fingerstall center C, ellipse average major axis length R and straight line average length
The relationship of L is as follows:
Rectangle: centered on C, long 15, it is wide by 9.5;The ellipse of finger middle section: centered on C, minor axis radius 4.3 is long
Axis radius 7;The ellipse of tip portion: centered on A, | A-C |=3L, minor axis radius 3, major axis radius 3.5;Refer to the ellipse of root portion
Circle: centered on B, | B-C |=5L, minor axis radius 5, major axis radius 6.
It is as shown in figure 15: for mathematics relationship of the present invention, in general, the line of equal length in the picture, corresponding
Practical parallel lines length camera photocentre corresponding thereto distance it is directly proportional;And the parallel lines of upper equal length in kind,
The vertical range of corresponding length optical center corresponding thereto is inversely proportional on image.
Embodiment 2, differentiation of the marked body as the application scenarios generally identified, for bulk article.In mouse upper surface
It is provided with marked body.In the present embodiment, the fixed part of marked body is preferably sticker form.By using the calculation in embodiment 1
Method can recognize marked body.
Due to the primitive features and inverse feature of marked body itself, so that under the application scenarios of multiple color background,
The identification of all achievable marked body guarantees accuracy of identification.
The foregoing is only a preferred embodiment of the present invention, but scope of protection of the present invention is not limited thereto,
Anyone skilled in the art in the technical scope disclosed by the present invention, according to the technique and scheme of the present invention and its
Inventive concept is subject to equivalent substitution or change, should be covered by the protection scope of the present invention.