CN103489155B - A kind of photographic method of sensor-based horizontal automatic straightening - Google Patents
A kind of photographic method of sensor-based horizontal automatic straightening Download PDFInfo
- Publication number
- CN103489155B CN103489155B CN201310429143.XA CN201310429143A CN103489155B CN 103489155 B CN103489155 B CN 103489155B CN 201310429143 A CN201310429143 A CN 201310429143A CN 103489155 B CN103489155 B CN 103489155B
- Authority
- CN
- China
- Prior art keywords
- angle
- sensor
- size
- inclination
- image
- 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.)
- Active
Links
Landscapes
- Image Processing (AREA)
- Image Analysis (AREA)
- Editing Of Facsimile Originals (AREA)
Abstract
The present invention relates to the photographic method of a kind of sensor-based horizontal automatic straightening, analyze and the angle of inclination of record sensor in moment of taking pictures, and according to this angle of inclination, original image is rotated and cutting, obtain result images;Thus without using image processing software that photo is carried out secondary editor upon taking a picture, it is to avoid the distortion that image procossing causes, not only efficiency is high, and image effect is good.
Description
Technical field
The present invention relates to a kind of image processing method, a kind of sensor-based horizontal automatic straightening
Photographic method.
Background technology
Current digital camera is taken pictures or mobile phone photograph becomes more and more popular, but sometimes due to extraneous factor
Interference, the horizontal plane causing the photo taken is oblique, and the visual effect of photo is bad even to be affected
Photo attractive in appearance so that the photo taken all is abandoned, or needs it is carried out secondary editor.
Summary of the invention
The present invention solves the problems referred to above, it is provided that taking pictures of a kind of sensor-based horizontal automatic straightening
Method.
For achieving the above object, the technical solution used in the present invention is:
The photographic method of a kind of sensor-based horizontal automatic straightening, it is characterised in that include following step
Rapid:
Step 1. clicks on key of taking pictures;
The angle of inclination of sensor is analyzed and recorded to step 2., and carry out data capture and obtain original image;
Original image is rotated, after being rotated by step 3. according to the angle of inclination of record in step 2
Image;
Step 4. is by being calculated result size, and according to result size, rotated image is carried out cutting
Obtain result images.
Preferably, the key of taking pictures in described step 1 is soft key or the key of firmly taking pictures of taking pictures;Wherein, soft take pictures
Key is that on screen, user can click on the membrane keyboard carrying out taking pictures;Key of firmly taking pictures is to be supplied to specially on equipment
User presses the hardware button taken pictures.
Preferably, the sensor in described step 2 is gravity sensor or gyro sensor.
Preferably, the angle of inclination in described step 2 is because Gravity changer is drawn by calculating gravity sensor
The acceleration risen, thus obtain at the moment equipment angle of inclination with gravity direction of taking pictures.
Preferably, the angle of inclination in described step 2 is because of Gravity changer by computing gyroscope sensor
The change in the gyro vector axis direction, inside caused, thus obtain inclining at take pictures moment equipment and gravity direction
Rake angle.
Preferably, in described step 3 angle of inclination according to step 2 record original image carried out based on
The RC rotation of this original image.
Preferably, the size of the full saturation of a size of rotated image of the result in described step 4, its
Computational methods are as follows:
First, by the range shorter at the angle of inclination of original image between 0~90 degree:
If angle of inclination is more than 360 degree, then angle=angle-360;
If angle of inclination is more than 180 degree, then angle=360-angle;
If angle of inclination is more than 90 degree, then angle=180-angle;
Then, original graph image height and wide ratio offset=nHeight/nWidth are calculated;
Calculate the arc tangent radian value of this ratio: srcAngle=atan (offset);
Then, cornerwise length r of result of calculation size:
If original image be wider than height, then length r=(nHeight*0.5/cos (srcAngle+angle
*π/180-π/2));If the width of original image is less than height, then length r=(nWidth*0.5/
cos(srcAngle-angle*π/180));
Finally, obtain described result size according to length r of angle, and according to this result size to rotation
Rear image carries out cutting and obtains result images:
W=(r*cos (srcAngle));
H=(r*sin (srcAngle));
Wherein, nWidth is the width of the original size of original image, and nHeight is the original of original image
The height of size, angle is the angle of inclination of the original size of original image;R is the diagonal of result size
Length;Offset is the ratio of the Gao Yukuan of original size;SrcAngle is original size Gao Yukuan
The arc tangent radian value of ratio;W is the width of result size;H is the height of result size;π is pi.
The invention has the beneficial effects as follows:
The present invention passes through to analyze and the angle of inclination of record sensor in moment of taking pictures, and according to this inclination angle
Original image is rotated and cutting by degree, obtains result images, thus without using image upon taking a picture
Processing software and photo is carried out secondary editor, it is to avoid the distortion that image procossing causes, not only efficiency is high, and
And image effect is good.
Accompanying drawing explanation
Accompanying drawing described herein is used for providing a further understanding of the present invention, constitutes of the present invention
Point, the schematic description and description of the present invention is used for explaining the present invention, is not intended that the present invention's
Improper restriction.In the accompanying drawings:
Fig. 1 is the general flow chart of the photographic method of the present invention horizontal automatic straightening based on study;
Fig. 2 is the original image for effect of the present invention is described;
Fig. 3 is that Fig. 2 original image is through rotated image;
Fig. 4 is the result images after using photographic method automatic straightening of the present invention.
Detailed description of the invention
In order to make the technical problem to be solved, technical scheme and beneficial effect clearer, bright
In vain, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that herein
Described specific embodiment, only in order to explain the present invention, is not intended to limit the present invention.
As it is shown in figure 1, the photographic method of a kind of sensor-based horizontal automatic straightening of the present invention, bag
Include following steps:
Step 1. clicks on key of taking pictures;
The angle of inclination of sensor is analyzed and recorded to step 2., and carry out data capture and obtain original image;
Original image is rotated, after being rotated by step 3. according to the angle of inclination of record in step 2
Image;Preferably, described rotation is based on the RC rotation of original image;
Step 4. is by being calculated result size, and according to result size, rotated image is carried out cutting
Obtain result images.
Key of taking pictures in described step 1 can be soft key of taking pictures, it is also possible to for key of firmly taking pictures;Wherein, soft
Key of taking pictures is that on screen, user can click on the membrane keyboard carrying out taking pictures;Key of firmly taking pictures is to carry specially on equipment
Supply user presses the hardware button taken pictures.
Preferably, the sensor in described step 2 is gravity sensor or gyro sensor:
According to gravity sensor, angle of inclination is caused because of Gravity changer by calculating gravity sensor
Acceleration, thus obtain at the moment equipment angle of inclination with gravity direction of taking pictures;Gravity sensor is root
Carrying out work according to the principle of piezoelectric effect, " for there is not symmetrical centre in so-called piezoelectric effect
The external force that heteropolar crystal is added on crystal, in addition to making crystal deform upon, also will change the polarization of crystal
State, sets up electric field at crystals, this makes medium occur the phenomenon of polarization to claim due to mechanical force
For direct piezoelectric effect ";Gravity sensor is exactly to make use of its internal crystal change caused due to acceleration
This characteristic of shape, owing to this deformation can produce voltage, produces voltage and adding of being applied as long as calculating
Relation between speed, it is possible to acceleration is changed into voltage output;It is to measure internal one in simple terms
The component size of the orthogonal both direction of gravity of the weight being made of one with piezoelectric patches, judges horizontal direction,
Mobile phone or camera cause the change of center of gravity when altering one's posture so that it is cursor change location thus realize select
Etc. function, the most just the angle of inclination of current device and gravity direction can be obtained in moment of taking pictures.
According to gyro sensor, angle of inclination is because Gravity changer is drawn by computing gyroscope sensor
The change in the gyro vector axis direction, inside risen, thus obtain in the moment equipment inclination with gravity direction of taking pictures
Angle;The principle of gyro sensor is exactly, and the direction of the rotary shaft indication of a rotating object be not subject to
When external force affects, will not change;Having a gyro inside it, its axle is due to gyroscopic effect all the time
Parallel with inceptive direction, thus can calculate actual direction by the drift gauge with inceptive direction, pass through
The angle of equipment and gyro thus calculate the angle of inclination of moment current device and the gravity direction taken pictures.
Preferably, the size of the full saturation of a size of rotated image of the result in described step 4, its
Computational methods are as follows:
First, by the range shorter at the angle of inclination of original image between 0~90 degree:
If angle of inclination is more than 360 degree, then angle=angle-360;
If angle of inclination is more than 180 degree, then angle=360-angle;
If angle of inclination is more than 90 degree, then angle=180-angle;
Then, original graph image height and wide ratio offset=nHeight/nWidth are calculated;
Calculate the arc tangent radian value of this ratio: srcAngle=atan (offset);
Then, cornerwise length r of result of calculation size:
If original image be wider than height, then length r=(nHeight*0.5/cos (srcAngle+angle
*π/180-π/2));If the width of original image is less than height, then length r=(nWidth*0.5/
cos(srcAngle-angle*π/180));
Finally, according to length r of angle being obtained described result size:
W=(r*cos (srcAngle));
H=(r*sin (srcAngle));
Wherein, nWidth is the width of the original size of original image, and nHeight is the original of original image
The height of size, angle is the angle of inclination of the original size of original image;R is the diagonal of result size
Length;Offset is the ratio of the Gao Yukuan of original size;SrcAngle is original size Gao Yukuan
The arc tangent radian value of ratio;W is the width of result size;H is the height of result size;π is pi.
According to the above results size, rotated image is carried out cutting and obtain result images, thus without clapping
Take rear employing image processing software and picture is carried out secondary editor, it is to avoid the distortion that image procossing causes, no
Only efficiency is high, and image effect is good.
Described above illustrate and describes the preferred embodiments of the present invention, as before, be to be understood that the present invention is also
It is not limited to form disclosed herein, is not to be taken as the eliminating to other embodiments, and can be used for each
Kind of other combinations, amendment and environment, and can in invention contemplated scope herein, by above-mentioned teaching or
Technology or the knowledge of association area are modified.And the change that those skilled in the art are carried out and change without departing from
The spirit and scope of the present invention, the most all should be in the protection domain of claims of the present invention.
Claims (6)
1. the photographic method of a sensor-based horizontal automatic straightening, it is characterised in that include following
Step:
Step 1. clicks on key of taking pictures;
The angle of inclination of sensor is analyzed and recorded to step 2., and carry out data capture and obtain original image;
Original image is rotated, after being rotated by step 3. according to the angle of inclination of record in step 2
Image;
Step 4. is by being calculated result size, and according to result size, rotated image is carried out cutting
Obtain result images;
Wherein, the size of the full saturation of a size of rotated image of the result in described step 4, its meter
Calculation method is as follows:
First, by the range shorter at the angle of inclination of original image between 0~90 degree:
If angle of inclination is more than 360 degree, then angle=angle-360;
If angle of inclination is more than 180 degree, then angle=360-angle;
If angle of inclination is more than 90 degree, then angle=180-angle;
Then, original graph image height and wide ratio offset=nHeight/nWidth are calculated;
Calculate the arc tangent radian value of this ratio: srcAngle=atan (offset);
Then, cornerwise length r of result of calculation size:
If original image be wider than height, then length r=(nHeight*0.5/cos (srcAngle+angle
*π/180-π/2));If the width of original image is less than height, then length r=(nWidth*0.5/
cos(srcAngle-angle*π/180));
Finally, obtain described result size according to length r of angle, and according to this result size to rotation
Rear image carries out cutting and obtains result images:
W=(r*cos (srcAngle));
H=(r*sin (srcAngle));
Wherein, nWidth is the width of the original size of original image, and nHeight is the original of original image
The height of size, angle is the angle of inclination of the original size of original image;R is the diagonal of result size
Length;Offset is the ratio of the Gao Yukuan of original size;SrcAngle is original size Gao Yukuan
The arc tangent radian value of ratio;W is the width of result size;H is the height of result size;π is pi.
The photographic method of a kind of sensor-based horizontal automatic straightening the most according to claim 1,
It is characterized in that: the key of taking pictures in described step 1 is soft key or the key of firmly taking pictures of taking pictures;Wherein, soft take pictures
Key is that on screen, user can click on the membrane keyboard carrying out taking pictures;Key of firmly taking pictures is to be supplied to specially on equipment
User presses the hardware button taken pictures.
The photographic method of a kind of sensor-based horizontal automatic straightening the most according to claim 1,
It is characterized in that: the sensor in described step 2 is gravity sensor or gyro sensor.
The photographic method of a kind of sensor-based horizontal automatic straightening the most according to claim 3,
It is characterized in that: the angle of inclination in described step 2 is because Gravity changer is drawn by calculating gravity sensor
The acceleration risen, thus obtain at the moment equipment angle of inclination with gravity direction of taking pictures.
The photographic method of a kind of sensor-based horizontal automatic straightening the most according to claim 3,
It is characterized in that: the angle of inclination in described step 2 is because of Gravity changer by computing gyroscope sensor
The change in the gyro vector axis direction, inside caused, thus obtain inclining at take pictures moment equipment and gravity direction
Rake angle.
The photographic method of a kind of sensor-based horizontal automatic straightening the most according to claim 1, its
It is characterised by: in described step 3, original image is carried out former based on this by the angle of inclination according to step 2 record
The RC rotation of beginning image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310429143.XA CN103489155B (en) | 2013-09-18 | 2013-09-18 | A kind of photographic method of sensor-based horizontal automatic straightening |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310429143.XA CN103489155B (en) | 2013-09-18 | 2013-09-18 | A kind of photographic method of sensor-based horizontal automatic straightening |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103489155A CN103489155A (en) | 2014-01-01 |
CN103489155B true CN103489155B (en) | 2016-10-05 |
Family
ID=49829355
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310429143.XA Active CN103489155B (en) | 2013-09-18 | 2013-09-18 | A kind of photographic method of sensor-based horizontal automatic straightening |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103489155B (en) |
Families Citing this family (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104796619B (en) * | 2015-05-05 | 2018-01-16 | 广东欧珀移动通信有限公司 | The method, device and mobile terminal taken pictures |
CN104994273A (en) * | 2015-06-16 | 2015-10-21 | 成都西可科技有限公司 | System of maintaining real-time shooting image to be vertical and method thereof |
CN104902188A (en) * | 2015-06-19 | 2015-09-09 | 中科创达软件股份有限公司 | Image processing method, system and image acquisition device |
CN105812662A (en) * | 2016-03-17 | 2016-07-27 | 合肥联宝信息技术有限公司 | Image obtaining method |
CN105631832A (en) * | 2016-03-21 | 2016-06-01 | 苏州卡睿知光电科技有限公司 | Lens counting mobile terminal and method |
WO2018032259A1 (en) * | 2016-08-15 | 2018-02-22 | 深圳市大疆创新科技有限公司 | Image processing device and image processing method |
CN106406700A (en) * | 2016-09-13 | 2017-02-15 | 乐视控股(北京)有限公司 | Photographing processing method and device |
CN107995439A (en) * | 2016-10-27 | 2018-05-04 | 中兴通讯股份有限公司 | A kind of video capture, broadcasting, processing method, photo terminal |
CN109345460B (en) * | 2018-09-28 | 2020-04-24 | 百度在线网络技术(北京)有限公司 | Method and apparatus for rectifying image |
CN111683282A (en) * | 2020-06-08 | 2020-09-18 | 三星电子(中国)研发中心 | Image deformation adaptation method and device |
CN116887036A (en) * | 2023-08-04 | 2023-10-13 | 深圳市卓锐通电子有限公司 | Photographing method for automatic horizontal correction of image and related equipment |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7593627B2 (en) * | 2006-08-18 | 2009-09-22 | Sony Ericsson Mobile Communications Ab | Angle correction for camera |
US7567752B2 (en) * | 2006-11-24 | 2009-07-28 | Sony Ericsson Mobile Communications Ab | Image alignment system with overlying frame in display |
US8422788B2 (en) * | 2008-08-26 | 2013-04-16 | Microsoft Corporation | Automatic image straightening |
US8588550B2 (en) * | 2010-10-04 | 2013-11-19 | Sony Corporation | Virtual level for a digital camera |
CN103092344A (en) * | 2013-01-11 | 2013-05-08 | 深圳市金立通信设备有限公司 | Method of controlling terminal screen to rotate and terminal |
-
2013
- 2013-09-18 CN CN201310429143.XA patent/CN103489155B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN103489155A (en) | 2014-01-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103489155B (en) | A kind of photographic method of sensor-based horizontal automatic straightening | |
US11057567B2 (en) | Anti-shake method and apparatus for panoramic video, and portable terminal | |
CN103176347B (en) | Panorama sketch image pickup method and filming apparatus and electronic equipment | |
US10521468B2 (en) | Animated seek preview for panoramic videos | |
CN102353351B (en) | Lateral shooting angle detecting method, inclined shooting angle detecting method and mobile phone | |
JP6204585B2 (en) | Applying video stabilization to multimedia clips | |
JP6081027B2 (en) | Tilt motion for scrolling | |
JP2012253778A (en) | Correcting rolling shutter using image stabilization | |
KR20150079762A (en) | Method, device, and apparatus for controlling screen rotation | |
WO2016086494A1 (en) | Video presentation method for smart mobile terminal | |
JP2016535363A (en) | Tilt motion for scrolling | |
CN103985103A (en) | Method and device for generating panoramic picture | |
WO2019178872A1 (en) | Video image anti-shake method and terminal | |
WO2018214778A1 (en) | Method and device for presenting virtual object | |
TWI700000B (en) | Image stabilization method and apparatus for panoramic video, and method for evaluating image stabilization algorithm | |
CN104363386B (en) | Photo processing method and device | |
CN105091847B (en) | The method and electronic equipment of a kind of measurement distance | |
US10104286B1 (en) | Motion de-blurring for panoramic frames | |
CN109308153A (en) | Picture adjusting method and device, computer readable storage medium, terminal | |
US9921054B2 (en) | Shooting method for three dimensional modeling and electronic device supporting the same | |
CN105718232A (en) | Display method and display device of arbitrary angle plane rotation | |
WO2014205916A1 (en) | Image correction method for use in projection terminal, and projection terminal | |
CN105791663B (en) | Range estimation system and range estimation method | |
CN108366201A (en) | A kind of electronic flutter-proof method based on gyroscope | |
CN103500007A (en) | Method for determining rotation angle of rotating member of terminal and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |