Photographing apparatus and method

The present disclosure provides an image obtaining method, a photographing apparatus and a storage medium. The image obtaining method includes the following operations: obtaining a plurality of images of a target scene at more than one focal lengths; processing a first image to obtain a reference image, wherein in the plurality of images, an image with a predetermined viewing angle is a standard image, and remaining images are first images, and image of the target scene in the reference image has same size as image of the target scene in the standard image; and substituting a clear area in the reference image for a corresponding area in the standard image.

The present application claims priority to Chinese Patent Application No. 201410257622.2, filed with the State Intellectual Property Office of China on Jun. 12, 2014 and entitled “All-in-focus image obtaining method and camera”, which is hereby incorporated by reference in its entirety.

FIELD DISCLOSURE

The present disclosure relates to the field of image processing technologies, and in particular relates to an image obtaining method, a photographing apparatus and a storage medium.

BACKGROUND DISCLOSURE

To obtain the image of a scene or an object, a photographing apparatus is often used for taking an image.

The photographing apparatus may include a lens, a focusing component, a photosensitive element, an image storage device and the like. In the prior art, when an image is obtained, a specific focal length generally needs to be obtained by adopting the focusing component to adjust the focal length of the lens to a certain value, so that the scene which is focused on is clearly presented in the image. After a photographing signal is obtained, the photographing apparatus performs image photography, wherein the light reflected or emitted by the scene penetrates through the lens and is converted into image information in the photosensitive element, then the image information is stored in the image storage device.

SUMMARY DISCLOSURE

Some embodiments of the present disclosure provide an image obtaining method, which includes:

obtaining a plurality of images of a target scene at more than one focal lengths;

processing a first image to obtain a reference image, wherein in the plurality of images, an image with a predetermined viewing angle is a standard image, and remaining images are first images, and image of the target scene in the reference image has the same size as image of the target scene in the standard image; and

substituting a clear area in the reference image for a corresponding area in the standard image.

Some embodiments of the present disclosure provide a photographing apparatus, which includes:

a lens and photosensitive and focusing components, configured to obtain a plurality of images of a target scene at more than one focal lengths;

a storage component, configured to store the plurality of images and computer-readable program codes; and

an image processing component, configured to perform the computer-readable program codes in the storage component to implement:

processing a first image to obtain a reference image, wherein in the plurality of images, an image with a predetermined viewing angle is a standard image, and remaining images are first images, and image of the target scene in the reference image has the same size as image of the target scene in the standard image; and

substituting a clear area in the reference image for a corresponding area in the standard image.

Some embodiments of the present disclosure provide a storage medium which stores computer-readable program codes, wherein the computer-readable program codes are executed by one or more processing components to implement:

obtaining a plurality of images of a target scene at more than one focal lengths;

processing a first image to obtain a reference image, wherein in the plurality of images, an image with a predetermined viewing angle is a standard image, and remaining images are first images, and image of the target scene in the reference image has the same size as image of the target scene in the standard image; and

substituting a clear area in the reference image for a corresponding area in the standard image.

DETAILED DESCRIPTION OF THE EMBODIMENTS

A description of technical solutions in the embodiments of the present disclosure will be given below, in combination with the drawings of some embodiments of the present disclosure. Apparently, the embodiments described below are merely a part, but not all, of the embodiments of the present disclosure. All of the other embodiments, obtained by those of ordinary skills in the art based on the embodiments of the present disclosure without any inventive efforts, fall into the protection scope of the present disclosure.

The meanings indicated by reference signs inFIGS. 1-15of some embodiments of the present disclosure include but are not limited to the following contents:

