This application is based on application No. 2000-47471 filed in Japan, the content of which is hereby incorporated by reference.
1. Field of the Invention
The present invention relates to image data editing.
2. Description of the Prior Art
In performing taking photographs with a camera, there are cases where the camera inclines due to a shake of the camera caused by a hand movement or the like. The inclination of the camera causes a problem when a subject including a horizontal straight line such as the horizon or a vertical straight line such as a tall tree or a high-rise building is photographed. That is, when a horizontal straight line or a vertical straight line is photographed with the camera inclined, a disagreeable print is obtained in which the subject is inclined with respect to the horizontal or the vertical direction of the photographic frame. In the case of a digital image taking with a digital camera or the like, a disagreeable image is obtained in which the horizontal or the vertical straight line is inclined with respect to the display frame of the monitor.
Such an image can be corrected so that the horizontal or the vertical straight line in the image is parallel to the display frame of the monitor by capturing the image in a computer and rotating it by use of an image editing software program. Specifically, the user captures the digital image into a computer, and enters a rotation angle into the image editing software program (for example, xe2x80x9cPhotoshopxe2x80x9d by Adobe Systems Incorporated). Then, the image is displayed being rotated by the rotation angle, so that the horizontal or the vertical straight line is parallel to the horizontal direction or the vertical direction of the display frame of the monitor.
For the user to enter the rotation angle of the image, it is necessary to determine how much the subject is inclined. However, it is not easy to determine the angle at which the image displayed on the monitor is inclined. It is necessary for the user to first enter a rotation angle considered appropriate and viewing the rotated image, further enter another rotation angle to correct the inclination. It is cumbersome for the user to find out the rotation angle through such trial and error.
Other methods of determining how much the subject is inclined include determining the subject inclination by the user specifying two points on a horizontal or a vertical straight line to identify the horizontal or the vertical straight line and calculating the inclination of the straight line. To correct the subject inclination, the image is rotated so that the straight line is parallel to the horizontal or the vertical direction of the display frame of the monitor.
However, even by this method, the subject inclination cannot accurately be determined when the straight line determined by the specified two points and the horizontal or the vertical straight line do not coincide with each other, that is, when the specified two points are not situated on the horizontal or the vertical straight line. Therefore, when the image is rotated based on the obtained inclination, the horizontal or the vertical straight line in the rotated image is not parallel to the horizontal or the vertical direction of the display frame of the monitor.
An object of the present invention is to provide a device and a method for detecting the inclination of a subject.
A first aspect of the present invention provides an inclination detecting device comprising:
a display for displaying on a screen a subject image comprising a plurality of pixels;
a pixel specifier for a user to specify a first pixel from among the pixels;
a calculator for defining a pixel group constituting a circumference of an area including the specified first pixel, and calculating deviations in pixel value between adjoining pixels of the pixel group; and
a detector for selecting a second pixel and a third pixel based on the calculated deviations, and detecting an inclination of a straight part of the subject based on the selected second and third pixels. Moreover, the first aspect of the present invention provides an image processing apparatus provided with the inclination detecting device.
According to this structure, when the user specifies the first pixel, an area including the first pixel is defined, and based on the pixel value deviations of the pixel group surrounding the area, the second pixel and the third pixel are selected. Based on the selected second and third pixels, more concretely, the inclination of the straight line determined by the second and the third pixels is detected as the inclination of the straight part of the subject. Since the inclination of the straight part of the subject represents the overall inclination of the subject in the image, how much the subject is inclined can easily be detected.
The detector selects pixels where the deviations are maximum and minimum as the second pixel and the third pixel.
The detector detects the inclination of a straight line connecting the second pixel and the third pixel as the inclination of the straight part of the subject, and the inclination detecting device further comprises an image rotation processor for rotating the image based on the detected inclination of the straight part to thereby correct the inclination.
According to this structure, the image is rotated based on the detected inclination of the subject, whereby the inclination of the subject can be corrected. Consequently, only by specifying the first pixel, the user can obtain an image where the inclination is corrected.
The image rotation processor decides the direction in which the image is rotated, according to the inclination of the straight part.
According to this structure, the direction in which the image is rotated is decided according to the detected inclination of the subject. With this, the direction in which the image is rotated is decided and the inclination of the subject is corrected without the need for the user to specify the direction. Consequently, the load on the user is reduced.
Another aspect of the present invention provides an inclination detecting method comprising:
displaying on a screen a subject image comprising a plurality of pixels;
accepting a specifying, by a user, of a first pixel from among the pixels;
defining a pixel group constituting a circumference of an area including the specified first pixel and calculating deviations in pixel value between adjoining pixels of the pixel group;
selecting a second pixel and a third pixel based on the calculated deviations; and
detecting an inclination of a straight part of the subject based on the selected second and third pixels. Moreover, this aspect of the present invention provides an image processing apparatus executing the inclination detecting method.
According to this method, when the user specifies the first pixel, an area including the first pixel is defined, and based on the pixel value deviations of the pixel group surrounding the area, the second pixel and the third pixel are selected. Based on the selected second and third pixels, more concretely, the inclination of the straight line determined by the second and the third pixels is detected as the inclination of the straight part of the subject. Since the inclination of the straight part of the subject represents the overall inclination of the subject in the image, how much the subject is inclined can easily be detected.
In the selecting, pixels where the deviations are maximum and minimum are selected as the second pixel and the third pixel.
In the detecting, the inclination of a straight line connecting the second pixel and the third pixel is detected as the inclination of the straight part of the subject, and the inclination detecting method further comprises rotating the image based on the detected inclination of the straight part to thereby correct the inclination.
According to this method, the image is rotated based on the detected inclination of the subject, whereby the inclination of the subject can be corrected. Consequently, only by specifying the first pixel, the user can obtain an image where the inclination is corrected.
In the rotating, the direction in which the image is rotated is decided according to the inclination of the straight part.
According to this method, the direction in which the image is rotated is decided according to the detected inclination of the subject. With this, the direction in which the image is rotated is decided and the inclination of the subject is corrected without the need for the user to specify the direction. Consequently, the load on the user is reduced.
Still another aspect of the present invention provides a computer program product for executing a method comprising:
displaying on a screen a subject image comprising a plurality of pixels;
accepting a specifying, by a user, of a first pixel from among the pixels;
defining a pixel group constituting a circumference of an area including the specified first pixel and calculating deviations in pixel value between adjoining pixels of the pixel group;
selecting a second pixel and a third pixel based on the calculated deviations; and
detecting an inclination of a straight part of the subject based on the selected second and third pixels. Moreover, this aspect of the present invention provides an image processing apparatus executing such a computer program.
According to this computer program product, when the user specifies the first pixel, an area including the first pixel is defined, and based on the pixel value deviations of the pixel group surrounding the area, the second pixel and the third pixel are selected. Based on the selected second and third pixels, more concretely, the inclination of the straight line determined by the second and the third pixels is detected as the inclination of the straight part of the subject. Since the inclination of the straight part of the subject represents the overall inclination of the subject in the image, how much the subject is inclined can easily be detected.
In the selecting, pixels where the deviations are maximum and minimum are selected as the second pixel and the third pixel.
In the detecting, the inclination of a straight line connecting the second pixel and the third pixel is detected as the inclination of the straight part of the subject, and the computer program product further comprises rotating the image based on the detected inclination of the straight part to thereby correct the inclination.
According to this computer program product, the image is rotated based on the detected inclination of the subject, whereby the inclination of the subject can be corrected. Consequently, only by specifying the first pixel, the user can obtain an image where the inclination is corrected.
In the rotating, the direction in which the image is rotated is decided according to the inclination of the straight part.
According to this computer program product, the direction in which the image is rotated is decided according to the detected inclination of the subject. With this, the direction in which the image is rotated is decided and the inclination of the subject is corrected without the need for the user to specify the direction. Consequently, the load on the user is reduced.
These and other objects, advantages and features of the invention will become apparent from the following description thereof taken in conjunction with the accompanying drawings, which illustrate specific embodiments of the invention.