Invention content
One of present invention is designed to provide a kind of Interactive Image Processing method for mobile terminal and is
System, perspective image deformation effect is follow-up when solving to need user perpendicular to required shooting document and shooting large scale document
The technical issues of processing.
In a first aspect, the Interactive Image Processing method an embodiment of the present invention provides kind for mobile terminal, feature
It is, including:
When needing to shoot document, a horizontal indication wire is shown in mobile terminal shoots interface;
According to shooting instruction, file and picture is obtained;
On the basis of the horizontal indication wire, edge detection is carried out with the determination foreground image to the file and picture.
Optionally, on the basis of the horizontal indication wire, to the file and picture carry out edge detection with determination it is described before
After scape image, the method further includes:
The apex of horizontal indication wire relative edge described in mobile terminal shooting interface shows and can be movable by the user
Two prompt points;
The expectation vertex that the foreground image is redefined according to described two prompt points position, obtains the foreground image
Intended shape.
Optionally, this method further includes the steps that being corrected to the foreground image:
Obtain the foreground picture of required orthographic projection into line tilt correction to the foreground image using perspective transform method
Picture.
Optionally, edge detection is carried out with the determination foreground image region to the file and picture, including the use of
Edge extracting method carries out edge detection with the determination foreground image region to the file and picture.
Optionally, when can not using edge extracting method to the file and picture carry out edge detection with the determination foreground
When image region, foreground image region is determined using color analysis method.
Optionally, it determines foreground image region using color analysis method, specifically includes:
It reduces the file and picture and calculates the color saturation of the file and picture after diminution;
Image binaryzation is carried out to the file and picture according to color saturation;
The file and picture after image binaryzation is filled;
Foreground image is determined to filled file and picture extraction edge.
Optionally, when color analysis method can not be utilized to determine foreground image region, unicom regional analysis is utilized
Method determines foreground image position, specifically includes:
Comprehensive texture analysis is carried out to file and picture and obtains foreground image;
Analysis of local regions is carried out to the foreground image and obtains the edge of the foreground image.
Second aspect, an embodiment of the present invention provides a kind of interactive image processing systems for mobile terminal, special
Sign is, including:
Display module, for showing a horizontal indication wire in mobile terminal shoots interface when needing to shoot document;
File and picture acquisition module, for according to shooting instruction, obtaining file and picture;
Foreground image acquisition module, on the basis of the horizontal indication wire, edge inspection to be carried out to the file and picture
It surveys with the determination foreground image.
Optionally, the display module is additionally operable in the foreground image acquisition module using the horizontal indication wire as base
Standard, after carrying out edge detection to the file and picture with the determination foreground image;
The apex of horizontal indication wire relative edge described in mobile terminal shooting interface shows and can be movable by the user
Two prompt points;
The foreground image acquisition module is additionally operable to redefine the foreground image according to described two prompt point positions
Expectation vertex, obtain the intended shape of the foreground image.
Optionally, further include intended shape correction module, for being carried out to the foreground image using perspective transform method
Slant correction obtains the foreground image of required orthographic projection.
The present invention is by carrying out the horizontal indication wire of multiple manual alignment to captured document or repeatedly matching quasiexpectation top
Then point carries out edge extracting to file and picture again and intended shape determines, and be corrected to obtain to intended shape required
The foreground image wanted.The edge of foreground image can be constantly updated to improve extraction foreground image by being repeatedly aligned or being registrated
Accuracy, be particularly suitable for shooting large scale document situation, allow user do not have to perpendicular to required shooting document
It can be obtained desired foreground image.In addition, after obtaining the region of foreground image, by the image background other than the foreground image
Remove, the processing speed of CPU can be improved, and a large amount of memory space can be reduced.
Specific implementation mode
To better understand the objects, features and advantages of the present invention, below in conjunction with the accompanying drawings and specific real
Mode is applied the present invention is further described in detail.It should be noted that in the absence of conflict, the implementation of the application
Feature in example and embodiment can be combined with each other.
Many details are elaborated in the following description to facilitate a thorough understanding of the present invention, still, the present invention may be used also
To be implemented different from other modes described here using other, therefore, protection scope of the present invention is not by described below
Specific embodiment limitation.
In a first aspect, the present invention proposes a kind of Interactive Image Processing method for mobile terminal, as shown in Figure 1,
Including:
S100, when need shoot document when, mobile terminal shoot interface in show a horizontal indication wire;
S200, according to shooting instruction, obtain file and picture;
S300, on the basis of the horizontal indication wire, to the file and picture carry out edge detection with the determination foreground
Image.
Optionally, on the basis of the horizontal indication wire, to the file and picture carry out edge detection with determination it is described before
After scape image, the method further includes S400:
The apex of horizontal indication wire relative edge described in mobile terminal shooting interface shows and can be movable by the user
Two prompt points;
The expectation vertex that the foreground image is redefined according to described two prompt points position, obtains the foreground image
Intended shape.
The present invention to captured document by carrying out the horizontal indication wire of manual alignment or repeatedly matches quasiexpectation vertex, so
Edge extracting and intended shape is carried out to file and picture again afterwards to determine, and to intended shape be corrected to obtain it is required before
Scape image.The edge of foreground image can be constantly updated to improve the accurate of extraction foreground image by being repeatedly aligned or being registrated
Degree is particularly suitable for the situation of shooting large scale document, and user is allow not have to obtain perpendicular to the document of required shooting
To desired foreground image, shooting difficulty is reduced.In addition, after obtaining foreground image region, other than the foreground image
Background remove, only preserve required foreground image section, it is possible to reduce a large amount of memory space can also reduce processing
Data improve the processing speed of CPU.
First, introduce S100 when need shoot document when, mobile terminal shoot interface in display one horizontal indication wire with
And S200 is according to shooting instruction, the step of obtaining file and picture.
Fig. 2 is that mobile terminal shoots interface schematic diagram in the embodiment of the present invention.As shown in Fig. 2, being put when user needs to shoot
When setting the document 2 on desktop 1, since 2 area of document is bigger, user's inconvenience by mobile terminal perpendicular to document 2 into
Row shooting.As shown in figure 3, when user prepares shooting document 2 using mobile terminal 3, there are one in the shooting interface of mobile terminal 1
The horizontal indication wire of item 4.The horizontal indication wire 4 is aligned by user with the bottom edge of captured document 2, then shoot again the document 2 from
And form file and picture 5.Wherein, document 2 forms foreground image 51 in file and picture 5, and desktop 1 is formed in file and picture 5
Background 52.
Secondly, S300 is introduced on the basis of the horizontal indication wire, edge detection is carried out with determination to the file and picture
The step of foreground image.
In the embodiment of the present invention, the foreground image in the document image is positioned using hybrid algorithm.Wherein, it mixes
Algorithm includes edge extracting method, color analysis method and unicom regional analysis.Also, on the basis of horizontal indication wire,
When carrying out edge extracting, the side file and picture of the horizontal indication wire is only calculated.On the basis of horizontal indication wire, determine
Other three edges of foreground image, remove the part outside foreground image region, it is possible to reduce required data to be processed,
To the hardware spending for reducing mobile terminal.
1) edge extracting method
The edge of file and picture carries the essential characteristic of the document image.Edge extracting method is a kind of common calculation
Method, including but not limited to Roberts operators, Sobel operators and Canny operators, document is directly found using edge extracting method
Image top edge determines foreground image.This method is widely used in the occasions such as business card recognition.But edge extracting method is anti-
Noiseproof feature is not good enough, not accurate enough at the edge that the more complicated situation of background is extracted.
2) color analysis method
When the background of file and picture is more complicated, the edge of foreground image cannot be determined by edge extracting method.Cause
This, the embodiment of the present invention determines foreground image using color analysis method.
Under normal circumstances, the neutralc tint of white gravoply, with black engraved characters is presented in file and picture.When file and picture is transformed into chrominance space,
The color saturation in region corresponding to foreground image is low, and there are apparent regions with background area is used.This method includes:
First, it reduces file and picture and calculates the color saturation of file and picture after diminution;
Secondly, image binaryzation is carried out to file and picture according to color saturation, by the pixel value mark in low saturation region
It is denoted as 1;Foreground image region can be roughly determined in this way.
Again, the file and picture after image binaryzation is filled, removes the color of the high saturation in file and picture
Region, such as colored text etc.;
Finally, foreground image is determined to filled file and picture extraction edge, referring to Fig. 4.As shown in figure 4, foreground picture
It is the edge using foreground image determined by color analysis method as 51 edge 6.
3) unicom regional analysis
In the case of foreground image is close with the background of file and picture (such as background is white or close white
When), the embodiment of the present invention analyzes file and picture using the unicom regional analysis of file and picture.The surrounding of foreground image is general
There are color white spaces similar with texture.It is specific as follows:
In captured file and picture, the texture level of character area is higher than peripheral regions, and document map in foreground image
The background of picture and the texture of the fringe region of foreground image are also different.Therefore, comprehensive texture analysis is carried out to file and picture first
Obtain foreground image.
Secondly, analysis of local regions is carried out to the foreground image and obtains the edge of the foreground image.According to local grain journey
Degree carries out binary conversion treatment to foreground image, so as to distinguish foreground image and edge, and passes through further straight-line detection
The edge of foreground image is determined, referring to Fig. 4.As shown in figure 4, the edge 6 of foreground image 51, is using unicom regional analysis
The edge of foreground image determined by method.
Certainly, in the embodiment of the present invention, above-mentioned edge extracting method, color analysis method and unicom can also be used successively
Regional analysis seeks the edge of file and picture, and optimal value is chosen at the obtained edge of three kinds of methods or is sought
Edge of their average value as foreground image.Those skilled in the art can be configured as the case may be, the present invention
It does not set.
Optionally, the two prompt points that can be movable by the user are shown in mobile terminal shoots interface, wherein two prompts
Point is located at the apex of horizontal indication wire relative edge;Foreground is redefined according to two prompt point positions that user is moved
The expectation vertex of image, obtains the intended shape of foreground image
Utilize the edge of foreground image obtained by step S300, it is possible to the edge 6 of appearance and the practical side of foreground image
Edge has big difference, undesirable, and user may be used manual mode and be adjusted.For example, in shooting interface, user utilizes
Two fingers are by the touchscreen, when prompt point to appear, prompt the position put to make itself and desired vertex to adjust by mobile finger
Accurate registration.This, which is manually adjusted, to be repeated as many times, until the edge of foreground image is correct.
For example, if frame chooses inaccuracy, user can be slided by finger and point out correct vertex, as shown in figure 5,
It is implemented as follows:
Refer to two and touch corresponding two vertex on image, and stay for some time, such as 1 second, can go out at finger on screen
Existing " X " prompt point, and mobile finger adjusts the position of " X " prompt point, it is made to be registrated with desired vertex;When lifting finger, " X "
Prompt the location determination of point;
It when " X " prompts point to determine, recalculates the edge of foreground image according to step S200, and updates and calculated
The parameter at edge.
The above process can be repeated several times, and parameter is constantly updated, as shown in fig. 6, until four tops of foreground image
Point all reaches desired locations, at this point, the edge of foreground image meets requirement.
The position for recording foreground image respectively through the above steps, further according to the foreground image manually adjusted, profit
The region parameter of extraction foreground image is constantly updated and corrected with study mechanism.By continuous interactive learning, mixing is continuously improved
The detection foreground image ability of algorithm.
Foreground image is obtained after carrying out edge detection to file and picture, and calculates the vertex of the foreground image.Meanwhile according to
The prioris such as the property of foreground image, such as size, determine intended shape and vertex.
The present invention determines the size of foreground image using the foreground image edge of Hough transformation method detection input picture.
According to the duality of point and line, will input the given curve representation form of picture space becomes the point of parameter space, thus will be defeated
The test problems for entering given curve in picture are converted into the spike problem found in parameter space.Global feature conversion will be detected
To detect local characteristics, in this way by acquiring the edge line equation of foreground image and the intersection point of straight line, you can acquire foreground
The apex coordinate of image and the dimensional information of foreground image, referring to Fig. 6.Then, then respectively with the maximum value of width and height
Width value and height value after being corrected as foreground image.
Optionally, this method further includes the steps that being corrected to the intended shape of foreground image:Utilize perspective transform side
Method obtains foreground image into line tilt correction the foreground image of required orthographic projection.
After the size for determining foreground image, to foreground image into line tilt correction.In the present invention, as shown in fig. 7, will before
Scape image is mapped on shooting object plane, is equivalent to video camera perpendicular to medical report list, to obtain ideal image
Shape, and the information that foreground image includes is not lost.
In practical application, those skilled in the art are the correction realized to tilted image, can also use other algorithm solutions
Certainly above-mentioned technical problem realizes that basic effect, the present invention are not construed as limiting.
Second aspect, the present invention provides a kind of interactive image processing systems for mobile terminal, as shown in figure 8,
Including:
Display module, for showing a horizontal indication wire in mobile terminal shoots interface when needing to shoot document;
File and picture acquisition module, for according to shooting instruction, obtaining file and picture;
Foreground image acquisition module, on the basis of horizontal indication wire, edge detection to be carried out with determination to file and picture
Foreground image.
Optionally, display module is additionally operable on the basis of foreground image acquisition module is by horizontal indication wire, to file and picture
After edge detection is carried out to determine foreground image;
The two prompt points that can be movable by the user are shown in mobile terminal shoots interface, wherein two prompt point difference
Positioned at the apex of horizontal indication wire relative edge;
Foreground image acquisition module is additionally operable to redefine foreground image according to two prompt point positions that user is moved
Expectation vertex, obtain the intended shape of foreground image.
Optionally, which further includes intended shape correction module, for utilizing perspective transform side
Method obtains foreground image into line tilt correction the foreground image of required orthographic projection.
Based on same inventive concept, a kind of Interactive Image Processing for mobile terminal provided in an embodiment of the present invention
System is realized using above-mentioned Interactive Image Processing method, thus can solve different technical problem, and is obtained identical
Technique effect, herein no longer in detail.
In the description of the present invention it should be noted that the orientation or positional relationship of the instructions such as term "upper", "lower" is base
It in orientation or positional relationship shown in the drawings, is merely for convenience of description of the present invention and simplification of the description, rather than indicates or imply
Signified device or element must have a particular orientation, with specific azimuth configuration and operation, therefore should not be understood as to this
The limitation of invention.
Although the embodiments of the invention are described in conjunction with the attached drawings, but those skilled in the art can not depart from this hair
Various modifications and variations are made in the case of bright spirit and scope, such modifications and variations are each fallen within by appended claims
Within limited range.