100refers to photographing apparatus;11refers to lens,12refers to focusing component;13refers to photosensitive element;14refers to image processing component;15refers to image storage component;21refers to standard image;22refers to first image;23refers to reference image;24refers to image (such as all-in-focus image); O refers to origin of second coordinate system; O′ refers to origin of first coordinate system; a, b, c, d, e, f and g refer to preset focal lengths; f1refers to the distance between preset focal lengths a and b; f2refers to the distance between preset focal lengths b and c; f3refers to distance between preset focal lengths c and d; f4refers to distance between preset focal lengths d and e;15refers to distance between preset focal lengths e and f, f6refers to distance between preset focal lengths f and g; F1refers to minimum focal length of target scene; F2refers to maximum focal length of target scene; Z refers to first focusing range; A refers to clear imaging area of circular object in standard image; A′ refers to fuzzy imaging area of circular object in first image; A″ refers to enlarged A′ area; B refers to clear imaging area of rectangular object in first image; B′ refers to fuzzy imaging area of rectangular object in standard image; B″ refers to enlarged B′ area; m, n, p and q refer to focusing lengths of target scene:01,02,03and04refer to areas of standard image; C and D refer to second pure color areas; M refers to central point of second pure color area D; N refers to central point of second pure color area C; L2refers to second distance;01′,02′,03′ and04′ refer to areas of first image; C′ and D′ refer to first pure color areas; M′ refers to central point of first pure color area D′; N′ refers to central point of first pure color area C′; and L1refers to first distance.

As shown inFIG. 1, a photographing apparatus100for obtaining images according to some embodiments of the present disclosure includes a lens11, a focusing component12, a photosensitive element13, an image processing component14, an image storage component15and the like. The focusing component12may adjust the focal length of the lens11after obtaining a photographing indication, so that the lens11is focused at different focal lengths within the same angle; the lens11and the photosensitive element13may obtain images focused at different focal lengths; the image processing component14is configured to take the image with a minimum viewing angle in the images obtained by the lens11and the photosensitive element13as a standard image21, take the remaining images as the images to be processed, which are referred to as first images22, and amplify each first image22to obtain a reference image23; the scene image in the clear area B″ of the reference image23has the same size as the scene image in the corresponding area B′ of the standard image21; and finally, pixel values of the clear area B″ in the reference image23are used for replacing pixel values of the corresponding area B′ in the standard image21to obtain an image. In some embodiments of the present disclosure, the image acquired through the device ofFIG. 1may be an all-in-focus image. The images presented in the corresponding area B′ and the clear area B″ are images of the same object in the target scene, and the image with the minimum viewing angle may be preset as an image with the maximum or minimum focal length according to different types of lens.

As shown inFIG. 2, some embodiments of the present disclosure provide a method for obtaining images. The method may include the following operations: a plurality of images of a target scene are obtained at more than one focal lengths, wherein in the plurality of images, the image with a predetermined viewing angle may be used as a standard image21, and the remaining images are used as the images to be processed, which are referred to as first images22; a first image may be processed to obtain a reference image23, wherein the image of the target scene in the reference image23has the same size as the image of the target scene in the standard image21; and a clear area B″ in the reference image23is used for replacing a corresponding area B′ in the standard image21to obtain an image24, wherein all target objects in the image24are clearly presented. The predetermined viewing angle may be determined according to different demands, e.g., the image with the predetermined viewing angle may be the one with a minimum viewing angle in the plurality of images. In addition, the first images may be processed by adopting an appropriate processing manner according to different demands, e.g., the first images may be enlarged. For example, in some embodiments, the image24may be an all-in-focus image.

Some embodiments of the present disclosure provide a method for obtaining images. As shown inFIG. 3, firstly, a plurality of images of a target scene may be obtained at more than one focal lengths, namely, the focusing component12adjusts the focal length of the lens11, so that the photographing apparatus obtains the plurality of images of the target scene at more than one focal lengths. Then the image with a minimum viewing angle is used as a standard image, and the remaining images are used as first images. The coordinate values of all the pixel points in the first image are enlarged according to a preset parameter to obtain a reference image, wherein the central point of a first image is an origin of a first coordinate system, so that the image of the target scene in the reference image has the same size as the image of the target in the standard image. A clear area is obtained in the reference image. Pixel values and coordinate values of first pixel points in the clear area are obtained, wherein the first pixel points are all the pixel points in the clear area. Pixel values and coordinate values of second pixel points in the standard image are obtained, wherein the central point of the standard image is an origin of a second coordinate system, and the second pixel points are all the pixel points in the standard image. When the coordinate values of the first pixel points are the same as the coordinate values of the second pixel points, the pixel values of the first pixel points are substituted for the pixel values of the second pixel points.

