CN106023087A - Image processing method and device - Google Patents
Image processing method and device Download PDFInfo
- Publication number
- CN106023087A CN106023087A CN201610334341.1A CN201610334341A CN106023087A CN 106023087 A CN106023087 A CN 106023087A CN 201610334341 A CN201610334341 A CN 201610334341A CN 106023087 A CN106023087 A CN 106023087A
- Authority
- CN
- China
- Prior art keywords
- angle
- pending image
- ratio
- anglec
- rotation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 25
- 238000000034 method Methods 0.000 claims abstract description 60
- 238000012545 processing Methods 0.000 claims abstract description 22
- 239000000284 extract Substances 0.000 claims description 18
- 238000004364 calculation method Methods 0.000 claims description 15
- 238000000605 extraction Methods 0.000 claims description 14
- 230000001419 dependent effect Effects 0.000 claims description 11
- 239000007787 solid Substances 0.000 claims description 7
- 230000008569 process Effects 0.000 description 23
- 239000011159 matrix material Substances 0.000 description 19
- 238000004891 communication Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 6
- 238000001514 detection method Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 238000000354 decomposition reaction Methods 0.000 description 3
- 238000001914 filtration Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000005236 sound signal Effects 0.000 description 3
- 230000001133 acceleration Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 2
- 230000000712 assembly Effects 0.000 description 2
- 238000000429 assembly Methods 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- KLDZYURQCUYZBL-UHFFFAOYSA-N 2-[3-[(2-hydroxyphenyl)methylideneamino]propyliminomethyl]phenol Chemical compound OC1=CC=CC=C1C=NCCCN=CC1=CC=CC=C1O KLDZYURQCUYZBL-UHFFFAOYSA-N 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 201000001098 delayed sleep phase syndrome Diseases 0.000 description 1
- 208000033921 delayed sleep phase type circadian rhythm sleep disease Diseases 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000004807 localization Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/60—Rotation of whole images or parts thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
The invention relates to an image processing method and device. The method includes the steps of: obtaining a vanishing point of an image to be processed; calculating a rotation angle of the image to be processed according to the vanishing point; calculating a cutout proportion of the image to be processed; and determining a cutout area of the image to be processed according to the rotation angle and the cutout proportion. According to the image processing method provided by the invention, the rotation angle of the image to be processed is calculated according to the vanishing point, after the rotation angle is determined, the image to be processed is cut out according to the rotation angle and cutout proportion of the image to be processed, thus editing and cutout processing of a graph is realized, and an optimal cutout image can be obtained.
Description
Technical field
It relates to image processing techniques, particularly relate to image processing method and device.
Background technology
At present, using the photographic equipment shooting images such as mobile phone, photographing unit and video camera is a kind of universal phenomenon.But, generally
The image of shooting, due to the shooting reason of user, is shaken when such as user shoots so that the image of shooting tilts, thus needs
The image of shooting is carried out editing and processing.
Summary of the invention
For overcoming problem present in correlation technique, the disclosure provides a kind of image processing method and device.
First aspect according to disclosure embodiment, it is provided that a kind of image processing method, including:
Obtain the vanishing point of pending image;
The anglec of rotation of pending image is calculated according to vanishing point;
Calculate pending image cuts ratio;
According to the anglec of rotation and cut the pending image of ratio-dependent cut region.
In conjunction with first aspect, in the first possible implementation of first aspect, calculate pending image cuts ratio,
Including:
The ratio on the minimum edge according to pending image and maximum limit obtains the intrinsic angle of pending image;
Ratio is cut according to what intrinsic angle and the anglec of rotation calculated pending image.
In conjunction with the first possible implementation of first aspect, in the implementation that the second of first aspect is possible, root
According to intrinsic angle and the anglec of rotation calculate pending image cut ratio before, also include:
Carrying out remainder operation according to the anglec of rotation and the first predetermined angle, obtain the remainder angle of pending image, first presets
Angle is 90 degree;
The cutting with reference to angle of pending image is obtained according to remainder angle and intrinsic angle sum;
Ratio is cut according to what intrinsic angle and the anglec of rotation calculated pending image, including:
According to intrinsic angle and cut with reference to the pending image of angle calculation cut ratio.
In conjunction with the implementation that the second of first aspect is possible, in the third possible implementation of first aspect, root
Obtain the cutting with reference to before angle of pending image according to remainder angle and intrinsic angle sum, also include:
Judging whether remainder angle is less than or equal to the second predetermined angle, the second predetermined angle is 45 degree;
Cut with reference to angle according to what remainder angle and intrinsic angle sum obtained pending image, including:
If remainder angle is less than or equal to the second predetermined angle, then obtain pending figure according to remainder angle and intrinsic angle sum
Cutting with reference to angle of picture;
If remainder angle is more than the second predetermined angle, then obtain pending image according to the difference of the first predetermined angle with remainder angle
Difference angle, obtain the cutting with reference to angle of pending image according to difference angle and intrinsic angle sum.
The third possible implementation of the implementation possible in conjunction with the second of first aspect or first aspect, first
In 4th kind of possible implementation of aspect, according to intrinsic angle and cut with reference to the pending image of angle calculation cut ratio
Example, including:
According to the most angled sine value and the sine value cutting reference angle, obtain pending image cuts ratio.
In conjunction with the 4th kind of possible implementation of first aspect to first aspect, in the 5th kind of possible realization of first aspect
In mode, according to the anglec of rotation and cut the pending image of ratio-dependent cut region, including:
According to the anglec of rotation with cut that ratio is counter looks into pending image, obtaining the maximum rectangle of pending image, maximum rectangle is
Pending image cut region.
In conjunction with the 4th kind of possible implementation of first aspect to first aspect, in the 6th kind of possible realization of first aspect
In mode, calculate pending image cut ratio before, also include:
Judge that whether the anglec of rotation is less than predetermined threshold value;
Calculate pending image cuts ratio, including:
If the anglec of rotation is less than predetermined threshold value, then calculate pending image cuts ratio.
In conjunction with first aspect, in the 7th kind of possible implementation of first aspect, before obtaining the vanishing point of pending image,
Also include:
Extract the lines of pending image, and lines are clustered;
Obtain the vanishing point of pending image, including:
Obtain in pending image the lines more than the first preset length of all length in each class lines bunch in wireless distant place
Intersection point, intersection point is the vanishing point of each class lines bunch.
In conjunction with the 7th kind of possible implementation of first aspect, in the 8th kind of possible implementation of first aspect, root
The anglec of rotation of pending image is calculated according to vanishing point, including:
Obtain the line of the vanishing point of each class lines bunch and the central point of pending image respectively, generate each class lines bunch correspondence
Straight line;
Obtaining the angle of straight line corresponding to the most class lines bunch of lines quantity and axis, angle is the rotation of pending image
Angle.
In conjunction with the 7th kind of possible implementation or the 8th kind of possible implementation of first aspect of first aspect, first
In 9th kind of possible implementation of aspect, before extracting the lines of pending image, also include:
Obtain the line length of pending image;
Judge that whether line length is more than or equal to the second preset length;
Extract the lines of pending image, including:
Extract line length in pending image and be more than the lines of the second preset length.
Second aspect according to disclosure embodiment, it is provided that a kind of image processing apparatus, including:
Vanishing point acquisition module, is configured to obtain the vanishing point of pending image;
Anglec of rotation computing module, is configured to calculate the anglec of rotation of pending image according to the vanishing point that acquisition module obtains;
Cutting ratio computing module, be configured to calculate pending image cuts ratio;
Determining module, the anglec of rotation being configured to calculate according to anglec of rotation computing module calculates with cutting ratio computing module
Cut the pending image of ratio-dependent cut region.
In conjunction with first aspect, in the first possible implementation of first aspect,
The ratio computing module of cutting includes:
Intrinsic angle obtains submodule, and the ratio being configured to the minimum edge according to pending image and maximum limit obtains pending
The intrinsic angle of image;
Cut ratio calculating sub module, be configured to obtain, according to intrinsic angle, intrinsic angle and the anglec of rotation that submodule obtains
Calculating sub module calculate the anglec of rotation calculate pending image cut ratio.
In conjunction with the first possible implementation of first aspect, in the implementation that the second of first aspect is possible, also
Including;
Remainder angle acquisition module, is configured to the anglec of rotation and the first predetermined angle calculated according to anglec of rotation computing module
Carrying out remainder operation, obtain the remainder angle of pending image, the first predetermined angle is 90 degree;
Cut with reference to angle acquisition module, be configured to the remainder angle according to the acquisition of remainder angle acquisition module and intrinsic angle
Cutting with reference to angle of the intrinsic angle sum pending image of acquisition that acquisition submodule obtains;
The ratio calculating sub module of cutting includes: first cuts ratio calculating sub module;
First cuts ratio calculating sub module, is configured to obtain the intrinsic angle of submodule acquisition according to intrinsic angle and cut
With reference to angle acquisition module obtain cut with reference to the pending image of angle calculation cut ratio.
In conjunction with the implementation that the second of first aspect is possible, in the third possible implementation of first aspect, also
Including:
First judge module, is configured to judge whether the remainder angle that remainder angle acquisition module obtains is less than or equal to second
Predetermined angle, the second predetermined angle is 45 degree;
Cut and include with reference to angle acquisition module: first cuts reference angle acquisition submodule and second cuts with reference to angle acquisition
Submodule;
First cuts with reference to angle acquisition submodule, if the remainder angle being configured to the first judge module judgement is less than or equal to
Second predetermined angle, then obtain the cutting with reference to angle of pending image according to remainder angle and intrinsic angle sum;
Second cuts with reference to angle acquisition submodule, if the remainder angle being configured to the first judge module judgement is pre-more than second
If angle, then obtain the difference angle of pending image according to the difference of the first predetermined angle with remainder angle, according to difference angle
With cutting with reference to angle of the intrinsic angle sum pending image of acquisition.
The third possible implementation of the implementation possible in conjunction with the second of first aspect or first aspect, first
In 4th kind of possible implementation of aspect, the ratio calculating sub module of cutting includes: second cuts ratio calculating sub module;
Second cuts ratio calculating sub module, is configured to obtain, according to intrinsic angle, the solid angled sine that submodule obtains
Value cuts the sine value with reference to angle with cutting with reference to what angle acquisition module obtained, and obtain pending image cuts ratio.
In conjunction with the 4th kind of possible implementation of first aspect to first aspect, in the 5th kind of possible realization of first aspect
In mode, determine that module includes:
Determine submodule, be configured to the anglec of rotation according to the acquisition of anglec of rotation computing module and cut ratio computing module meter
The ratio that cuts of calculation is counter looks into pending image, obtains the maximum rectangle of pending image, and maximum rectangle is cutting of pending image
Take region.
In conjunction with the 4th kind of possible implementation of first aspect to first aspect, in the 6th kind of possible realization of first aspect
In mode, also include:
Second judge module, is configured to judge whether the anglec of rotation that anglec of rotation computing module calculates is less than predetermined threshold value;
The ratio computing module of cutting includes: the 3rd cuts ratio calculating sub module;
3rd cuts ratio calculating sub module, if the anglec of rotation being configured to the second judge module judgement is less than predetermined threshold value,
Then calculate pending image cuts ratio.
In conjunction with first aspect, in the 7th kind of possible implementation of first aspect, also include:
Extraction module, is configured to extract the lines of pending image, and is clustered by lines;
Vanishing point acquisition module includes: vanishing point obtains submodule;
Vanishing point obtains submodule, is configured to obtain in the pending image that extraction module extracts all length in each class lines bunch
Degree is more than the lines of the first preset length intersection point in wireless distant place, and intersection point is the vanishing point of each class lines bunch.
In conjunction with the 7th kind of possible implementation of first aspect, in the 8th kind of possible implementation of first aspect, rotation
Gyration computing module includes:
Straight line gernertion submodule, is configured to the company of the vanishing point obtaining each class lines bunch and the central point of pending image
Line, generates the straight line that each class lines bunch are corresponding;
The anglec of rotation obtains submodule, is configured to the class lines that the lines quantity of acquisition straight line gernertion submodule generation is most
The angle of bunch corresponding straight line and axis, angle is the anglec of rotation of pending image.
In conjunction with the 7th kind of possible implementation or the 8th kind of possible implementation of first aspect of first aspect, first
In 9th kind of possible implementation of aspect, also include:
Line length acquisition module, is configured to obtain the line length of pending image;
3rd judge module, is configured to judge whether the line length that line length acquisition module obtains is more than or equal to second
Preset length;
Extraction module includes: extract submodule;
Extract submodule, be configured to extract line length in the pending image that the 3rd judge module judges and preset more than second
The lines of length.
Embodiment of the disclosure that the technical scheme of offer can include following beneficial effect:
In one embodiment, after the vanishing point of the pending image of acquisition, calculate the anglec of rotation of pending image according to vanishing point,
And without calculating Intrinsic Matrix, it is not necessary to use the current Intrinsic Matrix according to vanishing point acquisition image and outer parameter matrix
Edit methods to image;And after the anglec of rotation determines, it is right to complete according to the anglec of rotation and the ratio that cuts of pending image
Cutting of pending image, it is achieved the editor of figure is cut process, obtains optimal cutting image.
In another embodiment, owing to the ratio of the minimum edge according to pending image and maximum limit obtains consolidating of pending image
Angled, according to intrinsic angle and cut with reference to the pending image of angle calculation cut ratio, it is achieved use level indicator algorithm
Calculate pending image cuts ratio, obtain pending image optimal cut ratio, it is achieved the editor of figure is cut place
Reason, obtains optimal cutting image.
In another embodiment, owing to the anglec of rotation of pending image is carried out remainder operation, by the rotation of pending image
The scope of angle is limited in 0 degree of-90 degree, cuts reference according to what remainder angle and intrinsic angle sum obtained pending image
Angle, it is ensured that the accuracy cutting reference angle of pending image.
In another embodiment, owing to cutting reference angle obtain pending image according to remainder angle and intrinsic angle sum
Before degree, remainder angle is judged with the second predetermined angle, the scope of remainder angle is limited in 0 degree of-45 degree, it is ensured that place
The accuracy cutting reference angle of reason image.
In another embodiment, owing to according to solid angled sine value and the sine value cutting reference angle, obtaining pending
Image cut ratio, it is achieved calculate that pending image is optimal under present rotation angel degree cuts ratio value, so that it is guaranteed that can
Size is cut obtaining pending image under present rotation angel degree.
In another embodiment, owing to according to the anglec of rotation with cut that ratio is counter looks into pending image, obtaining pending image
Maximum rectangle, cuts region using the maximum rectangle of pending image as pending image, it is achieved obtain pending image
Most preferably cut region.
In another embodiment, due to calculate pending image cut ratio before, it is judged that whether the anglec of rotation less than pre-
If threshold value, when the anglec of rotation is less than predetermined threshold value, calculate the ratio that cuts of pending image, improve and pending image is compiled
Collect the accuracy cut.
In another embodiment, owing to extracting the lines of pending image, and lines are clustered, obtain pending image
In all length is more than intersection point in wireless distant place of the lines of the first preset length in each class lines bunch, intersection point is each class line
The vanishing point of bar bunch, it is achieved that obtain the vanishing point of pending image, and to the length of lines in class lines bunch each in pending image
Degree filters, and improves the precision asking for vanishing point.
In another embodiment, after obtaining the vanishing point of pending image, obtain the vanishing point of each class lines bunch respectively and treat
Process the line of the central point of image, generate the straight line that each class lines bunch are corresponding, obtain the class lines that lines quantity is most
The angle of bunch corresponding straight line and axis, angle is the anglec of rotation of pending image, it is achieved calculate pending figure according to vanishing point
The anglec of rotation of picture, and without calculating Intrinsic Matrix, it is not necessary to use the current intrinsic parameter square obtaining image according to vanishing point
Battle array and the outer parameter matrix edit methods to image.
In another embodiment, owing to, before extracting the lines of pending image, obtaining the line length of pending image,
Realize the line length of detection is carried out length filtration process, it is ensured that the precision of vanishing point in the pending image of acquisition.
It should be appreciated that it is only exemplary and explanatory that above general description and details hereinafter describe, can not limit
The disclosure processed.
Accompanying drawing explanation
Accompanying drawing herein is merged in description and constitutes the part of this specification, it is shown that meet embodiments of the invention,
And for explaining the principle of the present invention together with description.
Fig. 1 is the flow chart according to a kind of image processing method shown in an exemplary embodiment;
Fig. 2 is the flow chart according to a kind of image processing method shown in another exemplary embodiment;
Fig. 3 is the flow chart according to a kind of image processing method shown in further example embodiment;
Fig. 4 is according to a kind of image processing apparatus block diagram shown in an exemplary embodiment;
Fig. 5 is according to a kind of image processing apparatus block diagram shown in another exemplary embodiment;
Fig. 6 is according to a kind of image processing apparatus block diagram shown in further example embodiment;
Fig. 7 is according to a kind of block diagram for image processing apparatus shown in an exemplary embodiment.
Detailed description of the invention
Here will illustrate exemplary embodiment in detail, its example represents in the accompanying drawings.Explained below relates to accompanying drawing
Time, unless otherwise indicated, the same numbers in different accompanying drawings represents same or analogous key element.In following exemplary embodiment
Described embodiment does not represent all embodiments consistent with the present invention.On the contrary, they are only and the most appended power
The example of the apparatus and method that some aspects that described in detail in profit claim, the present invention are consistent.
First the several nouns involved by disclosure embodiment are explained:
Vanishing point: refer to the same class all parallel lines intersection point in wireless distant place, i.e. vanishing point with all of lines of same class all
On the same line.
Lines bunch: refer to the set of all parallel lines of same class.
Line segment detector (Line Segment Detector is called for short LSD): be a kind of quickly line Segment detection algorithm,
LSD aims at the straight profile of local in detection image.
Singular value decomposition (Singular Value Decomposition is called for short SVD) algorithm: be a kind of weight in linear algebra
The matrix decomposition wanted, is the matrix a kind of standard type under Unitary Equivalent.
Method of least square algorithm: also known as least square method, is a kind of mathematical optimization techniques, utilizes the method for least square can be easy
Try to achieve the data of the unknown, and make between these data tried to achieve and real data the quadratic sum of error for minimum.
Fig. 1 is the flow chart according to a kind of image processing method shown in an exemplary embodiment.As it is shown in figure 1, this enforcement
The image processing method that example relates to is in terminal, and this terminal can be to have the mobile phone of camera function, panel computer and notes
This computer etc., it is also possible to be other equipment with camera function, such as video camera.This image processing method includes following step
Suddenly.
In step s 11, the vanishing point of pending image is obtained.
In disclosure embodiment, when the image that the user discover that shooting exists to tilt, need the image of shooting is carried out editing and processing
Time, user can open a terminal in image editing function, now, terminal open image editing function, terminal obtains to be waited to locate
The vanishing point of reason image.
It should be noted that terminal can use LSD algorithm to ask for the lines in pending image, SVD can be used to calculate
Method or method of least square algorithm scheduling algorithm ask for the vanishing point of pending image, ask for the lines of pending image and going out of lines
Concrete principle and the method for point ask for the lines of image and the concrete principle of the vanishing point of lines and method phase in prior art
With, the present embodiment does not repeats at this.
In step s 12, the anglec of rotation of pending image is calculated according to vanishing point.
In disclosure embodiment, terminal, according to vanishing point, obtains the straight line A that vanishing point generates with pending image center, will be straight
The angle of line A and axis is as the anglec of rotation of pending image, and the anglec of rotation of pending image can well describe
The inclined degree of pending image.
It should be noted that typically more sensitive to the lines of verticalization due to user, in disclosure embodiment can but not
It is only limitted to the angle using straight line A and axis as the anglec of rotation, if the angle of straight line A and axis does not exists, the most also
Straight line A and horizontal angle can be used as the anglec of rotation.
In step s 13, calculate pending image cuts ratio.
In disclosure embodiment, terminal can use level indicator algorithm to calculate the ratio that cuts of pending image, and the disclosure is implemented
In example, level indicator algorithm refers to ask for size and the scaling of pending image, and scaling is that pending image is relative
Dimension scale in shooting original image.
In step S14, according to the anglec of rotation and cut the pending image of ratio-dependent cut region.
In disclosure embodiment, terminal is according to the anglec of rotation and cuts ratio Query (being called for short counter looking into) pending image,
Obtain optimal cutting image.Not by cutting image after being rotated by pending image in the present embodiment, but pass through
After determining the anglec of rotation of pending image and cutting ratio, to pending image is counter look into after cut image, obtain optimal
Cut image.
Further, in step S14, according to the anglec of rotation with cut that ratio is counter looks into pending image, obtain pending
The maximum rectangle of image, maximum rectangle be pending image cut region.
In disclosure embodiment, terminal is according to the anglec of rotation and cuts that ratio is counter looks into pending image, determines pending image
Maximum rectangle, most preferably cuts region using the maximum rectangle determined as pending image, can obtain optimal cutting image.
For example, if obtaining the anglec of rotation of pending image respectively by step S12 and step S13 is 5 degree, and treat
The ratio that cuts processing image is 0.5, then looked into by counter, pending image carries out-5 degree and rotates, and by pending figure
As amplifying after twice processes, cutting the maximum rectangle of image after process, i.e. obtain pending image most preferably cuts region.
The image processing method of the present embodiment, after the vanishing point by the pending image of acquisition, calculates pending image according to vanishing point
The anglec of rotation, and without calculating Intrinsic Matrix, it is not necessary to use the current Intrinsic Matrix obtaining image according to vanishing point
With the outer parameter matrix edit methods to image;And after the anglec of rotation determines, according to the anglec of rotation of pending image with cut
The ratio of taking completes to cut pending image, it is achieved the editor of figure is cut process, obtains optimal cutting image.
Further, before step S13, this image processing method also includes: judge that whether the anglec of rotation is less than presetting
Threshold value.
In step 13, if the anglec of rotation is less than predetermined threshold value, then calculate pending image cuts ratio.
In the disclosed embodiments, actual photographed exists the situation that the image of shooting inherently tilts, and be not by
Shoot in user's shake etc. by mistake, at this time avoid the need for the image of shooting being carried out editing and processing, in disclosure embodiment eventually
Hold calculate pending image cut ratio before, the calculated anglec of rotation is judged, by the anglec of rotation with
Predetermined threshold value judges, if the anglec of rotation is more than or equal to predetermined threshold value, image is not carried out editor and cuts, only
When the anglec of rotation is less than predetermined threshold value, just calculate pending image cuts ratio, image is carried out editor and cuts, it is to avoid
The mistake of pending image is processed, improves the accuracy that pending picture editting is cut.
It should be noted that predetermined threshold value can be it is not limited to 15 degree in disclosure embodiment, predetermined threshold value specifically may be used
Depending on according to practical situation, disclosure embodiment is not defined at this and repeats.
The image processing method of the present embodiment, on the basis of above-described embodiment, by calculate pending image cut ratio
Before example, it is judged that the anglec of rotation, whether less than predetermined threshold value, when the anglec of rotation is less than predetermined threshold value, calculates pending image
The ratio that cuts, improve accuracy that pending picture editting is cut.
Fig. 2 is the flow chart according to a kind of image processing method shown in another exemplary embodiment.The figure that the present embodiment relates to
As processing method is in terminal, the present embodiment is on the basis of embodiment illustrated in fig. 1, and calculate pending image cuts ratio
The embodiment of example, elaborates, as in figure 2 it is shown, this image processing method comprises the following steps.
In the step s 21, the intrinsic angle of pending image is obtained according to the minimum edge of pending image and the ratio on maximum limit
Degree.
In the disclosed embodiments, it is generally the case that the image of shooting shows with a rectangle, the image of shooting itself exists one
Individual intrinsic angle, whether the image no matter shot tilts, and the intrinsic angle in image is constant.Terminal root in the present embodiment
According to minimum edge and the ratio on maximum limit of pending image, ((w, h)/max (w, h)) obtain and treat min to use formula α=arctan
Process image cuts ratio, and wherein, w, h represent height and the width of pending image, represent consolidating of pending image
Angled.
Further, before step S21, also include: carry out remainder operation according to the anglec of rotation and the first predetermined angle,
Obtaining the remainder angle of pending image, the first predetermined angle is 90 degree;Obtain according to remainder angle and intrinsic angle sum
Cutting with reference to angle of pending image.
In disclosure embodiment, the scope of the anglec of rotation of the most calculated pending image is at 0 degree-360
Degree, the present embodiment terminal uses formula β=mod (α, 90) by the anglec of rotation and the first predetermined angle remainder, locates by will wait
The anglec of rotation of reason image carries out remainder operation, and the scope of the anglec of rotation of pending image is limited in 0 degree of-90 degree.
Optionally, obtain the cutting with reference to before angle of pending image according to remainder angle and intrinsic angle sum, also include:
Judging whether remainder angle is less than or equal to the second predetermined angle, the second predetermined angle is 45 degree.
Optionally, cut with reference to angle according to what remainder angle and intrinsic angle sum obtained pending image, including: if taking
Complementary angle degree is less than or equal to the second predetermined angle, then obtain cutting of pending image according to remainder angle and intrinsic angle sum
With reference to angle;If remainder angle is more than the second predetermined angle, then obtains according to the difference of the first predetermined angle with remainder angle and wait to locate
The difference angle of reason image, obtains the cutting with reference to angle of pending image according to difference angle and intrinsic angle sum.
In disclosure embodiment, according to remainder angle and intrinsic angle sum obtain pending image cut with reference to angle it
Before, terminal uses formulaRemainder angle is judged with the second predetermined angle, to remainder angle
Degree processes, and the scope of remainder angle is limited in 0 degree of-45 degree.Wherein, if remainder angle is less than or equal to the second preset angle
Degree, then γ represents remainder angle;If remainder angle is more than the second predetermined angle, then γ represents difference angle.
In step S22, cut ratio according to what intrinsic angle and the anglec of rotation calculated pending image.
In disclosure embodiment, the ratio at the minimum edge according to pending image and maximum limit obtains the intrinsic of pending image
After angle, terminal cuts ratio according to what intrinsic angle and the anglec of rotation calculated pending image, it is achieved use level indicator to calculate
Method calculates size and the scaling of pending image.
Further, in step S22, according to intrinsic angle and cut with reference to the pending image of angle calculation cut ratio
Example.
In the disclosed embodiments, terminal specifically can be according to intrinsic angle with cut with reference to the cutting of the pending image of angle calculation
Take ratio, calculate that pending image is optimal under present rotation angel degree cuts ratio.
Further, in step S22, according to the most angled sine value and the sine value cutting reference angle, obtain
Pending image cut ratio.
In the disclosed embodiments, terminal specifically can be according to the most angled sine value and the sine value cutting reference angle
Ratio, calculates that pending image is optimal under present rotation angel degree cuts ratio value, then can obtain pending image and exist
Size is cut under present rotation angel degree.
The image processing method of the present embodiment, on the basis of above-described embodiment, by the minimum edge according to pending image and
The ratio on maximum limit obtains the intrinsic angle of pending image, according to intrinsic angle with cut with reference to the pending image of angle calculation
Cut ratio, it is achieved use level indicator algorithm calculate pending image cut ratio, obtain optimal the cutting of pending image
Take ratio, it is achieved the editor of figure is cut process, obtain optimal cutting image.
Fig. 3 is the flow chart according to a kind of image processing method shown in further example embodiment.The figure that the present embodiment relates to
As processing method is in terminal, the present embodiment, on the basis of embodiment illustrated in fig. 1, obtains the vanishing point of pending image,
And the embodiment of the anglec of rotation according to the vanishing point pending image of calculating, elaborate, as it is shown on figure 3, at this image
Reason method comprises the following steps.
In step S31, extract the lines of pending image, and lines are clustered.
In the disclosed embodiments, terminal can use LSD algorithm to extract the lines of pending image, and extraction is treated
Process the linear feature of image, and the linear of extraction is carried out clustering processing.
Further, before step S31, also include: obtain the line length of pending image;Judge line length
Whether more than or equal to the second preset length.In step S31, extract line length in pending image pre-more than second
If the lines of length.
In the disclosed embodiments, before extracting the lines of pending image, terminal obtains the line length of pending image,
The line length of detection is carried out length filtration process, is automatically deleted these lines when line length is less than the second preset length long
Degree, only extracts the line length lines more than the second preset length.It should be noted that the second preset length in the present embodiment
Can according to the line length in pending image concrete depending on, the present embodiment is not defined at this and repeats.
In step s 32, all length is obtained in pending image in each class lines bunch more than the line of the first preset length
Bar is at the intersection point of wireless distant place, and intersection point is the vanishing point of each class lines bunch.
In the disclosed embodiments, after being clustered by lines, terminal carries out vanishing point in each class lines bunch and asks for,
The present embodiment can use svd algorithm or method of least square algorithm scheduling algorithm ask for the vanishing point of each class lines bunch.Wherein,
Before asking for the vanishing point of each class lines bunch, terminal carries out length filtration process to the lines in each class lines bunch, works as line
It is automatically deleted this line length when article length is less than three preset length, only extracts the line length line more than the 3rd preset length
Bar, can improve the degree of accuracy of the vanishing point of each class lines bunch asked for.
It should be noted that the 3rd preset length specifically can be long according to lines the longest in each class lines bunch in the present embodiment
Depending on degree, typically can but be not limited only to take 0.2 times that the 3rd preset length is line length the longest in each class lines bunch,
The present embodiment is not defined at this and repeats.
In step S33, obtain the line of the vanishing point of each class lines bunch and the central point of pending image respectively, generate
The straight line that each class lines bunch are corresponding.
In the disclosed embodiments, each class lines bunch are all obtained the straight line of correspondence by terminal, and terminal obtains vanishing point respectively and treats
Process the straight line that image center generates.
In step S34, obtaining the angle of straight line corresponding to the most class lines bunch of lines quantity and axis, angle is
The anglec of rotation of pending image.
In the disclosed embodiments, terminal all seeks out the straight line of correspondence and the angle of axis to the lines bunch of each class, and will
The angle of straight line corresponding to the most class lines bunch of lines quantity and axis is as the anglec of rotation of pending image.Need
Bright, the lines bunch to each class that terminal obtains seek out the straight line of correspondence and the possible only one of which of angle of axis, this
Time using the angle of straight line corresponding for such straight line cluster and axis as the rotation angle of pending image.Further, since user
As more sensitive to the lines of verticalization, can be it is not limited to use the lines bunch of each class to ask in disclosure embodiment
Go out the angle of straight line and axis of correspondence as the anglec of rotation, if the angle of straight line corresponding to each class lines bunch and axis is not
Exist, then the straight line and horizontal angle that each class lines bunch are corresponding can also be used as the anglec of rotation.
In step s 35, calculate pending image cuts ratio.
It should be noted that step S35 is identical with the implementation of S13 in the embodiment of the present invention, refer to the description of S13, this
Place repeats no more.
In step S36, according to the anglec of rotation and cut the pending image of ratio-dependent cut region.
It should be noted that step S31 is identical with the implementation of S14 in the embodiment of the present invention, refer to the description of S14, this
Place repeats no more.
Lines by extracting the lines of pending image, and are clustered by the image processing method of the present embodiment, and acquisition is treated
In process image, in each class lines bunch, all length is more than the lines of the first preset length intersection point in wireless distant place, and intersection point is
The vanishing point of each class lines bunch, it is achieved that obtain the vanishing point of pending image, and in class lines bunch each in pending image
The length of lines filters, and improves the precision asking for vanishing point;It addition, by obtain pending image vanishing point after, point
Do not obtain the line of the vanishing point of each class lines bunch and the central point of pending image, generate corresponding straight of each class lines bunch
Line, obtains the angle of straight line corresponding to the most class lines bunch of lines quantity and axis, and angle is the rotation of pending image
Angle, it is achieved calculate the anglec of rotation of pending image according to vanishing point, and without calculating Intrinsic Matrix, it is not necessary to use mesh
The front Intrinsic Matrix and the outer parameter matrix edit methods to image that obtain image according to vanishing point;And the anglec of rotation determines
After, according to the anglec of rotation of pending image with cut ratio and complete pending image is cut, it is achieved the editor to figure
Cut process, obtain optimal cutting image.
Fig. 4 is according to a kind of image processing apparatus block diagram shown in an exemplary embodiment.With reference to Fig. 4, this device includes going out
Put acquisition module 41, anglec of rotation computing module 42, cut ratio computing module 43 and determine module 44.
This vanishing point acquisition module 41 is configured to obtain the vanishing point of pending image.
This anglec of rotation computing module 42 is configured to calculate the anglec of rotation of pending image according to the vanishing point that acquisition module obtains
Degree.
What this cut that ratio computing module 43 is configured to calculate pending image cuts ratio.
This determines that module 44 is configured to the anglec of rotation according to the calculating of anglec of rotation computing module and cuts ratio computing module
Calculate cut the pending image of ratio-dependent cut region.
Further, this cuts ratio computing module 43 and includes: intrinsic angle obtains submodule and the ratio that cuts calculates submodule
Block.
This intrinsic angle obtains submodule and is configured to the ratio on minimum edge according to pending image and maximum limit and obtains and wait to locate
The intrinsic angle of reason image.
This cuts ratio calculating sub module and is configured to obtain, according to intrinsic angle, intrinsic angle and the anglec of rotation that submodule obtains
Degree calculating sub module calculate the anglec of rotation calculate pending image cut ratio.
About the device in above-described embodiment, wherein modules performs the concrete mode of operation in the reality about the method
Execute in example and be described in detail, explanation will be not set forth in detail herein.
The image processing apparatus of the present embodiment, after the vanishing point by the pending image of acquisition, calculates pending image according to vanishing point
The anglec of rotation, and without calculating Intrinsic Matrix, it is not necessary to use the current Intrinsic Matrix obtaining image according to vanishing point
With the outer parameter matrix edit methods to image;And after the anglec of rotation determines, according to the anglec of rotation of pending image with cut
The ratio of taking completes to cut pending image, it is achieved the editor of figure is cut process, obtains optimal cutting image.
Fig. 5 is according to a kind of image processing apparatus block diagram shown in another exemplary embodiment.With reference to Fig. 5, shown in Fig. 4
On the basis of embodiment, this device also includes: remainder angle acquisition module 45 and cutting with reference to angle acquisition module 46.
The anglec of rotation that this remainder angle acquisition module 45 is configured to calculate according to anglec of rotation computing module 42 is pre-with first
If angle carries out remainder operation, obtaining the remainder angle of pending image, the first predetermined angle is 90 degree.
This cuts and is configured to the remainder angle according to the acquisition of remainder angle acquisition module 45 with solid with reference to angle acquisition module 46
Cutting with reference to angle of the intrinsic angle sum pending image of acquisition that angled acquisition submodule obtains.
Cut ratio calculating sub module 43 to include: first cuts ratio calculating sub module.
This first cut ratio calculating sub module be configured to according to intrinsic angle obtain submodule obtain intrinsic angle and cut
Take with reference to angle acquisition module obtain cut with reference to the pending image of angle calculation cut ratio.
Further, this device also includes: the first judge module 47.
This first judge module 47 be configured to judge remainder angle that remainder angle acquisition module 45 obtains whether less than or etc.
In the second predetermined angle, the second predetermined angle is 45 degree.
Cut and include with reference to angle acquisition module 46: first cuts reference angle acquisition submodule and second cuts with reference to angle
Obtain submodule.
If this first cut with reference to angle obtain submodule be configured to first judge module 47 judge remainder angle less than or
Equal to the second predetermined angle, then obtain the cutting with reference to angle of pending image according to remainder angle and intrinsic angle sum.
If this second cuts and obtains submodule with reference to angle and be configured to remainder angle that the first judge module 47 judges more than the
Two predetermined angle, then obtain the difference angle of pending image, according to difference according to the difference of the first predetermined angle with remainder angle
Angle and intrinsic angle sum obtain the cutting with reference to angle of pending image.
Further, cut ratio calculating sub module 43 to include: second cuts ratio calculating sub module.
This second cut ratio calculating sub module be configured to according to intrinsic angle obtain submodule obtain solid angled just
String value cuts the sine value with reference to angle with cutting with reference to what angle acquisition module 46 obtained, obtains cutting of pending image
Ratio.
Further, it is determined that module 44 comprises determining that submodule.
This determines that the anglec of rotation that submodule is configured to obtain according to anglec of rotation computing module 42 calculates mould with cutting ratio
The ratio that cuts of block 43 calculating is counter looks into pending image, obtains the maximum rectangle of pending image, and maximum rectangle is pending
Image cut region.
About the device in above-described embodiment, wherein modules performs the concrete mode of operation in the reality about the method
Execute in example and be described in detail, explanation will be not set forth in detail herein.
The image processing apparatus of the present embodiment, obtains pending by the ratio of the minimum edge according to pending image and maximum limit
The intrinsic angle of image, according to intrinsic angle and cut with reference to the pending image of angle calculation cut ratio, it is achieved use water
Level algorithm calculate pending image cut ratio, obtain pending image optimal cut ratio, it is achieved the volume to figure
Volume cut process, obtain optimal cutting image.
Fig. 6 is according to a kind of image processing apparatus block diagram shown in further example embodiment.With reference to Fig. 6, at Fig. 4 and Tu
On the basis of 5 illustrated embodiments, this device also includes: the second judge module 48.
This second judge module 48 is configured to judge whether the anglec of rotation that anglec of rotation computing module 42 calculates is less than to be preset
Threshold value.
Cut ratio calculating sub module 43 to include: the 3rd cuts ratio calculating sub module.
If the 3rd cuts ratio calculating sub module is configured to the anglec of rotation of the second judge module 48 judgement less than presetting threshold
Value, then calculate pending image cuts ratio.
Further, this device also includes: extraction module 49.
This extraction module 49 is configured to extract the lines of pending image, and is clustered by lines.
Vanishing point acquisition module 41 includes: vanishing point obtains submodule.
This vanishing point obtains submodule and is configured to obtain in the pending image that extraction module extracts all in each class lines bunch
Length is more than the lines of the first preset length intersection point in wireless distant place, and intersection point is the vanishing point of each class lines bunch.
Further, anglec of rotation computing module includes: straight line gernertion submodule and the anglec of rotation obtain submodule.
This straight line gernertion submodule is configured to the vanishing point the obtaining each class lines bunch central point with pending image
Line, generates the straight line that each class lines bunch are corresponding.
This anglec of rotation obtains submodule and is configured to obtain the most class line of lines quantity that straight line gernertion submodule generates
The angle of straight line corresponding to bar bunch and axis, angle is the anglec of rotation of pending image.
About the device in above-described embodiment, wherein modules performs the concrete mode of operation in the reality about the method
Execute in example and be described in detail, explanation will be not set forth in detail herein.
Lines by extracting the lines of pending image, and are clustered by the image processing apparatus of the present embodiment, and acquisition is treated
In process image, in each class lines bunch, all length is more than the lines of the first preset length intersection point in wireless distant place, and intersection point is
The vanishing point of each class lines bunch, it is achieved that obtain the vanishing point of pending image, and in class lines bunch each in pending image
The length of lines filters, and improves the precision asking for vanishing point;It addition, by obtain pending image vanishing point after, point
Do not obtain the line of the vanishing point of each class lines bunch and the central point of pending image, generate corresponding straight of each class lines bunch
Line, obtains the angle of straight line corresponding to the most class lines bunch of lines quantity and axis, and angle is the rotation of pending image
Angle, it is achieved calculate the anglec of rotation of pending image according to vanishing point, and without calculating Intrinsic Matrix, it is not necessary to use mesh
The front Intrinsic Matrix and the outer parameter matrix edit methods to image that obtain image according to vanishing point;And the anglec of rotation determines
After, according to the anglec of rotation of pending image with cut ratio and complete pending image is cut, it is achieved the editor to figure
Cut process, obtain optimal cutting image.
Fig. 7 is according to a kind of block diagram for image processing apparatus shown in an exemplary embodiment.Such as, device 800
Can be mobile phone, computer, digital broadcast terminal, messaging devices, game console, tablet device, medical treatment
Equipment, body-building equipment, personal digital assistant etc..
With reference to Fig. 7, device 800 can include following one or more assembly: processes assembly 802, memorizer 804, electricity
Source component 806, multimedia groupware 808, audio-frequency assembly 810, the interface 812 of input/output (I/O), sensor cluster
814, and communications component 816.
Process assembly 802 and generally control the integrated operation of device 800, such as with display, call, data communication, phase
The operation that machine operation and record operation are associated.Process assembly 802 and can include that one or more processor 820 performs to refer to
Order, to complete all or part of step of above-mentioned method.Additionally, process assembly 802 can include one or more module,
Be easy between process assembly 802 and other assemblies is mutual.Such as, process assembly 802 and can include multi-media module, with
Facilitate multimedia groupware 808 and process between assembly 802 mutual.
Memorizer 804 is configured to store various types of data to support the operation at equipment 800.The example of these data
Including any application program for operating on device 800 or the instruction of method, contact data, telephone book data, disappear
Breath, picture, video etc..Memorizer 804 can by any kind of volatibility or non-volatile memory device or they
Combination realizes, such as static RAM (SRAM), and Electrically Erasable Read Only Memory (EEPROM),
Erasable Programmable Read Only Memory EPROM (EPROM), programmable read only memory (PROM), read only memory (ROM),
Magnetic memory, flash memory, disk or CD.
The various assemblies that power supply module 806 is device 800 provide electric power.Power supply module 806 can include power-supply management system,
One or more power supplys, and other generate, manage and distribute, with for device 800, the assembly that electric power is associated.
The screen of one output interface of offer that multimedia groupware 808 is included between device 800 and user.Implement at some
In example, screen can include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel,
Screen may be implemented as touch screen, to receive the input signal from user.Touch panel includes that one or more touch passes
Sensor is with the gesture on sensing touch, slip and touch panel.Touch sensor can not only sense touch or sliding action
Border, but also detect the persistent period relevant to touch or slide and pressure.In certain embodiments, multimedia group
Part 808 includes a front-facing camera and/or post-positioned pick-up head.When equipment 800 is in operator scheme, such as screening-mode or
During video mode, front-facing camera and/or post-positioned pick-up head can receive the multi-medium data of outside.Each front-facing camera
Can be a fixing optical lens system with post-positioned pick-up head or there is focal length and optical zoom ability.
Audio-frequency assembly 810 is configured to output and/or input audio signal.Such as, audio-frequency assembly 810 includes a Mike
Wind (MIC), when device 800 is in operator scheme, during such as call model, logging mode and speech recognition mode, Mike
Wind is configured to receive external audio signal.The audio signal received can be further stored memorizer 804 or via
Communications component 816 sends.In certain embodiments, audio-frequency assembly 810 also includes a speaker, is used for exporting audio frequency letter
Number.
I/O interface 812 provides interface for processing between assembly 802 and peripheral interface module, above-mentioned peripheral interface module is permissible
It is keyboard, puts striking wheel, button etc..These buttons may include but be not limited to: home button, volume button, start button and
Locking press button.
Sensor cluster 814 includes one or more sensor, for providing the state estimation of various aspects for device 800.
Such as, what sensor cluster 814 can detect equipment 800 opens/closed mode, the relative localization of assembly, such as group
Part is display and the keypad of device 800, and sensor cluster 814 can also detect device 800 or 800 1 groups of device
The position change of part, the presence or absence that user contacts with device 800, device 800 orientation or acceleration/deceleration and device
The variations in temperature of 800.Sensor cluster 814 can include proximity transducer, is configured to do not having any physics to connect
The existence of object near detection when touching.Sensor cluster 814 can also include optical sensor, such as CMOS or ccd image
Sensor, for using in imaging applications.In certain embodiments, this sensor cluster 814 can also include acceleration
Sensor, gyro sensor, Magnetic Sensor, pressure transducer or temperature sensor.
Communications component 816 is configured to facilitate the communication of wired or wireless mode between device 800 and other equipment.Device
800 can access wireless network based on communication standard, such as WiFi, 2G or 3G, or combinations thereof.An example
Property embodiment in, communications component 816 via broadcast channel receive from external broadcasting management system broadcast singal or broadcast phase
Pass information.In one exemplary embodiment, communications component 816 also includes near-field communication (NFC) module, short to promote
Cheng Tongxin.Such as, can be based on RF identification (RFID) technology in NFC module, Infrared Data Association (IrDA) technology,
Ultra broadband (UWB) technology, bluetooth (BT) technology and other technologies realize.
In the exemplary embodiment, device 800 can be by one or more application specific integrated circuits (ASIC), numeral
Signal processor (DSP), digital signal processing appts (DSPD), PLD (PLD), scene can
Programming gate array (FPGA), controller, microcontroller, microprocessor or other electronic components realize, for performing
State method.
In the exemplary embodiment, additionally provide a kind of non-transitory computer-readable recording medium including instruction, such as, wrap
Including the memorizer 804 of instruction, above-mentioned instruction can have been performed said method by the processor 820 of device 800.Such as,
Non-transitory computer-readable recording medium can be ROM, random access memory (RAM), CD-ROM, tape,
Floppy disk and optical data storage devices etc..
A kind of non-transitory computer-readable recording medium, when the instruction in storage medium is performed by the processor of mobile terminal
Time so that mobile terminal is able to carry out a kind of image processing method, and the method includes:
Obtain the vanishing point of pending image;
The anglec of rotation of pending image is calculated according to vanishing point;
Calculate pending image cuts ratio;
According to the anglec of rotation and cut the pending image of ratio-dependent cut region.
Wherein, calculate pending image cuts ratio, including:
The ratio on the minimum edge according to pending image and maximum limit obtains the intrinsic angle of pending image;
Ratio is cut according to what intrinsic angle and the anglec of rotation calculated pending image.
Wherein, according to intrinsic angle and the anglec of rotation calculate pending image cut ratio before, also include:
Carrying out remainder operation according to the anglec of rotation and the first predetermined angle, obtain the remainder angle of pending image, first presets
Angle is 90 degree;
The cutting with reference to angle of pending image is obtained according to remainder angle and intrinsic angle sum;
Ratio is cut according to what intrinsic angle and the anglec of rotation calculated pending image, including:
According to intrinsic angle and cut with reference to the pending image of angle calculation cut ratio.
Wherein, obtain the cutting with reference to before angle of pending image according to remainder angle and intrinsic angle sum, also include:
Judging whether remainder angle is less than or equal to the second predetermined angle, the second predetermined angle is 45 degree;
Cut with reference to angle according to what remainder angle and intrinsic angle sum obtained pending image, including:
If remainder angle is less than or equal to the second predetermined angle, then obtain pending figure according to remainder angle and intrinsic angle sum
Cutting with reference to angle of picture;
If remainder angle is more than the second predetermined angle, then obtain pending image according to the difference of the first predetermined angle with remainder angle
Difference angle, obtain the cutting with reference to angle of pending image according to difference angle and intrinsic angle sum.
Wherein, according to intrinsic angle and cut with reference to the pending image of angle calculation cut ratio, including:
According to the most angled sine value and the sine value cutting reference angle, obtain pending image cuts ratio.
Wherein, according to the anglec of rotation and cut the pending image of ratio-dependent cut region, including:
According to the anglec of rotation with cut that ratio is counter looks into pending image, obtaining the maximum rectangle of pending image, maximum rectangle is
Pending image cut region.
Wherein, calculate pending image cut ratio before, also include:
Judge that whether the anglec of rotation is less than predetermined threshold value;
Calculate pending image cuts ratio, including:
If the anglec of rotation is less than predetermined threshold value, then calculate pending image cuts ratio.
Wherein, before obtaining the vanishing point of pending image, also include:
Extract the lines of pending image, and lines are clustered;
Obtain the vanishing point of pending image, including:
Obtain in pending image the lines more than the first preset length of all length in each class lines bunch in wireless distant place
Intersection point, intersection point is the vanishing point of each class lines bunch.
Wherein, calculate the anglec of rotation of pending image according to vanishing point, including:
Obtain the line of the vanishing point of each class lines bunch and the central point of pending image respectively, generate each class lines bunch correspondence
Straight line;
Obtaining the angle of straight line corresponding to the most class lines bunch of lines quantity and axis, angle is the rotation of pending image
Angle.
Wherein, before extracting the lines of pending image, also include:
Obtain the line length of pending image;
Judge that whether line length is more than or equal to the second preset length;
Extract the lines of pending image, including:
Extract line length in pending image and be more than the lines of the second preset length.
Those skilled in the art, after considering description and putting into practice invention disclosed herein, will readily occur to other reality of the present invention
Execute scheme.The application is intended to any modification, purposes or the adaptations of the present invention, these modification, purposes or
Adaptations follow the present invention general principle and include the undocumented common knowledge in the art of the disclosure or
Conventional techniques means.Description and embodiments is considered only as exemplary, and true scope and spirit of the invention are by following power
Profit requires to point out.
It should be appreciated that the invention is not limited in precision architecture described above and illustrated in the accompanying drawings, and can
To carry out various modifications and changes without departing from the scope.The scope of the present invention is only limited by appended claim.
Claims (20)
1. an image processing method, it is characterised in that including:
Obtain the vanishing point of pending image;
The anglec of rotation of described pending image is calculated according to described vanishing point;
Calculate described pending image cuts ratio;
According to the described anglec of rotation and described cut pending image described in ratio-dependent cut region.
Method the most according to claim 1, it is characterised in that the described pending image of described calculating cut ratio,
Including:
The ratio on the minimum edge according to described pending image and maximum limit obtains the intrinsic angle of described pending image;
Ratio is cut according to what described intrinsic angle and the described anglec of rotation calculated described pending image.
Method the most according to claim 2, it is characterised in that described according to described intrinsic angle and the described anglec of rotation
Calculate described pending image cut ratio before, also include:
Carry out remainder operation according to the described anglec of rotation and the first predetermined angle, obtain the remainder angle of pending image, described
First predetermined angle is 90 degree;
The cutting with reference to angle of described pending image is obtained according to described remainder angle and described intrinsic angle sum;
Described cut ratio according to what described intrinsic angle and the described anglec of rotation calculated described pending image, including:
According to described intrinsic angle and described cut with reference to pending image described in angle calculation cut ratio.
Method the most according to claim 3, it is characterised in that described according to described remainder angle with described intrinsic angle
Cutting with reference to before angle of the sum described pending image of acquisition, also includes:
Judging whether described remainder angle is less than or equal to the second predetermined angle, described second predetermined angle is 45 degree;
Described obtain the cutting with reference to angle, bag of described pending image according to described remainder angle and described intrinsic angle sum
Include:
If described remainder angle is less than or equal to described second predetermined angle, then according to described remainder angle and described intrinsic angle
Cutting with reference to angle of the sum described pending image of acquisition;
If described remainder angle is more than described second predetermined angle, then according to described first predetermined angle and described remainder angle it
Difference obtains the difference angle of described pending image, waits to locate according to described difference angle and the acquisition of described intrinsic angle sum
Cutting with reference to angle of reason image.
5. according to the method described in claim 3 or 4, it is characterised in that described according to described intrinsic angle with described cut
Ratio is cut with reference to pending image described in angle calculation, including:
Cut the sine value with reference to angle according to described solid angled sine value with described, obtain cutting of described pending image
Take ratio.
6. according to the method described in any one of claim 1-4, it is characterised in that described according to the described anglec of rotation with described
Cut pending image described in ratio-dependent cuts region, including:
According to the described anglec of rotation with described cut that ratio is counter looks into described pending image, obtain the maximum of described pending image
Rectangle, described maximum rectangle be described pending image cut region.
7. according to the method described in any one of claim 1-4, it is characterised in that cutting of the described pending image of described calculating
Before taking ratio, also include:
Judge that whether the described anglec of rotation is less than predetermined threshold value;
The described pending image of described calculating cut ratio, including:
If the described anglec of rotation is less than described predetermined threshold value, then calculate described pending image cuts ratio.
Method the most according to claim 1, it is characterised in that before the vanishing point of the pending image of described acquisition, also wrap
Include:
Extract the lines of described pending image, and described lines are clustered;
The vanishing point of the pending image of described acquisition, including:
Obtain in described pending image the lines more than the first preset length of all length in each class lines bunch at radio remote
The intersection point at place, described intersection point is the vanishing point of each class lines bunch.
Method the most according to claim 8, it is characterised in that described according to the described vanishing point described pending image of calculating
The anglec of rotation, including:
Obtain the line of the vanishing point of each class lines bunch and the central point of described pending image respectively, generate each class lines bunch
Corresponding straight line;
Obtaining the angle of straight line corresponding to the most class lines bunch of lines quantity and axis, described angle is described pending figure
The anglec of rotation of picture.
Method the most according to claim 8 or claim 9, it is characterised in that the lines of the described pending image of described extraction
Before, also include:
Obtain the line length of described pending image;
Judge that whether described line length is more than or equal to the second preset length;
The lines of the described pending image of described extraction, including:
Extract line length in described pending image and be more than the lines of described second preset length.
11. 1 kinds of image processing apparatus, it is characterised in that including:
Vanishing point acquisition module, is configured to obtain the vanishing point of pending image;
Anglec of rotation computing module, is configured to the described vanishing point according to described acquisition module obtains and calculates described pending image
The anglec of rotation;
Cutting ratio computing module, be configured to calculate described pending image cuts ratio;
Determine module, be configured to the described anglec of rotation that calculates according to described anglec of rotation computing module and described cut ratio
Cut pending image described in ratio-dependent described in computing module calculating cuts region.
12. devices according to claim 11, it is characterised in that described in cut ratio computing module and include:
Intrinsic angle obtains submodule, and the ratio being configured to the minimum edge according to described pending image and maximum limit obtains institute
State the intrinsic angle of pending image;
Cut ratio calculating sub module, be configured to according to described intrinsic angle obtain submodule obtain described intrinsic angle and
Described anglec of rotation calculating sub module calculate the described anglec of rotation calculate described pending image cut ratio.
13. devices according to claim 12, it is characterised in that described device also includes;
Remainder angle acquisition module, is configured to the described anglec of rotation and first calculated according to described anglec of rotation computing module
Predetermined angle carries out remainder operation, obtains the remainder angle of pending image, and described first predetermined angle is 90 degree;
Cut with reference to angle acquisition module, be configured to the described remainder angle that obtains according to described remainder angle acquisition module and
Cutting with reference to angle of the described intrinsic angle sum described pending image of acquisition that described intrinsic angle acquisition submodule obtains;
The described ratio calculating sub module that cuts includes: first cuts ratio calculating sub module;
Described first cuts ratio calculating sub module, is configured to obtain the described solid of submodule acquisition according to described intrinsic angle
Angled and described cutting cuts cutting of pending image described in reference angle calculation with reference to described in angle acquisition module obtains
Take ratio.
14. devices according to claim 13, it is characterised in that described device also includes:
First judge module, be configured to judge described remainder angle that described remainder angle acquisition module obtains whether less than or
Equal to the second predetermined angle, described second predetermined angle is 45 degree;
Described cutting includes with reference to angle acquisition module: first cuts reference angle acquisition submodule and second cuts with reference to angle
Obtain submodule;
Described first cuts with reference to angle acquisition submodule, if being configured to the described remainder angle that described first judge module judges
Degree less than or equal to described second predetermined angle, then is waited to locate according to described remainder angle and the acquisition of described intrinsic angle sum
Cutting with reference to angle of reason image;
Described second cuts with reference to angle acquisition submodule, if being configured to the described remainder angle that described first judge module judges
Degree more than described second predetermined angle, then obtains described pending according to described first predetermined angle with the difference of described remainder angle
The difference angle of image, cuts reference according to what described difference angle and described intrinsic angle sum obtained described pending image
Angle.
15. according to the device described in claim 13 or 14, it is characterised in that described in cut ratio calculating sub module and include:
Second cuts ratio calculating sub module;
Described second cuts ratio calculating sub module, is configured to obtain the described solid of submodule acquisition according to described intrinsic angle
Angled sine value cuts the sine value with reference to angle with described cutting with reference to described in angle acquisition module obtains, and obtains institute
That states pending image cuts ratio.
16. according to the device described in any one of claim 11-14, it is characterised in that described determine that module includes:
Determine submodule, be configured to the described anglec of rotation that obtains according to described anglec of rotation computing module and described cut ratio
Example computing module cuts that ratio is counter looks into described pending image described in calculating, and obtains the maximum rectangle of described pending image,
Described maximum rectangle be described pending image cut region.
17. according to the device described in any one of claim 11-14, it is characterised in that described device also includes:
Second judge module, is configured to judge whether the described anglec of rotation that described anglec of rotation computing module calculates is less than pre-
If threshold value;
The described ratio computing module that cuts includes: the 3rd cuts ratio calculating sub module;
Described 3rd cuts ratio calculating sub module, if the described anglec of rotation being configured to described second judge module judgement is little
In described predetermined threshold value, then calculate described pending image cuts ratio.
18. devices according to claim 11, it is characterised in that described device also includes:
Extraction module, is configured to extract the lines of described pending image, and is clustered by described lines;
Described vanishing point acquisition module includes: vanishing point obtains submodule;
Described vanishing point obtains submodule, is configured to obtain each class line in the described pending image that described extraction module extracts
In bar bunch, all length is more than the lines of the first preset length intersection point in wireless distant place, and described intersection point is each class lines bunch
Vanishing point.
19. devices according to claim 18, it is characterised in that described anglec of rotation computing module includes:
Straight line gernertion submodule, is configured to the central point of vanishing point and the described pending image obtaining each class lines bunch
Line, generate the straight line that each class lines bunch are corresponding;
The anglec of rotation obtains submodule, is configured to obtain the class that lines quantity that described straight line gernertion submodule generates is most
The angle of straight line corresponding to lines bunch and axis, described angle is the anglec of rotation of described pending image.
20. according to the device described in claim 18 or 19, it is characterised in that described device also includes:
Line length acquisition module, is configured to obtain the line length of described pending image;
3rd judge module, be configured to judge described line length that described line length acquisition module obtains whether more than or
Equal to the second preset length;
Described extraction module includes: extract submodule;
Described extraction submodule, is configured to extract line length in the described pending image that described 3rd judge module judges
Lines more than described second preset length.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610334341.1A CN106023087A (en) | 2016-05-19 | 2016-05-19 | Image processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610334341.1A CN106023087A (en) | 2016-05-19 | 2016-05-19 | Image processing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106023087A true CN106023087A (en) | 2016-10-12 |
Family
ID=57095283
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610334341.1A Pending CN106023087A (en) | 2016-05-19 | 2016-05-19 | Image processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106023087A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108304840A (en) * | 2017-08-31 | 2018-07-20 | 腾讯科技(深圳)有限公司 | A kind of image processing method and device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101192269A (en) * | 2006-11-29 | 2008-06-04 | 佳能株式会社 | Method and device for estimating vanishing point from image, computer program and its storage medium |
CN101510297A (en) * | 2008-02-15 | 2009-08-19 | 索尼株式会社 | Image processing method and apparatus |
CN102208025A (en) * | 2011-05-27 | 2011-10-05 | 中国科学院自动化研究所 | Method for correcting geometric distortion of text image |
CN103714530A (en) * | 2012-09-28 | 2014-04-09 | 深圳先进技术研究院 | Vanishing point detection and image correction method |
CN104735293A (en) * | 2013-12-24 | 2015-06-24 | 卡西欧计算机株式会社 | Image Correction Apparatus And Image Correction Method |
CN105453131A (en) * | 2012-04-27 | 2016-03-30 | 奥多比公司 | Automatic adjustment of images |
-
2016
- 2016-05-19 CN CN201610334341.1A patent/CN106023087A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101192269A (en) * | 2006-11-29 | 2008-06-04 | 佳能株式会社 | Method and device for estimating vanishing point from image, computer program and its storage medium |
CN101510297A (en) * | 2008-02-15 | 2009-08-19 | 索尼株式会社 | Image processing method and apparatus |
CN102208025A (en) * | 2011-05-27 | 2011-10-05 | 中国科学院自动化研究所 | Method for correcting geometric distortion of text image |
CN105453131A (en) * | 2012-04-27 | 2016-03-30 | 奥多比公司 | Automatic adjustment of images |
CN103714530A (en) * | 2012-09-28 | 2014-04-09 | 深圳先进技术研究院 | Vanishing point detection and image correction method |
CN104735293A (en) * | 2013-12-24 | 2015-06-24 | 卡西欧计算机株式会社 | Image Correction Apparatus And Image Correction Method |
Non-Patent Citations (1)
Title |
---|
许晓伟 等: "基于灭点的倾斜畸变车牌图像快速校正方法研究", 《计算机应用研究》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108304840A (en) * | 2017-08-31 | 2018-07-20 | 腾讯科技(深圳)有限公司 | A kind of image processing method and device |
CN108304840B (en) * | 2017-08-31 | 2022-11-11 | 腾讯科技(深圳)有限公司 | Image data processing method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104700353B (en) | Image filters generation method and device | |
CN105809704A (en) | Method and device for identifying image definition | |
WO2016061929A1 (en) | Terminal exception handling method and device, and electronic equipment | |
WO2017128767A1 (en) | Fingerprint template input method and device | |
CN106572299A (en) | Camera switching-on method and device | |
CN107122679A (en) | Image processing method and device | |
CN105426878B (en) | Face cluster method and device | |
CN104219445B (en) | Screening-mode method of adjustment and device | |
CN106980840A (en) | Shape of face matching process, device and storage medium | |
CN106775525A (en) | Control the method and device of projecting apparatus | |
CN104460185A (en) | Automatic focusing method and device | |
CN107515669A (en) | Display methods and device | |
CN107766820A (en) | Image classification method and device | |
CN108062547A (en) | Character detecting method and device | |
CN107426489A (en) | Processing method, device and terminal during shooting image | |
CN104933419A (en) | Method and device for obtaining iris images and iris identification equipment | |
CN106329635A (en) | Terminal charging method and device | |
CN106339695A (en) | Face similarity detection method, device and terminal | |
CN107948510A (en) | The method, apparatus and storage medium of Focussing | |
CN108108671A (en) | Description of product information acquisition method and device | |
CN104980662A (en) | Method for adjusting imaging style in shooting process, device thereof and imaging device | |
CN104965645A (en) | Unlocking method and apparatus | |
CN107480785A (en) | The training method and device of convolutional neural networks | |
CN105208284A (en) | Photographing reminding method and device | |
CN104020628A (en) | Flash lamp prompting method and device thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20161012 |