In some embodiments, as shown inFIG. 4, the preset focal lengths may be a, b, c, d, e, f and g; f1may be the distance between the preset focal lengths a and b;2may be the distance between the preset focal lengths b and c; f3may be the distance between the preset focal lengths c and d; f4may be the distance between the preset focal lengths d and e; f5may be the distance between the preset focal lengths e and f,16may be the distance between the preset focal lengths f and g; and the differences between the preset focal lengths may have the following rules: f1<f2<f34<f5<f6, so that in a plurality of images, obtained by a photographing apparatus, of a target scene, the foreground part of the scene may have a plurality of focused pictures, while the background part has fewer focused pictures. The focusing component12enables the focal length of the lens11to be a, b, c, d, e, for g, and the photographing apparatus100may obtain the plurality of images of the target scene at all the preset focal lengths through the lens11and the photosensitive element13.

In some embodiments, before the distance of the lens is adjusted, the photographing apparatus100acquires a first focal length range Z of the target scene and obtains the plurality of images at more than one preset focal lengths within the first focusing range Z. As shown inFIG. 5, the focal length range of the target scene is the first focal length range Z, wherein the minimum focal length of the target scene is F1, the maximum focal length of the target scene is F2, at the moment, the preset focal length of the photographing apparatus100may be a, b, c, d, e, for g, the preset focal lengths positioned in the first focusing range may be c, d, e and f, the photographing apparatus100obtains the plurality of images only at the preset focal lengths c, d, e and f, and in such a manner, the quantity of the acquired images may be reduced, so that the volume of data which needs to be processed when the image processing component14processes the images is reduced.

In addition, the image processing component14may fuse the plurality of acquired images, take the image with the minimum viewing angle in the plurality of acquired images as a standard image21, take the remaining images as the images to be processed, which are referred to as first images22and amplify a first image22according to a preset parameter to obtain a reference image23, wherein the scene image in the clear area B″ of the reference image23may be as big as the scene image in the corresponding area B′ of the standard image21. The image with the minimum viewing angle is used as the standard image21, so that scene information included in the standard image21may be the least, namely, the standard image21does not include part of image information at the edge of the first image22, and the finally obtained image24does not include unclear areas.

In some embodiments, as shown inFIG. 6, the standard image21may include images of two objects, wherein the circular object may be presented as a clear image A, and the rectangular object may be presented as a fuzzy image B′. The first image22, as shown inFIG. 7, may include two objects (namely, objects inFIG. 8), wherein the circular object is presented as a fuzzy image A′, and the rectangular object is presented a clear image B.

It could be known in combination withFIG. 7andFIG. 8that, the operations of enlarging the first image22according to the preset parameter to obtain the reference image23may include: obtaining the central point O′ of the first image22; establishing a first coordinate system by using O′ as a coordinate origin, and enlarging coordinate values of all pixel points in the reference image according to the preset parameter, so as to ensure that the rectangular object image in the clear area B″ of the reference image23has the same size as the rectangular object image in the corresponding area B′ of the standard image; and obtaining the reference image23. The rectangular object image in the clear area B″ of the reference image23may be as big as the rectangular object image in the corresponding area B′ of the standard image21, wherein the magnitude of the preset parameter is relevant to the focal length of the first image and the focal length of the standard image.

Next, the image processing component14may obtain the clear area B″ in the reference image23.

In the operation of substituting the clear area B″ in the reference image23for the corresponding area B′ in the standard image21to obtain the image24, the image processing component may utilize the clear area B″ in the reference image23to replace the fuzzy area B′ in the standard image21, so as to obtain the image24, wherein all the target objects in the image24may be clearly presented.

In some embodiments, as shown inFIG. 6,FIG. 8andFIG. 9, the image processing component14may obtain the pixel value of each pixel point in the clear area B″ of the reference image23and the coordinate value of each pixel point in the first coordinate system, obtain the central point O in the standard image and use O as the coordinate origin of a second coordinate system, and obtain pixel values of second pixel points in the standard image21and coordinate values of the second pixel points in the second coordinate system; when the coordinate values of the first pixel points in the first coordinate system are the same as the coordinate values of the second pixel points in the first coordinate system, in the standard image21, the image processing component14may utilize the pixel values of the first pixel points in the clear area B″ of the reference image23to replace the second pixel values of the second pixel points in the standard image21, so that the fussy area B′ in the standard image is substituted into the clear area B″ in the reference image23to obtain the image24. Since the pixel value of each pixel point includes image information of an object image at the pixel point, the image24includes clear image information of the circular object and the rectangular object, so that both the circular object and the rectangular object are presented as clear images, to thereby overcome the defect that a part of a photographed image is clear and the other part is fuzzy in the prior art.

Some embodiments of the present disclosure provide a method for obtaining images. As shown inFIG. 10, in the operation of obtaining images of a target scene at more than one focusing lengths, the focusing component12may adjust the focal length of the lens11, so that the photographing apparatus obtains a plurality of images of the target scene at more than one focusing lengths. The image with a minimum viewing angle is used as a standard image, and the remaining images are used as first images. The coordinate values of all the pixel points in the first image is enlarged according to a preset parameter to obtain a reference image, wherein the central point of a first image herein is an origin of a first coordinate system. The first image is divided into areas, wherein one vertex of each area is set in the origin of the first coordinate system. Two first pure color areas in different areas and a first distance between the central points of the two first pure color areas are obtained. The standard image is divided into areas in the same division manner as in the first image, wherein one vertex of each area is set in the origin of the second coordinate system. Two second pure color areas in different corresponding areas are obtained. A second distance between the central points of the two second pure color areas is obtained. An adjusting parameter according to the first distance and the second distance is obtained. The coordinate values of all the pixel points in the first image are enlarged according to the adjusting parameter, so that the image of the target scene in the enlarged first image has the same size as the image in the standard image. Pixel values and coordinate values of first pixel points in the clear area are obtained, wherein the first pixel points are all the pixel points in the clear area. Pixel values and coordinate values of second pixel points in the standard image are obtained, wherein the second pixel points are all the pixel points in the standard image. When the coordinate values of the first pixel points are the same as the coordinate values of the second pixel points, the pixel values of the first pixel points are substituted for the pixel values of the second pixel points.

In some embodiments, in combination withFIG. 10andFIG. 11, the photographing apparatus100may automatically scan the obtained focusing lengths m, n, p and q of the target scene after obtaining a photographing signal, and obtain a plurality of images of the target scene at the focusing lengths m, n, p and q respectively.

In addition, the image processing component14may fuse the plurality of acquired images, take the image with the minimum viewing angle in the plurality of acquired images as a standard image21, take the remaining images as images to be processed, which are referred to as first images22and amplify a first image22according to a preset parameter to obtain a reference image23, wherein the scene image in the clear area B″ of the reference image23may be as big as the scene image in the corresponding area B′ of the standard image21. The image with the minimum viewing angle is used as the standard image21, so that scene information included in the standard image21may be the least, namely, the standard image21does not include part of image information at the edge of the first images22, and the finally obtained image does not include unclear areas.

In some embodiments, as shown inFIG. 10,FIG. 12andFIG. 13, the fuzzy image of the rectangular object in the standard image21may form a fuzzy imaging area B, and the clear image in a first image22may form a clear imaging area B.

The central point O′ of the first image22is acquired; a first coordinate system is established by using O′ as a coordinate origin, coordinate values of all pixel points in the first image are acquired in the first coordinate system, wherein horizontal coordinates are referred to as x′, vertical coordinates are referred to as y′, the first image is divided into areas according to a certain rule, and the division rule in this embodiment is as follows: in01′ area, x′=y′, and x′>0; in02′ area, x′=−y′, and x′<0; in03′ area, x′=y′, and x′<0; and in04′ area, x′=−y′, and x′>0.

Pure color areas in different areas of the first image22are acquired, as shown inFIG. 13, the pure color area C′ is positioned in the02′ area, the pure color area D′ is positioned in the03′ area, the pure color areas C′ and D′ indicate that the area C′ may be of a single color, and the area D′ may be of a single color, the colors of the area C′ and the area D′ may be identical or different, the first central point N′ of the pure color area C′ and the first central point M′ of the pure color area D′ are further acquired, and the first distance L1between the first central points M′ and N′ is further acquired.

The central point O of the standard image21is acquired; a second coordinate system is established by using O as a coordinate origin, coordinate values of all pixels in the standard image are acquired in the second coordinate system, wherein horizontal coordinates are referred to as x, vertical coordinates are referred to as y, the standard image is divided into areas according to a certain rule, and the division rule in some embodiments is as follows: in01area, x=y, and x>0; in02area, x=−y, and x<0; in03area, x=y, and x<0; and in04area, x=−y, and x>0. The01area corresponds to the01′ area, the02area corresponds to the02′ area, the03area corresponds to the03′ area, and the04area corresponds to the04′ area.

Pure color areas in different areas of the standard image21are acquired, as shown inFIG. 12, 02in the standard image21is the corresponding area of the02′ area in the first image22,03in the standard image21is the corresponding area of the03′ area in the first image22, the pure color area C is positioned in the02area, the pure color area D is positioned in the03area, the pure color areas C and D indicate that the area C and the area D may be of single colors, the colors of the area C and the area D may be identical or different, the first central point N of the pure color area C and the first central point M of the pure color area D are further acquired, and the second distance L2between the first central points M and N is further acquired.

The area C and the area C′ are images of the same pure-color target scene in the standard image21and the first image22respectively, and the area D and the area D′ are images of the same pure-color target scene in the standard image21and the first image22respectively.

It should be noted that, the acquisition of the first distance L1and the second distance L2may not be limited by sequence, the image processing component14may obtain the first distance L1and then obtain the second distance L2, or obtain the second distance L2and then obtain the first distance L1, or simultaneously obtain the first distance L1and the second distance L2, and all the variations belong to the basic inventive thought of the present disclosure.

The image processing component may obtain an adjusting parameter according to the first distance L1and the second distance L2, and amplify the coordinate values of all pixel points in the first image22according to the adjusting parameter, to obtain the reference image23. The coordinate values of all the pixel points in the first image22are enlarged, so that the image of the to-be-imaged scene in the reference image23has the same size as the image of the to-be-imaged scene in the standard image21. As mentioned inFIG. 15, the image of the rectangular object in the reference image23has the same size as the image of the rectangular object in the standard image21, namely, the area B″ in the reference image23has the same size as the area B′ in the standard image21.

Next, the image processing component14acquires the clear area B″ in the reference image23.

In the operation of substituting the clear area B″ in the reference image for the corresponding area B′ in the standard image to obtain the image24, the image processing component may utilize the clear area B″ in the acquired reference image23to replace the fuzzy area B′ in the standard image21to obtain the image24, and all the target objects in the image24may be clearly presented, so that the defect that a part of a photographed image is clear and the other part is fuzzy in the prior art may be overcome.

In some embodiments, as shown inFIGS. 12-15, the image processing component14acquires the pixel value of each pixel point in the clear area B″ of the reference image23and the coordinate value of each pixel point in the first coordinate system, and acquires pixel values of second pixel points in the standard image21and coordinate values of the second pixel points in the second coordinate system; when the coordinate values of the first pixel points in the first coordinate system are the same as the coordinate values of the second pixel points in the second coordinate system, in the standard image21, the image processing component14utilizes the pixel values of the first pixel points in the clear area B″ of the reference image23to replace the second pixel values of the second pixel points in the standard image21, so that the fussy area B′ in the standard image is substituted into the clear area B″ in the reference image23to obtain the image24, wherein the circular object and the rectangular object in the image24may be presented as clear images, to thereby overcome the defect that a part of a photographed image is clear and the other part is fuzzy in the prior art.

The photographing apparatus provided by the embodiments of the present disclosure may further include an image display component, a photographing trigger component, a flash lamp and the like.

The photographing apparatus provided by the embodiments of the present disclosure may be a digital camera, a video camera or a portable mobile terminal with a photographing function such as a mobile phone or a PAD (personal assistant device), which is not limited by the embodiments of the present disclosure.

The foregoing descriptions are merely some embodiments of the present disclosure, while the protection scope of the present disclosure will not be limited thereto, those skilled in the art can make various modifications and variations to the present disclosure without departing from the scope of the present disclosure, thus the present disclosure is intended to encompass these modifications and variations thereto so long as the modifications and variations come into the scope of the present disclosure. Accordingly, the protection scope of the claims should be construed as the protection scope of the present disclosure.