WO2016154806A1 - 一种自动变焦的方法和装置 - Google Patents

一种自动变焦的方法和装置 Download PDF

Info

Publication number
WO2016154806A1
WO2016154806A1 PCT/CN2015/075235 CN2015075235W WO2016154806A1 WO 2016154806 A1 WO2016154806 A1 WO 2016154806A1 CN 2015075235 W CN2015075235 W CN 2015075235W WO 2016154806 A1 WO2016154806 A1 WO 2016154806A1
Authority
WO
WIPO (PCT)
Prior art keywords
preview image
preview
center point
preset template
image
Prior art date
Application number
PCT/CN2015/075235
Other languages
English (en)
French (fr)
Inventor
秦超
郜文美
Original Assignee
华为技术有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201580022563.3A priority Critical patent/CN106464799A/zh
Priority to PCT/CN2015/075235 priority patent/WO2016154806A1/zh
Priority to US15/561,361 priority patent/US10317777B2/en
Publication of WO2016154806A1 publication Critical patent/WO2016154806A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G03PHOTOGRAPHY; CINEMATOGRAPHY; ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ELECTROGRAPHY; HOLOGRAPHY
    • G03BAPPARATUS OR ARRANGEMENTS FOR TAKING PHOTOGRAPHS OR FOR PROJECTING OR VIEWING THEM; APPARATUS OR ARRANGEMENTS EMPLOYING ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ACCESSORIES THEREFOR
    • G03B13/00Viewfinders; Focusing aids for cameras; Means for focusing for cameras; Autofocus systems for cameras
    • G03B13/32Means for focusing
    • G03B13/34Power focusing
    • G03B13/36Autofocus systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/2628Alteration of picture size, shape, position or orientation, e.g. zooming, rotation, rolling, perspective, translation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0007Image acquisition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • H04N23/632Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/633Control of cameras or camera modules by using electronic viewfinders for displaying additional information relating to control or operation of the camera
    • H04N23/635Region indicators; Field of view indicators
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/69Control of means for changing angle of the field of view, e.g. optical zoom objectives or electronic zooming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10141Special mode during image acquisition
    • G06T2207/10148Varying focus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20116Active contour; Active surface; Snakes

Definitions

  • Embodiments of the present invention relate to image processing technologies, and in particular, to a method and apparatus for automatic zooming.
  • the lens zoom technique refers to changing the size of the target scene in the lens in the captured image by changing the focal length of the lens.
  • the zoom mode is divided into: optical zoom and digital zoom.
  • Optical zoom is produced by changes in the position of the lens, object, and focus.
  • Digital zoom is achieved by a processor in a portable electronic device that increases the area of each pixel in the picture for amplification purposes.
  • the portable electronic device can be a mobile terminal with a camera or a digital camera or the like.
  • Optical zoom is generally used in conventional zoom cameras, where the user manually changes the focus by manually rotating the zoom ring on the lens barrel.
  • Digital zoom is mainly used in mobile terminals or ordinary digital cameras. The user changes the focal length by operating the knob on the body or by sliding a finger on the screen.
  • the existing lens zoom method requires the user to manually participate in the zoom, and the user may need to adjust multiple times to adjust to a suitable focal length, which is inconvenient to operate.
  • Embodiments of the present invention provide a method and apparatus for automatic zooming, which can automatically zoom to help a user quickly adjust a subject of a preview image to an appropriate size.
  • a method of automatically zooming comprising:
  • the camera is zoomed according to the zoom parameter.
  • the determining, according to the preview image in the preview frame on the screen, the contour of the body of the preview image and the center point of the body including:
  • a contour of the body and a center point of the body are determined according to a characteristic parameter of the preview image.
  • the determining, according to the preview image in the preview frame on the screen, the contour of the body of the preview image and the center point of the body including:
  • the first preset if the feature parameter of the preview image matches the feature parameter of the first sub-image block in the at least one sub-image block of the first preset template in the at least one preset template.
  • the shape included in the first sub-image block of the template is a body of the preview image, wherein the first preset template is one of the at least one preset template, the first sub- The image block is one of the at least one sub-image block of the first preset template.
  • the method further includes:
  • the method further includes:
  • the captured photo is distorted, the captured photo is fluoroscopy corrected and the corrected photo is saved.
  • the method further includes:
  • the zoom parameter of the camera is restored to an initial value.
  • the shape of the at least one preset template includes: a circle, a rectangle, a triangle, a rule Polygon or irregular polygon.
  • a portable electronic device comprising:
  • a processing module configured to determine an outline of a body of the preview image and a center point of the body according to a preview image in a preview frame on the screen;
  • a determining module configured to determine a zoom parameter according to a contour size of the body and a size of the preview frame when a center point of the body coincides with a center point of the preview frame, where the zoom parameter includes a camera to be adjusted At least one of a focal length and a zoom factor of the preview image;
  • a zoom module configured to zoom the camera according to the zoom parameter.
  • the processing module is specifically configured to:
  • a contour of the body and a center point of the body are determined according to a characteristic parameter of the preview image.
  • the processing module is specifically configured to:
  • the first preset if the feature parameter of the preview image matches the feature parameter of the first sub-image block in the at least one sub-image block of the first preset template in the at least one preset template.
  • the shape included in the first sub-image block of the template is a body of the preview image, wherein the first preset template is one of the at least one preset template, the first sub- The image block is any sub-image block of at least one sub-image block of the first preset template.
  • the portable electronic device further includes a display module
  • the display module is configured to display a center point of the main body and a center point of the preview frame in the preview image, and display prompt information, the prompt information is used to prompt the user to move the center point of the main body to The center point of the preview box.
  • the portable electronic device further includes:
  • a detecting module configured to detect a sharpness of the preview image
  • a photographing module configured to photograph the preview image after the resolution of the preview image meets a preset threshold
  • the detecting module is further configured to detect whether the photographed photograph has perspective distortion
  • the correction module is configured to perform perspective correction on the captured photo and save the corrected photo if the captured photograph has perspective distortion.
  • the detecting module is further configured to: detect Whether the preview image changes;
  • the zoom module is further configured to: if the preview image does not change, keep the zoom parameter of the camera unchanged;
  • the zoom parameter of the camera is restored to an initial value.
  • the shape of the at least one preset template includes: a circle, a rectangle, a triangle, a rule Polygon or irregular polygon.
  • a portable electronic device includes: a camera, a processor, a memory, and a system bus, wherein the memory and the camera are connected to the processor through the system bus;
  • the memory is configured to store a computer execution instruction
  • the processor is configured to execute the computer to execute an instruction, and the method of any one of the first to sixth possible implementations of the first aspect, the first aspect.
  • a non-transitory computer readable medium storing one or more programs, the one or more programs comprising instructions that, when executed by a camera and a portable electronic device including a plurality of applications, are provided
  • the portable electronic device is caused to perform the method of any one of the first to sixth possible implementations of the first aspect.
  • the method and apparatus for automatically zooming determines the outline of the main body of the preview image and the center point of the main body according to the preview image in the preview frame on the screen.
  • the zoom parameter is determined according to the outline size of the main body and the size of the preview frame, and the zoom parameter includes at least one of a focal length of the camera to be adjusted and a zoom ratio of the preview image, and then the camera is zoomed according to the zoom parameter.
  • the method determines the zoom parameter according to the outline size of the main body and the size of the preview frame in the preview image by the portable electronic device, and automatically zooms according to the zoom parameter, thereby helping the user to quickly adjust the main body of the preview image to an appropriate size.
  • FIG. 1 is a flowchart of a method for auto zooming according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic view showing a main shape of a preview image
  • FIG. 3 is a schematic view of a center point of the main body and a center point of the preview frame
  • FIG. 4 is a schematic view after moving a center point of a main body to a center point of a preview frame
  • Figure 5 is a schematic view of mirror image before zooming
  • Figure 6 is a schematic view of mirror image after zooming
  • FIG. 7 is a schematic diagram of digital zooming according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of a preview image after digital zooming
  • FIG. 9 is a flowchart of a method for auto zooming according to Embodiment 2 of the present invention.
  • Figure 10 is a schematic view of the comparison before and after the shape perspective correction
  • FIG. 11 is a flowchart of a method for auto zooming according to Embodiment 3 of the present invention.
  • FIG. 12 is a schematic structural diagram of a portable electronic device according to Embodiment 4 of the present invention.
  • FIG. 13 is a schematic structural diagram of another portable electronic device according to Embodiment 4 of the present invention.
  • FIG. 14 is a schematic structural diagram of a portable electronic device according to Embodiment 5 of the present invention.
  • the method of the automatic zoom provided by the embodiment of the present invention can be applied to a portable electronic device having a camera, and the portable electronic device can be any electronic device, including but not limited to a smart phone, a tablet computer, and a personal digital assistant (English name: Personal Digital Assistant, abbreviation: PDA), media player, smart TV, camera or video camera.
  • PDA Personal Digital Assistant
  • the execution body of S101 to S103 is the portable electronic device, and may be implemented by a module or a chip having a processing function in the portable electronic device, for example: Central processing unit (English full name: central process unit, abbreviation: CPU) and so on. As shown in FIG. 1, the method provided in this embodiment may include the following steps:
  • S101 Determine an outline of the main body in the preview image and a center point of the main body according to the preview image in the preview frame on the screen.
  • the preview image is displayed in the preview frame on the screen of the portable electronic device, and the size of the preview frame may be equal to or smaller than the screen of the portable electronic device, which is in the embodiment of the present invention. Do not limit this.
  • the portable electronic device determines the body of the preview image, as well as the outline and center point of the subject. Specifically, the portable electronic device acquires the feature parameter of the preview image, and then matches the feature parameter of the preview image with the feature parameter of the at least one preset template stored in advance, if the feature parameter of the preview image is at least If the feature parameters of the first preset template in the preset template are successfully matched, determining that the shape included in the first preset template is the body of the preview image, and the first preset template is a preset in the at least one preset template. template.
  • the feature parameters of the preview image and the feature parameters of the preset template include any one of the following parameters or a combination thereof: a color feature, a shape feature, and a texture feature.
  • the portable electronic device may specifically acquire the feature parameters of the preview image by at least one of horizontal vertical projection, edge detection result, shape analysis, or color analysis.
  • the preset template is pre-stored in the portable electronic device, and the shape of the preset template may be: a circle, a rectangle, a triangle, a regular polygon, or an irregular polygon.
  • the center point of the main body is the center point of the circumscribed rectangle of the main body, and the center point of the main body may be represented by a circle or a rectangular frame of a suitable size.
  • the feature parameters of the preview image are respectively matched with the feature parameters of the at least one preset template stored in advance
  • the feature parameters of the preview image and the features of the at least one preset template are integrated.
  • the parameters are matched.
  • the preview image may be first divided into at least one sub-image block according to a preset division manner, and then the feature parameters of each sub-image block are respectively matched with the feature parameters of the at least one preset template, if If the feature parameter of a certain sub-image block is successfully matched with the feature parameter of the first preset template, determining that the shape included in the first preset template is the body of the preview image, where the first preset template may be at least one preset template. Any of the preset templates.
  • FIG. 2 is a schematic diagram of a main shape of a preview image.
  • FIG. 2 there are two main shapes in the figure.
  • the main shape 1 is Matching to the preset template, the main shape 2 does not match the preset template, therefore, the main shape 1 is the main body of the preview image.
  • the division manner of the preview image is not limited, and when the preview image is divided, the plurality of sub-image blocks may overlap each other.
  • the main shape in the preview image may be a complete shape or a partial shape
  • the main shape may be a local shape, which may be because the target object corresponding to the main body is too close, the complete shape cannot be displayed in the preview frame, or the main shape. Deviate from the center point of the preview box. Since the preset template is usually a complete shape, when the main shape of the preview image is a local shape, directly matching the feature parameters of the local shape with the feature parameters of the preset template may cause the matching to fail.
  • each of the plurality of preset templates may be divided into at least one sub-image block, and the feature parameters of the preview image are respectively Matching feature parameters of at least one sub-image block of the preset template, if the preview image feature parameter and the feature parameter of the first sub-image block in the at least one sub-image block of the first preset template in the at least one preset template If the matching is successful, determining that the shape included in the first sub-image block of the first preset template is the main body of the preview image, and the first sub-image block is any sub-image block of the at least one sub-image block of the first preset template.
  • the division manner of the preset template is not limited, and the division manner of the preset template may be the same as the division manner of the preview image, or may be different from the division manner of the preview image.
  • the preview image and the preset template may be separately divided into multiple sub-image blocks, and then the feature parameters of all the sub-image blocks of the preview image and the sub-image blocks of the preset template are respectively Feature parameters are matched.
  • a plurality of subjects may also be included in the preview image.
  • the zoom parameter is determined according to the contour size of the main body and the size of the preview frame, and the zoom parameter includes at least one of a focal length of the camera to be adjusted and a zoom ratio of the preview image.
  • the portable electronic device can also display the center point of the main body and the center point of the preview frame in the preview image, and display prompt information for prompting the user to move the center point of the main body to the center point of the preview frame.
  • FIG. 3 is a schematic view of the center point of the main body and the center point of the preview frame.
  • the larger dotted rectangle in FIG. 3 identifies the outline 11 of the main body, and the dotted circle represents the center point 12 of the main body.
  • a small dashed rectangle represents the center point 13 of the preview box.
  • the center point of the preview frame may be the position of the center of the preview frame, or the golden point of the preview frame, or the power point of the nine-square grid of the preview frame.
  • the portable electronic device also displays a prompt message prompting the user to move the center point of the subject to a position that coincides with the center point of the preview frame.
  • the prompt information may specifically be a character, for example, by displaying a text “Please move the center point of the main body to a position overlapping the center point of the preview frame” on the preview image, or the prompt information is a sound, and the displayed text is displayed.
  • the prompt information is a symbol, for example, an arrow is indicated on the preview image to move the center point of the main body to coincide with the center point of the preview frame, and the start position of the arrow is The center point of the main body, the end point of the arrow is the center point of the preview frame, or the prompt information may be a combination of the above three modes.
  • This embodiment does not limit the specific implementation manner of the prompt information.
  • the user can directly move the center point of the body to a position coincident with the center point of the preview frame by dragging.
  • the user can select one subject from multiple subjects according to his own needs. For example, the user can select a subject to be moved by clicking a subject one or more times.
  • the portable electronic device can automatically select a body to be moved from among a plurality of subjects, for example, the portable electronic device detects the contours of the plurality of subject bodies, and selects the body with the largest contour from the plurality of subjects according to the contour size of the plurality of subjects.
  • the main body to be moved when comparing the outline size of the main body, the area of the circumscribed rectangle of the outline of the main body can be compared, and the larger the area of the circumscribed rectangle of the main body, the larger the outline of the main body is considered.
  • the user drags the center point of the subject to be moved to a position coincident with the center point of the preview frame, or the portable electronic device automatically moves the center point of the subject to be moved to the center point of the preview frame Coincident position.
  • FIG. 4 is a view after moving the center point of the main body to the center point of the preview frame.
  • it is necessary to move the center point 12 of the main body from the position shown in FIG. 3 to the position shown in FIG. 4, in which the center point 12 of the main body is smaller than the center point 13 of the preview frame.
  • the center point 12 of the main body coincides with the center point 13 of the preview frame.
  • the focal length of the camera to be adjusted and/or the zoom magnification of the preview image are determined according to the outline size of the main body and the size of the preview frame.
  • the focal length of the camera to be adjusted is an optical zoom parameter
  • the zoom magnification of the preview image is a digital zoom parameter. If the portable electronic device only supports the optical zoom, the focal length of the camera to be adjusted is determined according to the contour size of the main body and the size of the preview frame. If the portable electronic device only supports digital zoom, the zoom factor of the preview image is determined according to the outline size of the subject and the size of the preview frame.
  • the focus of the camera to be adjusted is determined according to the contour size of the main body and the size of the preview frame. If the focal length to be adjusted does not meet the requirements, the zoom magnification of the preview image is further determined. Combine optical zoom and digital zoom to zoom the camera.
  • FIG. 5 is a schematic view of mirror image before zooming
  • FIG. 6 is a schematic view of mirror image after zooming.
  • O is the center point of the coordinate system
  • F1 is the position of one focal length
  • F2 is twice.
  • AB represents the object length of the target object corresponding to the subject
  • A"B" represents the image length after the subject is zoomed.
  • the camera does not move or has a slight movement before and after the zoom, so it can be considered that the object distance u before and after the camera zoom does not change.
  • the object distance can also be measured by an infrared sensor, an ultrasonic sensor or a laser sensor.
  • the focal length of the camera is increased, and of course, the focal length may become small.
  • Digital zoom is to zoom the preview image, which can be calculated as follows: First, determine the actual horizontal maximum length a and the actual longitudinal maximum length b of the main body. Specifically, the circumscribed rectangle of the main body can be determined first, and the length of the circumscribed rectangle is The actual lateral maximum length a of the body, the width of the circumscribed rectangle is the actual longitudinal maximum length b of the body. Then, according to the size of the preview frame, the horizontal maximum length a′ of the main body to be adjusted and the longitudinal maximum length b′ to be adjusted are determined, and the horizontal maximum length a′ to be adjusted is less than or equal to the lateral length of the preview frame, and the longitudinal direction to be adjusted is the largest. The length b' is less than or equal to the longitudinal length of the preview frame.
  • FIG. 7 is a schematic diagram of digital zoom according to an embodiment of the present invention.
  • an O point represents a center point of a main body of a preview image
  • a center point of the main body is also a center point of the preview frame, that is, a center point of the main body and a center of the preview frame.
  • Point coincidence the smaller rectangle in the figure represents the main body, the actual horizontal maximum length of the main body is OA, and the actual longitudinal maximum length of the main body is OG.
  • OB The maximum horizontal length to be adjusted is OB, and OB is the distance from the center point of the main body to the longitudinal boundary of the preview frame.
  • the enlarged preview image is shown in FIG. 8, and FIG. 8 is a schematic diagram of the preview image after digital zooming.
  • the subject of the preview image is adjusted to an appropriate size by optical zoom and/or digital zoom.
  • the outline of the main body of the preview image and the center point of the main body are determined.
  • the root The zoom parameter is determined according to the outline size of the main body and the size of the preview frame, and the zoom parameter includes at least one of a focal length of the camera to be adjusted and a zoom ratio of the preview image, and then the camera is zoomed according to the zoom parameter.
  • the method determines the zoom parameter according to the outline size of the main body and the size of the preview frame in the preview image by the portable electronic device, and automatically zooms according to the zoom parameter, thereby helping the user to quickly adjust the main body to an appropriate size.
  • FIG. 9 is a flowchart of a method for automatically zooming according to Embodiment 2 of the present invention.
  • the execution body of S201 to S208 is the portable electronic device, and may be implemented by a module or a chip having a processing function in the portable electronic device, for example:
  • the central processing unit (English name: central process unit, abbreviated as CPU), etc., as shown in FIG. 9, the method provided in this embodiment may include the following steps:
  • S202 Determine an outline of a body of the preview image and a center point of the body according to the preview image.
  • the zoom parameter is determined according to the outline size of the main body and the size of the preview frame.
  • the zoom parameter includes at least one of a focal length of the camera to be adjusted and a zoom factor of the preview image.
  • the portable electronic device After the body of the preview image is adjusted to an appropriate size, the portable electronic device detects the sharpness of the preview image, and automatically takes a picture of the preview image when the preview image satisfies the definition requirement.
  • Perspective correction also known as perspective control, is the synthesis or editing of photos to get large The process of understanding the results of perspective distortion.
  • Perspective correction is a planar geometric transformation of an image.
  • the more common methods are perspective transformation method and control point transformation method.
  • the perspective transformation method mainly implements the image correction based on the imaging principle of the camera; the control point transformation method adapts to the general image correction.
  • the main principle is to use the bilinear interpolation method to achieve image correction according to the corresponding relationship of the control points.
  • the correction process includes: through perspective correction, all the vertical lines in reality can be displayed in the image as vertical directions, such as vertical columns, vertical sides of the wall, lamp posts, etc., which is generally accepted.
  • Fig. 10 is a comparative diagram before and after the shape perspective correction. Due to the vertical distance, the top of the building is farther away from the ground than the observer. However, the perspective process is usually only considered in the horizontal direction, regardless of the distance in the vertical direction. The distance between the top and the base is the same. For example, in a square room, all the parallel lines such as the four horizontal sides intersect at one point.
  • the scene in this embodiment is a zooming method of the camera during the photographing process after the user completes the photographing in the first stage
  • FIG. 11 is an automatic method according to the third embodiment of the present invention.
  • a flowchart of the method of zooming, S301 to S311, the execution main body is the above-mentioned portable electronic device.
  • the method provided in this embodiment may include the following steps:
  • the portable electronic device detects whether the preview image in the preview frame changes. If the preview image has changed, step S302 is performed, and if the preview image has not changed, step S303 is performed. It should be noted that, in this embodiment, the preview image does not change, and does not mean that the preview image in the preview frame of the previous shooting stage is exactly the same as the preview image in the preview frame of the shooting phase, but in the preview frame of the two shooting stages. The shooting scene did not change, and the preview image in the preview frame of the two shooting stages did not change much, but only made a slight movement.
  • S303 is executed, and the preview image does not change, indicating that the subject of the preview image has not changed, and it is not necessary to determine the zoom parameter again for the subject, and therefore, the zoom parameter is kept unchanged.
  • S304 Determine an outline of the main body of the preview image and a center point of the main body according to the preview image in the preview frame.
  • step S304 is performed.
  • the purpose of this step is to prevent the main body of the preview image from moving out of the preview frame due to the slight movement of the portable electronic device. If the main body of the preview image is enlarged to the edge of the preview frame in the previous shooting stage, the main body of the preview image is easy. Except that the preview frame is removed, in this embodiment, the main body of the preview image can be reduced by slightly reducing the zooming distance of the to-be-adjusted focal length and/or the preview image. At this time, even if the portable electronic device has a slight movement, the main body of the preview image is also Will not move out of the preview box.
  • step S305 is performed.
  • the zoom parameter is determined according to the contour size of the body of the preview image and the size of the preview frame.
  • the portable electronic device provided in this embodiment includes a processing module 21, a determining module 22, and a zoom module 23.
  • the processing module 21 is configured to determine an outline of a body of the preview image and a center point of the body according to a preview image in a preview frame on the screen;
  • a determining module 22 configured to determine a zoom parameter according to a contour size of the body and a size of the preview frame when a center point of the body coincides with a center point of the preview frame, where the zoom parameter includes a camera to be Adjusting at least one of a focal length and a zoom factor of the preview image;
  • the zoom module 23 is configured to zoom the camera according to the zoom parameter.
  • the processing module 21 is specifically configured to: acquire feature parameters of the preview image, and match feature parameters of the preview image with feature parameters of at least one preset template stored in advance, if the preview If the feature parameter of the image is successfully matched with the feature parameter of the first preset template in the at least one preset template, determining that the shape included in the first preset template is the body of the preview image, the first The preset template is one of the at least one preset template; determining a contour of the body and a center point of the body according to a feature parameter of the preview image.
  • the processing module 21 is specifically configured to: acquire feature parameters of the preview image; and respectively select feature parameters of the preview image and at least one of each preset template in the at least one preset template The feature parameters of the image block are matched; if the feature parameter of the preview image matches the feature parameter of the first sub-image block in the at least one sub-image block of the first preset template, the first pre-determination is determined.
  • the shape of the first sub-image block of the template is a body of the preview image, wherein the first preset template is one of the at least one preset template, the first The sub-image block is one sub-image block of at least one sub-image block of the first preset template.
  • the shape of the at least one preset template includes: a circle, a rectangle, a triangle, a regular polygon, or an irregular polygon.
  • FIG. 13 is a schematic structural diagram of another portable electronic device according to Embodiment 4 of the present invention,
  • the portable electronic device further includes a display module 24, a detection module 25, a photographing module 26, and a correction module 27, based on the portable electronic device shown in FIG.
  • the display module 24 is configured to display a center point of the main body and a center point of the preview frame in the preview image, and display prompt information, where the prompt information is used to prompt the user to move the center point of the main body To the center point of the preview box.
  • a detecting module 25 configured to detect a sharpness of the preview image
  • the photographing module 26 is configured to photograph the preview image after the resolution of the preview image meets a preset threshold
  • the detecting module 25 is further configured to detect whether the photographed photograph has perspective distortion
  • the correction module 27 is configured to perform perspective correction on the captured photo and save the corrected photo if the captured photograph has perspective distortion.
  • the detecting module 25 is further configured to: detect whether the preview image changes; correspondingly, the zoom module 23 is further configured to: If the preview image does not change, the zoom parameter of the camera is kept unchanged; if the preview image changes, the zoom parameter of the camera is restored to an initial value.
  • the portable electronic device provided in the fourth embodiment can be used to perform the methods, specific implementation manners and technical effects of the first embodiment to the third embodiment, and details are not described herein.
  • FIG. 14 is a schematic structural diagram of a portable electronic device according to Embodiment 5 of the present invention.
  • the portable electronic device 300 provided in Embodiment 5 can be used to implement the methods in Embodiment 1 to Embodiment 3 of the present invention.
  • the portable electronic device provided by this embodiment includes a camera 31, a processor 32, a memory 33, and a system bus 34.
  • the memory 33 and the camera 31 are connected to the processor 32 via the system bus 34.
  • the camera 31 is configured to collect a preview image and transmit the collected preview image to the processor 32.
  • the processor 32 is a control center for the portable electronic device that connects the various portions of the entire portable electronic device with various interfaces and lines, by running or executing software programs and/or modules stored in the memory 33, and for recalling stored in the memory 33. Data to perform portable Various functions and/or processing data of electronic devices.
  • the processor 32 may be composed of an integrated circuit (English name: Integrated Circuit, IC for short), for example, may be composed of a single package IC, or may be composed of a plurality of package ICs that have the same function or different functions.
  • the processor 32 may include only a central processing unit (English name: Central Processing Unit, CPU for short), or a GPU, a digital signal processor (English name: Digital Signal Processor, DSP for short), and communication.
  • a combination of control chips eg, baseband chips) in a cell.
  • the memory 33 can be used to store software programs and modules, and the processor 32 executes various functional applications of the portable electronic device and implements data processing by running software programs and modules stored in the memory 33.
  • the memory 33 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, such as a sound playing program, an image playing program, etc.; the data storage area can be stored according to the portable electronic Data created by the use of the device (such as audio data, phone book, etc.).
  • the storage unit may include a volatile memory, such as a non-volatile dynamic random access memory (English name: Nonvolatile Random Access Memory, NVRAM for short), phase change random access memory (English full name: Phase Change RAM (PRAM), magnetoresistive random access memory (English name: Magnetoresistive RAM, MRAM for short), etc., may also include non-volatile memory, such as at least one disk storage device, electronically erasable Programming read-only memory (English full name: Electrically Erasable Programmable Read-Only Memory, EEPROM for short), flash memory devices, such as reverse or flash memory (English full name: NOR flash memory) or reverse flash (English full name: NAND flash memory).
  • NVRAM Nonvolatile Random Access Memory
  • PRAM Phase Change RAM
  • MRAM Magnetoresistive random access memory
  • EEPROM electrically Erasable Programmable Read-Only Memory
  • flash memory devices such as reverse or flash memory (English full name: NOR flash memory) or reverse flash (English full name: NAND flash memory).
  • the non-volatile memory stores the operating system and applications executed by processor 32.
  • the processor 32 loads the running program and data from the non-volatile memory into the memory and stores the digital content in a plurality of storage devices.
  • the operating system includes various components and/or drivers for controlling and managing conventional system tasks such as memory management, storage device control, power management, and the like, as well as facilitating communication between various hardware and software.
  • the operating system may be an Android system of Google Inc., an iOS system developed by Apple Corporation, a Windows operating system developed by Microsoft Corporation, or an embedded operating system such as Vxworks.
  • the application includes any application installed on the portable electronic device, including but not limited to browsers, email, instant messaging services, word processing, keyboard virtualization, widgets (Widget), encryption, digital rights management, speech recognition, voice copying, positioning (such as those provided by GPS), music playback, and more.
  • browsers email, instant messaging services, word processing, keyboard virtualization, widgets (Widget), encryption, digital rights management, speech recognition, voice copying, positioning (such as those provided by GPS), music playback, and more.
  • the portable electronic device structure illustrated in FIG. 14 does not constitute an electronic definition, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements.
  • the portable electronic device 300 may further include a touch screen, a power source, a radio frequency (English name: Radio Frequency, abbreviation: RF) circuit, a wireless fidelity (English name: wireless fidelity, abbreviation: Wi-Fi) module, an audio circuit. And components such as sensors will not be described here.
  • the processor 32 is specifically configured to perform the following operations:
  • the camera is zoomed according to the zoom parameter.
  • determining the contour of the body of the preview image and the center point of the body according to the preview image in the preview frame on the screen including: acquiring a feature parameter of the preview image; The feature parameter is matched with the feature parameter of the at least one preset template that is stored in advance, and if the feature parameter of the preview image matches the feature parameter of the first preset template in the at least one preset template, the determination is performed.
  • the shape included in the first preset template is the body of the preview image, and the first preset template is one of the at least one preset template; determining the location according to the feature parameter of the preview image.
  • the outline of the body and the center point of the body is the outline of the body and the center point of the body.
  • determining, according to the preview image in the preview frame on the screen, the contour of the body of the preview image and the center point of the body including:
  • the shape of the first sub-image block of the first preset template is a body of the preview image, wherein the first preset template is one of the at least one preset template.
  • the first sub-image block is one sub-image block of at least one sub-image block of the first preset template.
  • the processor 32 is further configured to display a center point of the body and the preview frame in the preview image.
  • the center point and display prompt information for prompting the user to move the center point of the body to the center point of the preview frame.
  • the processor 32 is further configured to: detect a sharpness of the preview image, take a photo of the preview image after the resolution of the preview image meets a preset threshold; and detect whether the captured photo occurs Perspective distortion; if the captured photo is distorted, the captured photo is fluoroscopy corrected and the corrected photo is saved.
  • the processor 32 is further configured to: detect whether the preview image changes; if the preview image does not change, maintain the zoom parameter of the camera The same is true; if the preview image changes, the zoom parameter of the camera is restored to an initial value.
  • the shape of the at least one preset template includes: a circle, a rectangle, a triangle, a regular polygon, or an irregular polygon.
  • Embodiment 7 of the present invention provides a non-transitory computer readable medium storing one or more programs, the one or more programs including instructions that are executed when included by a camera and a portable electronic device including a plurality of applications
  • the operation of S101 to S103 of the method in the first embodiment is performed by the portable electronic device; or the operation of all or part of S201 to S208 in the method in the second embodiment; or the third embodiment All or part of the operations in S301 to S311 in the method.
  • the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed.
  • the foregoing steps include the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Human Computer Interaction (AREA)
  • Studio Devices (AREA)

Abstract

本发明实施例提供一种自动变焦的方法和装置,包括:根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点,当所述主体的中心点与所述预览框的中心点重合时,根据所述主体的轮廓大小和所述预览框的大小确定变焦参数,所述变焦参数包括摄像头的待调整焦距和所述预览图像的缩放倍数中的至少一个;根据所述变焦参数对所述摄像头进行变焦。采用上述方法能够帮助用户快速的将预览图像的主体调整到合适的大小。

Description

一种自动变焦的方法和装置 技术领域
本发明实施例涉及图像处理技术,尤其涉及一种自动变焦的方法和装置。
背景技术
随着手机的摄像头功能的提升,越来越多的用户选择使用手机的摄像头拍摄图片,在拍照过程中,如何能快速准确的定位到所需的物体,是影响用户体验的主要因素。
镜头变焦技术是指通过改变镜头的焦距等方式,改变镜头内的目标景物在被拍摄的图像中的大小。变焦方式分为:光学变焦(optical zoom)和数子变焦(digital zoom)。光学变焦是通过镜头、物体和焦点三方的位置发生变化而产生的。数字变焦是通过便携式电子设备内的处理器,把图片内的每个象素面积增大,从而达到放大目的。便携式电子设备可以是具有摄像头的移动终端或数码相机等。光学变焦一般应用在传统的可变焦相机中,用户通过手动旋转镜头筒身上的变焦环,手动改变焦距。数字变焦主要应用在移动终端或普通数码相机中,用户通过机身上的操作旋钮或在屏幕上滑动手指来改变焦距。
现有的镜头变焦方法都需要用户手动参与变焦,用户可能需要多次调整才能调整到合适的焦距,操作不方便。
发明内容
本发明实施例提供一种自动变焦的方法和装置,能够自动变焦,帮助用户快速的将预览图像的主体调整到合适的大小。
第一方面,提供一种自动变焦的方法,包括:
根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点;
当所述主体的中心点与所述预览框的中心点重合时,根据所述主体的轮廓大小和所述预览框的大小确定变焦参数,所述变焦参数包括摄像头的 待调整焦距和所述预览图像的缩放倍数中的至少一个;
根据所述变焦参数对所述摄像头进行变焦。
结合第一方面,在第一方面的第一种可能的实现方式中,所述根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点,包括:
获取所述预览图像的特征参数;
将所述预览图像的特征参数分别与预先存储的至少一个预设模板的特征参数进行匹配,若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的特征参数匹配成功,则确定所述第一预设模板中包括的形状为所述预览图像的主体,所述第一预设模板为所述至少一个预设模板中的一个预设模板;
根据所述预览图像的特征参数确定所述主体的轮廓和所述主体的中心点。
结合第一方面,在第一方面的第二种可能的实现方式中,所述根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点,包括:
将所述预览图像的特征参数分别与预先存储的至少一个预设模板中的每个预设模板的至少一个子图像块的特征参数进行匹配;
若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的至少一个子图像块中的第一子图像块的特征参数匹配成功,则确定所述第一预设模板的所述第一子图像块中包括的形状为所述预览图像的主体,其中,所述第一预设模板为所述至少一个预设模板中的一个预设模板,所述第一子图像块为所述第一预设模板的至少一个子图像块中的一个子图像块。
结合第一方面、第一方面的第一种以及第二种可能的实现方式中的任意一种,在第一方面的第三种可能的实现方式中,所述根据所述主体的轮廓大小和所述预览框的大小确定变焦参数之前,所述方法还包括:
在所述预览图像中显示所述主体的中心点和所述预览框的中心点,并显示提示信息,所述提示信息用于提示用户将所述主体的中心点移动至所述预览框的中心点。
结合第一方面、第一方面的第一种至第三种可能的实现方式中的任意一种,在第一方面的第四种可能的实现方式中,所述方法还包括:
检测所述预览图像的清晰度,当所述预览图像的清晰度满足预设阈值后对所述预览图像进行拍照;
检测拍摄到的照片是否发生透视失真;
若拍摄到的照片发生透视失真,则对拍摄到的照片进行透视校正,保存校正后的照片。
结合第一方面的第四种可能的实现方式,在第一方面的第五种可能的实现方式中,在对所述预览图像拍照之后,所述方法还包括:
检测所述预览图像是否发生变化;
若所述预览图像没有发生变化,则保持所述摄像头的所述变焦参数不变;
若所述预览图像发生了变化,则将所述摄像头的所述变焦参数还原为初始值。
结合第一方面的第一种或第二种可能的实现方式,在第一方面的第六种可能的实现方式中,所述至少一个预设模板的形状包括:圆形、矩形、三角形、规则多边形或不规则多边形。
第二方面,提供一种便携式电子设备,包括:
处理模块,用于根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点;
确定模块,用于当所述主体的中心点与所述预览框的中心点重合时,根据所述主体的轮廓大小和所述预览框的大小确定变焦参数,所述变焦参数包括摄像头的待调整焦距和所述预览图像的缩放倍数中的至少一个;
变焦模块,用于根据所述变焦参数对所述摄像头进行变焦。
结合第二方面,在第二方面的第一种可能的实现方式中,所述处理模块具体用于:
获取所述预览图像的特征参数;
将所述预览图像的特征参数分别与预先存储的至少一个预设模板的特征参数进行匹配,若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的特征参数匹配成功,则确定所述第一预设模板中包括 的形状为所述预览图像的主体,所述第一预设模板为所述至少一个预设模板中的一个预设模板;
根据所述预览图像的特征参数确定所述主体的轮廓和所述主体的中心点。
结合第二方面,在第二方面的第二种可能的实现方式中,所述处理模块具体用于:
获取所述预览图像的特征参数;
将所述预览图像的特征参数分别与预先存储的至少一个预设模板中的每个预设模板的至少一个子图像块的特征参数进行匹配;
若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的至少一个子图像块中的第一子图像块的特征参数匹配成功,则确定所述第一预设模板的所述第一子图像块中包括的形状为所述预览图像的主体,其中,所述第一预设模板为所述至少一个预设模板中的一个预设模板,所述第一子图像块为所述第一预设模板的至少一个子图像块的任一子图像块。
结合第二方面、第二方面的第一种以及第二种可能的实现方式中的任意一种,在第二方面的第三种可能的实现方式中,所述便携式电子设备还包括显示模块,
所述显示模块用于在所述预览图像中显示所述主体的中心点和所述预览框的中心点,并显示提示信息,所述提示信息用于提示用户将所述主体的中心点移动至所述预览框的中心点。
结合第二方面、第二方面的第一种至第三种可能的实现方式中的任意一种,在第二方面的第四种可能的实现方式中,所述便携式电子设备还包括:
检测模块,用于检测所述预览图像的清晰度;
拍摄模块,用于当所述预览图像的清晰度满足预设阈值后对所述预览图像进行拍照;
所述检测模块,还用于检测拍摄到的照片是否发生透视失真;
校正模块,用于若拍摄到的照片发生透视失真,则对拍摄到的照片进行透视校正,保存校正后的照片。
结合第二方面的第四种可能的实现方式,在第二方面的第五种可能的实现方式中,在所述拍摄模块对所述预览图像拍照之后,所述检测模块还用于:检测所述预览图像是否发生变化;
所述变焦模块还用于:若所述预览图像没有发生变化,则保持所述摄像头所述变焦参数不变;
若所述预览图像发生了变化,则将所述摄像头的所述变焦参数还原为初始值。
结合第二方面的第一种或第二种可能的实现方式,在第二方面的第六种可能的实现方式中,所述至少一个预设模板的形状包括:圆形、矩形、三角形、规则多边形或不规则多边形。
第三方面,提供一种便携式电子设备,包括:摄像头、处理器、存储器和系统总线,所述存储器和所述摄像头通过所述系统总线与所述处理器连接;
所述存储器,用于存储计算机执行指令;
所述处理器,用于运行所述计算机执行指令,执行如第一方面、第一方面的第一种至第六种可能的实现方式中的任一所述的方法。
第四方面,提供一种存储一个或多个程序的非瞬时计算机可读介质,所述一个或多个程序包括指令,所述指令当被包括摄像头和包括多个应用程序的便携式电子设备执行时使所述便携式电子设备执行如第一方面、第一方面的第一种至第六种可能的实现方式中的任一所述的方法。
本发明实施例提供的自动变焦的方法和装置,根据屏幕上预览框内的预览图像,确定预览图像的主体的轮廓以及主体的中心点,当主体的中心点与预览框的中心点重合时,根据主体的轮廓大小和预览框的大小确定变焦参数,变焦参数包括摄像头的待调整焦距和预览图像的缩放倍数中的至少一个,然后,根据变焦参数对摄像头进行变焦。所述方法由便携式电子设备根据预览图像中主体的轮廓大小和预览框的大小确定变焦参数,自动根据变焦参数进行变焦,帮助用户快速的将预览图像的主体调整到合适的大小。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例一提供的自动变焦的方法的流程图;
图2为预览图像的主要形状的示意图;
图3为主体的中心点和预览框的中心点的示意图;
图4为将主体的中心点移动到预览框的中心点之后的示意图;
图5为变焦前镜像成像的示意图;
图6为变焦后镜像成像的示意图;
图7为本发明实施例数字变焦的示意图;
图8为数字变焦后的预览图像的示意图;
图9为本发明实施例二提供的自动变焦的方法的流程图;
图10为形状透视校正前后的对比示意图;
图11为本发明实施例三提供的自动变焦的方法的流程图;
图12为本发明实施例四提供的一种便携式电子设备的结构示意图;
图13为本发明实施例四提供的另一种便携式电子设备的结构示意图;
图14为本发明实施例五提供的便携式电子设备的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明实施例提供的自动变焦的方法可应用于具有摄像头的便携式电子设备上,该便携式电子设备可以是任何电子设备,包括但不限于智能手机、平板电脑、个人数字助理(英文全称:Personal Digital Assistant,缩写:PDA)、媒体播放器、智能电视、照相机或摄像机等。
图1为本发明实施例一提供的自动变焦的方法的流程图,S101至S103的执行主体为上述便携式电子设备,具体可以通过上述便携式电子设备中具有处理功能的模块或芯片来实现,例如:中央处理器(英文全称:central process unit,缩写:CPU)等。如图1所示,本实施例提供的方法可以包括以下步骤:
S101、根据屏幕上预览框内的预览图像,确定预览图像中的主体的轮廓以及该主体的中心点。
用户打开便携式电子设备,便携式电子设备的摄像头准备就绪后,便携式电子设备的屏幕上的预览框内显示出预览图像,该预览框的大小可以等于或者小于便携式电子设备的屏幕,本发明实施例并不对此进行限制。
在预览框内出现预览图像时,便携式电子设备确定预览图像的主体,以及主体的轮廓和中心点。具体可以通过如下方式:首先,便携式电子设备获取预览图像的特征参数,然后,将预览图像的特征参数分别与预先存储的至少一个预设模板的特征参数进行匹配,若预览图像的特征参数与至少一个预设模板中的第一预设模板的特征参数匹配成功,则确定第一预设模板中包括的形状为预览图像的主体,第一预设模板为至少一个预设模板中的一个预设模板。
其中,预览图像的特征参数和预设模板的特征参数包括以下任意一个参数或其组合:颜色特征、形状特征和纹理特征。便携式电子设备具体可通过水平垂直投影、边缘检测结果、形状分析或颜色分析中的至少一种方法获取预览图像的特征参数。预设模板预先存储在便携式电子设备中,预设模板的形状具体可以为:圆形、矩形、三角形、规则多边形或不规则多边形等。
本实施例中,主体的中心点为主体的外切矩形的中心点,主体的中心点可以通过一个合适大小的圆圈或者矩形框表示。
本实施例中,在将预览图像的特征参数分别与预先存储的至少一个预设模板的特征参数进行匹配时,一种实现方式中,将预览图像的特征参数整体与至少一个预设模板的特征参数进行匹配。另一种实现方式中,可以先将预览图像按照预设的划分方式划分为至少一个子图像块,然后,将每个子图像块的特征参数分别与至少一个预设模板的特征参数进行匹配,若 某个子图像块的特征参数与第一预设模板的特征参数匹配成功,则确定第一预设模板中包括的形状为预览图像的主体,这里第一预设模板可以为至少一个预设模板中的任意一个预设模板。例如,图2为预览图像的主要形状的示意图,如图2所示,图中共有两个主要形状,在将预览图像的特征参数与至少一个预设模板的特征进行匹配时,只有主要形状1匹配到了预设模板,主要形状2没有匹配到预设模板,因此,主要形状1为预览图像的主体。本实施例中,并不对预览图像的划分方式进行限制,在对预览图像进行划分时,多个子图像块之间可以重合。
本实施例中,预览图像中的主要形状可以为完整形状或者局部形状,主要形状为局部形状通常可以是由于距离主体对应的目标物体太近,预览框内无法显示完整的形状,或者,主要形状偏离预览框的中心点。由于预设模板通常为完整形状,当预览图像的主要形状为局部形状时,直接将局部形状的特征参数与预设模板的特征参数进行匹配,会导致匹配失败。为了使得局部性形状也能匹配成功,本实施例中,在匹配过程中可以将多个预设模板中的每个预设模板划分为至少一个子图像块,将预览图像的特征参数分别与每个预设模板的至少一个子图像块的特征参数进行匹配,若预览图像特征参数与至少一个预设模板中的第一预设模板的至少一个子图像块中的第一子图像块的特征参数匹配成功,则确定第一预设模板的第一子图像块中包括的形状为预览图像的主体,该第一子图像块为第一预设模板的至少一个子图像块的任意一个子图像块。本实施例中,并不对预设模板的划分方式进行限制,预设模板的划分方式可以和预览图像的划分方式相同,也可以和预览图像的划分方式不相同。
需要说明的是,本实施例中也可以将预览图像和预设模板分别划分为多个子图像块,然后,将预览图像的所有子图像块的特征参数分别与预设模板的所有子图像块的特征参数进行匹配。另外,本实施例中,预览图像中也可能包括多个主体。
S102、当主体的中心点与预览框的中心点重合时,根据主体的轮廓大小和预览框的大小确定变焦参数,变焦参数包括摄像头的待调整焦距和预览图像的缩放倍数中的至少一个。
可选的,在根据主体的轮廓大小和预览框的大小确定变焦参数之前, 便携式电子设备还可以在预览图像中显示主体的中心点和预览框的中心点,并显示提示信息,该提示信息用于提示用户将主体的中心点移动至预览框的中心点。
图3为主体的中心点和预览框的中心点的示意图,如图3所示,图3中较大的虚线矩形标识出的形状为主体的轮廓11,虚线圆圈表示主体的中心点12,较小的虚线矩形表示预览框的中心点13。本实施例中,预览框的中心点可以为预览框的正中心的位置,或者为预览框的黄金分割点,或者为预览框的九宫格的力量点。
本实施例中,便携式电子设备还会显示提示信息,提示用户将主体的中心点移动至与预览框的中心点重合的位置。该提示信息具体可以为文字,例如,通过在预览图像上显示文字“请将主体的中心点移动至与预览框的中心点重合的位置”,或者,该提示信息为声音,将上述显示的文字以声音的方式播放给用户,或者,该提示信息为符号,例如,在预览图像上用箭头的方式指示用户将主体的中心点移动到与预览框的中心点重合,该箭头的起始位置为主体的中心点,箭头的终点为预览框的中心点,或者,该提示信息可以为上述三种方式的组合,本实施例并不对提示信息的具体实现方式进行限定。
本实施例中,若预览图像中只有一个主体,那么用户可以直接将该主体的中心点通过拖动的方式移动到与预览框的中心点重合的位置。若预览图像中有多个主体,那么用户可以根据自己的需求从多个主体中选择一个主体,例如,用户可以通过单次或多次点击某一主体选中要移动的主体。或者,便携式电子设备可以自动从多个主体中选择一个要移动的主体,例如,便携式电子设备检测多个主题体的轮廓,根据多个主体的轮廓大小,从多个主体中选择轮廓最大的主体作为要移动的主体,在比较主体的轮廓大小时,可以通过比较主体的轮廓的外切矩形的面积,主体的外切矩形的面积越大,则认为主体的轮廓也越大。在确定要移动的主体之后,用户将要移动的主体的中心点拖动至与预览框的中心点重合的位置,或者,便携式电子设备自动将要移动的主体的中心点移动至与预览框的中心点重合的位置。
如图4所示,图4为将主体的中心点移动到预览框的中心点之后的示 意图,要实现图4所示的状态,需要将主体的中心点12从图3所示位置移动到图4所示的位置,图中主体的中心点12小于预览框的中心点13的大小,在具体移动过程中,只要主体的中心点12全部或部分与预览框的中心点13重合就可以认为主体的中心点12与预览框的中心点13重合。
当主体的中心点与预览框中心点重合之后,根据主体的轮廓大小和预览框的大小确定摄像头的待调整焦距和/或预览图像的缩放倍数。其中,摄像头的待调整焦距为光学变焦参数,预览图像的缩放倍数为数字变焦参数,若便携式电子设备只支持光学变焦,那么根据主体的轮廓大小和预览框的大小确定摄像头的待调整焦距。若便携式电子设备只支持数字变焦,那么根据主体的轮廓大小和预览框的大小确定预览图像的缩放倍数。若便携式电子设备即支持光学变焦又支持数字变焦,那么先根据主体的轮廓大小和预览框的大小确定摄像头的待调整焦距,若待调整焦距达不到要求,则进一步确定预览图像的缩放倍数,结合光学变焦和数字变焦对摄像头进行变焦。
摄像头的待调整焦距可通过如下方式计算:首先,根据主体的轮廓大小确定主体变焦前的像长l’,根据预览框的大小确定主体变焦后的像长l″。然后,根据透镜成像公式计算摄像头的物距:
Figure PCTCN2015075235-appb-000001
其中,l表示物长,u表示物距,v表示像距。本实施例中,摄像头的焦距f和主体的像距v是已知的,将焦距f和像距v带入透镜成像公式可以得到物距u=fv(v-f)。其次,根据主体变焦前的像长l’、物距u和像距v确定主体对应的目标物体的物长l,
Figure PCTCN2015075235-appb-000002
图5为变焦前镜像成像的示意图,图6为变焦后镜像成像的示意图,请参照图5和图6,其中,O为坐标系的中心点,F1表示一倍焦距的位置,F2表示2倍焦距的位置,AB表示主体对应的目标物体的物长,A″B″表示主体变焦后的像长。在变焦前后摄像头没有移动或有微小移动,因此,可以认为摄像头变焦前后物距u没有变化。设
Figure PCTCN2015075235-appb-000003
为∠AOB:
Figure PCTCN2015075235-appb-000004
变焦前后目标物体的物长l和
Figure PCTCN2015075235-appb-000005
也不变,变焦后的像距为v″,
Figure PCTCN2015075235-appb-000006
由△ CF”O与△A”B”F”相似,可得:f″=lv″(l+l″),f″为摄像头的待调整焦距。
可选地,上述待调整焦距的计算过程中,物距还可以通过红外传感器、超声传感器或激光传感器测量得到。
图5和图6所示例子中将摄像头的焦距调大了,当然,焦距也可能变小。
数字变焦即对预览图像进行缩放,具体可通过如下方式计算:首先,确定主体的实际横向最大长度a和实际纵向最大长度b,具体可以先确定主体的外切矩形,外切矩形的长即为主体的实际横向最大长度a,外切矩形的宽即为主体的实际纵向最大长度b。然后,根据预览框的大小确定主体的待调整的横向最大长度a'和待调整的纵向最大长度b',待调整的横向最大长度a'小于等于该预览框的横向长度,待调整的纵向最大长度b'小于等于该预览框的纵向长度。最后,计算横向长度的比值c:c=a'/a,以及纵向长度的比值d:d=b'/b,比较横向长度的比值与纵向长度的比值,若c≤d,则预览图像的缩放倍数为c,若c>d,则预览图像的缩放倍数为d。当缩放倍数小于1时,说明将预览图像缩小了,当缩放倍数等于1时,说明不需要调整预览图像,当缩放倍数大于1时,说明将预览图像放大了。
图7为本发明实施例数字变焦的示意图,如图7所示,O点表示预览图像的主体的中心点,主体的中心点也是预览框的中心点,即主体的中心点与预览框的中心点重合,图中较小的矩形表示主体,主体的实际横向最大长度为OA,主体的实际纵向最大长度为OG,本实施例中假设需要将主体的边缘放大到紧贴预览框的边缘,则待调整的横向最大长度为OB,OB为主体的中心点到预览框的纵向边界的距离,待调整的纵向最大长度为OH,OB为主体的中心点到预览框的横向边界的距离,那么c=OB/OA=1.9,d=OH/OG=1.5,则预览图像的缩放倍数为1.5。放大后的预览图像如图8所示,图8为数字变焦后的预览图像的示意图。
S103、根据变焦参数对摄像头进行变焦。
通过光学变焦和/或数字变焦,将预览图像的主体的调整到合适的大小。
本实施例中,根据屏幕上预览框内的预览图像,确定预览图像的主体的轮廓以及主体的中心点,当主体的中心点与预览框的中心点重合时,根 据主体的轮廓大小和预览框的大小确定变焦参数,变焦参数包括摄像头的待调整焦距和预览图像的缩放倍数中的至少一个,然后,根据变焦参数对摄像头进行变焦。所述方法由便携式电子设备根据预览图像中主体的轮廓大小和预览框的大小确定变焦参数,自动根据变焦参数进行变焦,帮助用户快速的将主体调整到合适的大小。
图9为本发明实施例二提供的自动变焦的方法的流程图,S201至S208的执行主体为上述便携式电子设备,具体可以通过上述便携式电子设备中具有处理功能的模块或芯片来实现,例如:中央处理器(英文全称:central process unit,缩写:CPU)等如图9所示,本实施例提供的方法可以包括以下步骤:
S201、启动便携式电子设备的拍照功能,在预览框内显示预览图像。
S202、根据预览图像确定预览图像的主体的轮廓以及主体的中心点。
S203、在预览图像上,显示主体的中心点和预览框的中心点,并显示提示信息。
S204、当主体的中心点与预览框的中心点重合时,根据主体的轮廓大小和预览框的大小确定变焦参数。
该变焦参数包括摄像头的待调整焦距和预览图像的缩放倍数中的至少一个。
S205、根据变焦参数对摄像头进行变焦。
步骤S201至S205的具体实现方式请参照实施例一的相关描述,这里不再赘述。
S206、检测预览图像的清晰度,当预览图像的清晰度满足预设阈值后对预览图像进行拍照。
在将预览图像的主体调整到合适的大小之后,便携式电子设备检测预览图像的清晰度,当预览图像满足清晰度要求后自动对预览图像进行拍照。
S207、检测拍摄到的照片是否发生透视失真。
S208、若拍摄到的照片发生透视失真,则对拍摄到的照片进行透视校正,保存校正后的照片。
透视校正也称为透视控制是对照片进行合成或者编辑,以得到符合大 众对于透视失真理解的结果的过程。透视校正是对图像的平面几何变换,比较常用的方法有,透视变换方法和控制点变换方法。透视变换方法主要依据摄像机的成像原理,实现图像校正;而控制点变换方法则适应一般的图像校正,主要原理是依据控制点的对应关系,用双线性插值方法实现图像的校正。双线性空间变换的一般表达式是:u=Ax+By+Cxy+D,v=Ex+Fy+Gxy+H,其中,A、B、C、D、E、F、G、H是从xy空间变换到uv空间的8个参数,只要知道4对变换前后的点(任意3点不共线),就可求解出变换参数,矩形内部的点则可根据插值算法求出。
校正过程包括:通过透视校正可以使所有现实中的竖直线在图像中都显示为竖直方向,这些竖直线包括立柱、墙面的竖直边、灯柱等,这是人们普遍接受的对于透视结果的理解,这样的透视结果的依据就是越远的物体在图像中就越小,如图10所示,图10为形状透视校正前后的对比示意图。由于竖直方向距离的存在,建筑物顶端要比基座离地面观察者的距离要远,但是,通常建立透视过程只考虑水平方向的距离,而不考虑竖直方向的距离,即认为建筑物顶端与基座的距离是一样远的,如方形房间中,四条水平边这样的所有平行线交于一点。
在上述实施例一和实施例二的基础上,本实施例的场景为用户在第一阶段的拍照完成之后,继续进行拍照过程中摄像头的变焦方法,图11为本发明实施例三提供的自动变焦的方法的流程图,S301至S311执行主体为上述便携式电子设备,如图11所示,本实施例提供的方法可以包括以下步骤:
S301、检测预览框内的预览图像是否发生变化。
在上次拍照之后,摄像头保持打开状态,若便携式电子设备移动了或者目标物体移动了,都可能导致预览图像发生变化,本实施例中,便携式电子设备会检测预览框内的预览图像是否发生变化,若预览图像发生了变化,则执行步骤S302,若预览图像没有发生变化,则执行步骤S303。需要说明的是,本实施例中预览图像没有发生变化,并不是指上一拍摄阶段预览框内的预览图像与本拍摄阶段预览框内的预览图像完全相同,而是两个摄阶段预览框内的拍摄场景没有变化,两个摄阶段预览框内的预览图像没有发生大的变化,只是做了微小的移动。
S302、将摄像头的变焦参数还原为初始值。
若预览图像发生了变化,则执行S302,预览图像发生了变化说明拍摄的场景发生了变化,此时将摄像头的变焦参数还原为初始值,重新进行下一拍摄阶段的参数调整。
S303、保持摄像头的变焦参数不变。
若预览图像没有变化,则执行S303,预览图像没有变化,说明预览图像的主体也没有发生变化,不需要针对该主体再次确定变焦参数,因此,保持变焦参数不变。
S304、根据预览框内的预览图像,确定预览图像的主体的轮廓以及主体的中心点。
步骤S302执行完之后,执行步骤S304。
S305、检测到预览图像的主体内部的形状发生了变化,则将待调整焦距和/或预览图像的缩放倍数稍微缩小一点。
本步骤的目的是为了防止由于便携式电子设备微小的移动,使预览图像的主体移出预览框外,若在上一拍摄阶段将预览图像的主体放大到了预览框的边缘,那么预览图像的主体很容易被移出预览框外,本实施例中,通过将待调整焦距和/或预览图像的缩放倍数稍微缩小一点可以缩小预览图像的主体,此时即使便携式电子设备有微小的移动,预览图像的主体也不会移出预览框外。
步骤S303执行完之后,执行步骤S305。
S306、显示预览图像的主体的中心点和预览框的中心点,并显示提示信息。
S307、响应用户输入的移动预览图像的主体的中心点的操作。
S308、当预览图像的主体的中心点与预览框的中心点重合时,根据预览图像的主体的轮廓大小和预览框的大小确定变焦参数。
步骤S304至S308的具体实现方式可参照实施例一的相关描述,这里不再赘述。
S309、检测预览图像的清晰度,当预览图像的清晰度满足预设阈值后对预览图像进行拍照。
S310、检测拍摄到的照片是否发生透视失真。
S311、若拍摄到的照片发生透视失真,则对拍摄到的照片进行透视校 正,保存校正后的照片。
步骤S309至S311的具体实现方式可参照实施例二的相关描述,这里不再赘述。
图12为本发明实施例四提供的一种便携式电子设备的结构示意图,如图12所示,本实施例提供的便携式电子设备包括:处理模块21、确定模块22和变焦模块23。
处理模块21,用于根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点;
确定模块22,用于当所述主体的中心点与所述预览框的中心点重合时,根据所述主体的轮廓大小和所述预览框的大小确定变焦参数,所述变焦参数包括摄像头的待调整焦距和所述预览图像的缩放倍数中的至少一个;
变焦模块23,用于根据所述变焦参数对所述摄像头进行变焦。
可选的,所述处理模块21具体用于:获取所述预览图像的特征参数;将所述预览图像的特征参数分别与预先存储的至少一个预设模板的特征参数进行匹配,若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的特征参数匹配成功,则确定所述第一预设模板中包括的形状为所述预览图像的主体,所述第一预设模板为所述至少一个预设模板中的一个预设模板;根据所述预览图像的特征参数确定所述主体的轮廓和所述主体的中心点。
可选的,所述处理模块21具体用于:获取所述预览图像的特征参数;将所述预览图像的特征参数分别与所述至少一个预设模板中的每个预设模板的至少一个子图像块的特征参数进行匹配;若所述预览图像的特征参数与所述第一预设模板的至少一个子图像块中的第一子图像块的特征参数匹配成功,则确定所述第一预设模板的所述第一子图像块中包括的形状为所述预览图像的主体,其中,所述第一预设模板为所述至少一个预设模板中的一个预设模板,所述第一子图像块为所述第一预设模板的至少一个子图像块的一个子图像块。
可选的,所述至少一个预设模板的形状包括:圆形、矩形、三角形、规则多边形或不规则多边形。
图13为本发明实施例四提供的另一种便携式电子设备的结构示意图, 该便携式电子设备在图12所示便携式电子设备的基础上还包括:显示模块24、检测模块25、拍摄模块26和校正模块27。
所述显示模块24用于在所述预览图像中显示所述主体的中心点和所述预览框的中心点,并显示提示信息,所述提示信息用于提示用户将所述主体的中心点移动至所述预览框的中心点。
检测模块25,用于检测所述预览图像的清晰度;
拍摄模块26,用于当所述预览图像的清晰度满足预设阈值后对所述预览图像进行拍照;
所述检测模块25,还用于检测拍摄到的照片是否发生透视失真;
所述校正模块27,用于若拍摄到的照片发生透视失真,则对拍摄到的照片进行透视校正,保存校正后的照片。
可选的,在所述拍摄模块25对所述预览图像拍照之后,所述检测模块25还用于:检测所述预览图像是否发生变化;相应的,所述变焦模块23还用于:若所述预览图像没有发生变化,则保持所述摄像头的所述变焦参数不变;若所述预览图像发生了变化,则将所述摄像头的所述变焦参数还原为初始值。
本实施例四提供的便携式电子设备,可用于执行实施例一至实施例三的方法,具体实现方式和技术效果类型,这类不再赘述。
图14为本发明实施例五提供的便携式电子设备的结构示意图,本实施例五提供的便携式电子设备300可以用于实施本发明实施例一至实施例三的方法,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明方法实施例一至实施例三的描述。如图14所示,本实施例提供的便携式电子设备包括:摄像头31、处理器32、存储器33和系统总线34。所述存储器33和所述摄像头31通过所述系统总线34与所述处理器32连接。
其中,摄像头31用于采集预览图像,将采集到的预览图像传输给处理器32。
处理器32为便携式电子设备的控制中心,利用各种接口和线路连接整个便携式电子设备的各个部分,通过运行或执行存储在存储器33内的软件程序和/或模块,以及调用存储在存储器33内的数据,以执行便携式 电子设备的各种功能和/或处理数据。处理器32可以由集成电路(英文全称:Integrated Circuit,简称:IC)组成,例如可以由单颗封装的IC所组成,也可以由连接多颗相同功能或不同功能的封装IC而组成。举例来说,处理器32可以仅包括中央处理器(英文全称:Central Processing Unit,简称:CPU),也可以是GPU、数字信号处理器(英文全称:Digital Signal Processor,简称:DSP)、及通信单元中的控制芯片(例如基带芯片)的组合。
存储器33可用于存储软件程序以及模块,处理器32通过运行存储在存储器33的软件程序以及模块,从而执行便携式电子设备的各种功能应用以及实现数据处理。存储器33主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序,比如声音播放程序、图像播放程序等等;数据存储区可存储根据便携式电子设备的使用所创建的数据(比如音频数据、电话本等)等。在本发明具体实施方式中,存储单元可以包括易失性存储器,例如非挥发性动态随机存取内存(英文全称:Nonvolatile Random Access Memory,简称:NVRAM)、相变化随机存取内存(英文全称:Phase Change RAM,简称:PRAM)、磁阻式随机存取内存(英文全称:Magnetoresistive RAM,简称:MRAM)等,还可以包括非易失性存储器,例如至少一个磁盘存储器件、电子可擦除可编程只读存储器(英文全称:Electrically Erasable Programmable Read-Only Memory,简称:EEPROM)、闪存器件,例如反或闪存(英文全称:NOR flash memory)或是反及闪存(英文全称:NAND flash memory)。非易失存储器储存处理器32所执行的操作系统及应用程序。所述处理器32从所述非易失存储器加载运行程序与数据到内存并将数字内容储存于大量储存装置中。所述操作系统包括用于控制和管理常规系统任务,例如内存管理、存储设备控制、电源管理等,以及有助于各种软硬件之间通信的各种组件和/或驱动器。在本发明实施方式中,所述操作系统可以是Google公司的Android系统、Apple公司开发的iOS系统或Microsoft公司开发的Windows操作系统等,或者是Vxworks这类的嵌入式操作系统。所述应用程序包括安装在便携式电子设备上的任何应用,包括但不限于浏览器、电子邮件、即时消息服务、文字处理、键盘虚拟、窗口小部件 (Widget)、加密、数字版权管理、语音识别、语音复制、定位(例如由全球定位系统提供的功能)、音乐播放等等。
本领域技术人员可以理解,图14中示出的便携式电子设备结构并不构成对电子的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。尽管未示出,便携式电子设备300还可以包括触摸屏、电源、射频(英文全称:Radio Frequency,简称:RF)电路、无线保真(英文全称:wireless fidelity,简称:Wi-Fi)模块、音频电路以及传感器等部件,在此不再赘述。
本实施例中,处理器32具体用于执行如下操作:
根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点;
当所述主体的中心点与所述预览框的中心点重合时,根据所述主体的轮廓大小和所述预览框的大小确定变焦参数,所述变焦参数包括摄像头的待调整焦距和所述预览图像的缩放倍数中的至少一个;
根据所述变焦参数对所述摄像头进行变焦。
可选的,所述根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点,包括:获取所述预览图像的特征参数;将所述预览图像的特征参数分别与预先存储的至少一个预设模板的特征参数进行匹配,若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的特征参数匹配成功,则确定所述第一预设模板中包括的形状为所述预览图像的主体,所述第一预设模板为所述至少一个预设模板中的一个预设模板;根据所述预览图像的特征参数确定所述主体的轮廓和所述主体的中心点。
可选的,所述根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点,包括:
获取所述预览图像的特征参数;
将所述预览图像的特征参数分别与预先存储的至少一个预设模板中的每个预设模板的至少一个子图像块的特征参数进行匹配;
若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的至少一个子图像块中的第一子图像块的特征参数匹配成功,则确定 所述第一预设模板的所述第一子图像块中包括的形状为所述预览图像的主体,其中,所述第一预设模板为所述至少一个预设模板中的一个预设模板,所述第一子图像块为所述第一预设模板的至少一个子图像块的一个子图像块。
可选地,所述处理器32根据所述主体的轮廓大小和所述预览框的大小确定变焦参数之前,还用于:在所述预览图像中显示所述主体的中心点和所述预览框的中心点,并显示提示信息,所述提示信息用于提示用户将所述主体的中心点移动至所述预览框的中心点。
可选的,所述处理器32还用于:检测所述预览图像的清晰度,当所述预览图像的清晰度满足预设阈值后对所述预览图像进行拍照;检测拍摄到的照片是否发生透视失真;若拍摄到的照片发生透视失真,则对拍摄到的照片进行透视校正,保存校正后的照片。
可选的,在对所述预览图像拍照之后,所述处理器32还用于:检测所述预览图像是否发生变化;若所述预览图像没有发生变化,则保持所述摄像头的所述变焦参数不变;若所述预览图像发生了变化,则将所述摄像头的所述变焦参数还原为初始值。
本实施例中,所述至少一个预设模板的形状包括:圆形、矩形、三角形、规则多边形或不规则多边形。
本发明实施例七提供一种存储一个或多个程序的非瞬时计算机可读介质,所述一个或多个程序包括指令,所述指令当被包括摄像头和包括多个应用程序的便携式电子设备执行时使所述便携式电子设备执行上述实施例一中的方法的S101至S103的操作;或者,上述实施例二中的方法中的S201至S208中全部或部分的操作;或者,上述实施例三中的方法中的S301至S311中全部或部分的操作。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对 其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (16)

  1. 一种自动变焦的方法,其特征在于,包括:
    根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点;
    当所述主体的中心点与所述预览框的中心点重合时,根据所述主体的轮廓大小和所述预览框的大小确定变焦参数,所述变焦参数包括摄像头的待调整焦距和所述预览图像的缩放倍数中的至少一个;
    根据所述变焦参数对所述摄像头进行变焦。
  2. 根据权利要求1所述的方法,其特征在于,所述根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点,包括:
    获取所述预览图像的特征参数;
    将所述预览图像的特征参数分别与预先存储的至少一个预设模板的特征参数进行匹配,若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的特征参数匹配成功,则确定所述第一预设模板中包括的形状为所述预览图像的主体,所述第一预设模板为所述至少一个预设模板中的一个预设模板;
    根据所述预览图像的特征参数确定所述主体的轮廓和所述主体的中心点。
  3. 根据权利要求1所述的方法,其特征在于,所述根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点,包括:
    获取所述预览图像的特征参数;
    将所述预览图像的特征参数分别与预先存储的至少一个预设模板中的每个预设模板的至少一个子图像块的特征参数进行匹配;
    若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的至少一个子图像块中的第一子图像块的特征参数匹配成功,则确定所述第一预设模板的所述第一子图像块中包括的形状为所述预览图像的主体,其中,所述第一预设模板为所述至少一个预设模板中的一个预设模板,所述第一子图像块为所述第一预设模板的至少一个子图像块中的一个 子图像块。
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述根据所述主体的轮廓大小和所述预览框的大小确定变焦参数之前,所述方法还包括:
    在所述预览图像中显示所述主体的中心点和所述预览框的中心点,并显示提示信息,所述提示信息用于提示用户将所述主体的中心点移动至所述预览框的中心点。
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述方法还包括:
    检测所述预览图像的清晰度,当所述预览图像的清晰度满足预设阈值后对所述预览图像进行拍照;
    检测拍摄到的照片是否发生透视失真;
    若拍摄到的照片发生透视失真,则对拍摄到的照片进行透视校正,保存校正后的照片。
  6. 根据权利要求5所述的方法,其特征在于,在对所述预览图像拍照之后,所述方法还包括:
    检测所述预览图像是否发生变化;
    若所述预览图像没有发生变化,则保持所述摄像头的所述变焦参数不变;
    若所述预览图像发生了变化,则将所述摄像头的所述变焦参数还原为初始值。
  7. 根据权利要求2或3所述的方法,其特征在于,所述至少一个预设模板的形状包括:圆形、矩形、三角形、规则多边形或不规则多边形。
  8. 一种便携式电子设备,其特征在于,包括:
    处理模块,用于根据屏幕上预览框内的预览图像,确定所述预览图像的主体的轮廓以及所述主体的中心点;
    确定模块,用于当所述主体的中心点与所述预览框的中心点重合时,根据所述主体的轮廓大小和所述预览框的大小确定变焦参数,所述变焦参数包括摄像头的待调整焦距和所述预览图像的缩放倍数中的至少一个;
    变焦模块,用于根据所述变焦参数对所述摄像头进行变焦。
  9. 根据权利要求8所述的便携式电子设备,其特征在于,所述处理模块具体用于:
    获取所述预览图像的特征参数;
    将所述预览图像的特征参数分别与预先存储的至少一个预设模板的特征参数进行匹配,若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的特征参数匹配成功,则确定所述第一预设模板中包括的形状为所述预览图像的主体,所述第一预设模板为所述至少一个预设模板中的一个预设模板;
    根据所述预览图像的特征参数确定所述主体的轮廓和所述主体的中心点。
  10. 根据权利要求8所述的便携式电子设备,其特征在于,所述处理模块具体用于:
    获取所述预览图像的特征参数;
    将所述预览图像的特征参数分别与预先存储的至少一个预设模板中的每个预设模板的至少一个子图像块的特征参数进行匹配;
    若所述预览图像的特征参数与所述至少一个预设模板中的第一预设模板的至少一个子图像块中的第一子图像块的特征参数匹配成功,则确定所述第一预设模板的所述第一子图像块中包括的形状为所述预览图像的主体,其中,所述第一预设模板为所述至少一个预设模板中的一个预设模板,所述第一子图像块为所述第一预设模板的至少一个子图像块中的一个子图像块。
  11. 根据权利要求8-10中任一项所述的便携式电子设备,其特征在于,所述便携式电子设备还包括:
    显示模块,用于在所述预览图像中显示所述主体的中心点和所述预览框的中心点,并显示提示信息,所述提示信息用于提示用户将所述主体的中心点移动至所述预览框的中心点。
  12. 根据权利要求8-11中任一项所述的便携式电子设备,其特征在于,所述便携式电子设备还包括:
    检测模块,用于检测所述预览图像的清晰度;
    拍摄模块,用于当所述预览图像的清晰度满足预设阈值后对所述预览 图像进行拍照;
    所述检测模块,还用于检测拍摄到的照片是否发生透视失真;
    校正模块,用于若拍摄到的照片发生透视失真,则对拍摄到的照片进行透视校正,保存校正后的照片。
  13. 根据权利要求12所述的便携式电子设备,其特征在于,在所述拍摄模块对所述预览图像拍照之后,所述检测模块还用于:检测所述预览图像是否发生变化;
    所述变焦模块还用于:若所述预览图像没有发生变化,则保持所述摄像头的所述变焦参数不变;
    若所述预览图像发生了变化,则将所述摄像头的所述变焦参数还原为初始值。
  14. 根据权利要求9或10所述的便携式电子设备,其特征在于,
    所述至少一个预设模板的形状包括:圆形、矩形、三角形、规则多边形或不规则多边形。
  15. 一种便携式电子设备,其特征在于,包括:摄像头、处理器、存储器和系统总线,所述存储器和所述摄像头通过所述系统总线与所述处理器连接;
    所述存储器,用于存储计算机执行指令;
    所述处理器,用于运行所述计算机执行指令,执行如权利要求1-7任一所述的方法。
  16. 一种存储一个或多个程序的非瞬时计算机可读介质,所述一个或多个程序包括指令,所述指令当被包括摄像头和包括多个应用程序的便携式电子设备执行时使所述便携式电子设备执行如权利要求1至7任一项所述的方法。
PCT/CN2015/075235 2015-03-27 2015-03-27 一种自动变焦的方法和装置 WO2016154806A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201580022563.3A CN106464799A (zh) 2015-03-27 2015-03-27 一种自动变焦的方法和装置
PCT/CN2015/075235 WO2016154806A1 (zh) 2015-03-27 2015-03-27 一种自动变焦的方法和装置
US15/561,361 US10317777B2 (en) 2015-03-27 2015-03-27 Automatic zooming method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/075235 WO2016154806A1 (zh) 2015-03-27 2015-03-27 一种自动变焦的方法和装置

Publications (1)

Publication Number Publication Date
WO2016154806A1 true WO2016154806A1 (zh) 2016-10-06

Family

ID=57003853

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/075235 WO2016154806A1 (zh) 2015-03-27 2015-03-27 一种自动变焦的方法和装置

Country Status (3)

Country Link
US (1) US10317777B2 (zh)
CN (1) CN106464799A (zh)
WO (1) WO2016154806A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111970437A (zh) * 2020-08-03 2020-11-20 广东小天才科技有限公司 文本拍摄方法、可穿戴设备和存储介质
CN114554081A (zh) * 2022-01-17 2022-05-27 读书郎教育科技有限公司 一种智能手表实现相机预览放大的方法及设备
CN116055607A (zh) * 2022-08-16 2023-05-02 荣耀终端有限公司 一种变焦顺滑性评估方法、装置及电子设备

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112235503A (zh) * 2019-07-15 2021-01-15 北京字节跳动网络技术有限公司 一种对焦测试方法、装置、计算机设备及存储介质
CN111654631B (zh) * 2020-06-19 2021-11-12 厦门紫光展锐科技有限公司 变焦控制方法、系统、设备及介质
CN114095644B (zh) * 2020-08-24 2023-08-04 武汉Tcl集团工业研究院有限公司 一种图像校正的方法和计算机设备
CN112333388B (zh) * 2020-10-30 2022-04-12 维沃移动通信(杭州)有限公司 图像显示方法、装置和电子设备
CN113438410B (zh) * 2021-05-19 2022-06-17 荣耀终端有限公司 一种高倍率拍摄方法及电子设备
CN113709368A (zh) * 2021-08-26 2021-11-26 维沃移动通信有限公司 图像显示方法、装置及设备
CN113852823B (zh) * 2021-11-30 2022-03-01 深圳市通恒伟创科技有限公司 一种基于物联网的图像数据上传方法、系统和装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101634796A (zh) * 2009-08-20 2010-01-27 上海合合信息科技发展有限公司 相机自动变焦方法及系统
WO2012132277A1 (ja) * 2011-03-28 2012-10-04 パナソニック株式会社 撮影装置およびライブビュー画像表示方法
CN103024274A (zh) * 2012-12-17 2013-04-03 东莞宇龙通信科技有限公司 一种相机主体间距检测拍照方法和系统
CN103019537A (zh) * 2012-11-19 2013-04-03 广东欧珀移动通信有限公司 一种图像预览方法及装置
CN103763471A (zh) * 2014-01-16 2014-04-30 宇龙计算机通信科技(深圳)有限公司 数码变焦方法及装置
CN104469128A (zh) * 2013-09-25 2015-03-25 纬创资通股份有限公司 电子装置及辅助拍摄方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101021604B (zh) 2007-03-23 2010-07-21 中国科学院光电技术研究所 一种基于图像处理的动态目标自动变焦系统
US9137444B2 (en) * 2011-09-26 2015-09-15 Sony Corporation Image photography apparatus for clipping an image region

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101634796A (zh) * 2009-08-20 2010-01-27 上海合合信息科技发展有限公司 相机自动变焦方法及系统
WO2012132277A1 (ja) * 2011-03-28 2012-10-04 パナソニック株式会社 撮影装置およびライブビュー画像表示方法
CN103019537A (zh) * 2012-11-19 2013-04-03 广东欧珀移动通信有限公司 一种图像预览方法及装置
CN103024274A (zh) * 2012-12-17 2013-04-03 东莞宇龙通信科技有限公司 一种相机主体间距检测拍照方法和系统
CN104469128A (zh) * 2013-09-25 2015-03-25 纬创资通股份有限公司 电子装置及辅助拍摄方法
CN103763471A (zh) * 2014-01-16 2014-04-30 宇龙计算机通信科技(深圳)有限公司 数码变焦方法及装置

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111970437A (zh) * 2020-08-03 2020-11-20 广东小天才科技有限公司 文本拍摄方法、可穿戴设备和存储介质
CN111970437B (zh) * 2020-08-03 2022-08-09 广东小天才科技有限公司 文本拍摄方法、可穿戴设备和存储介质
CN114554081A (zh) * 2022-01-17 2022-05-27 读书郎教育科技有限公司 一种智能手表实现相机预览放大的方法及设备
CN116055607A (zh) * 2022-08-16 2023-05-02 荣耀终端有限公司 一种变焦顺滑性评估方法、装置及电子设备
CN116055607B (zh) * 2022-08-16 2023-09-01 荣耀终端有限公司 一种变焦顺滑性评估方法、装置及电子设备

Also Published As

Publication number Publication date
US20180081257A1 (en) 2018-03-22
US10317777B2 (en) 2019-06-11
CN106464799A (zh) 2017-02-22

Similar Documents

Publication Publication Date Title
WO2016154806A1 (zh) 一种自动变焦的方法和装置
US10353574B2 (en) Photographic apparatus, control method thereof, and non-transitory computer-readable recording medium
US9554030B2 (en) Mobile device image acquisition using objects of interest recognition
US9578248B2 (en) Method for generating thumbnail image and electronic device thereof
US10551833B2 (en) Method for image capturing using unmanned image capturing device and electronic device supporting the same
EP3326360B1 (en) Image capturing apparatus and method of operating the same
WO2016123893A1 (zh) 拍照的方法和装置以及终端
JP5746937B2 (ja) オブジェクト追跡装置
US11825040B2 (en) Image shooting method and device, terminal, and storage medium
WO2018058934A1 (zh) 拍摄方法、拍摄装置和存储介质
CN104917959A (zh) 一种拍照方法及终端
WO2019237747A1 (zh) 图像裁剪方法、装置、电子设备及计算机可读存储介质
WO2018184260A1 (zh) 文档图像的校正方法及装置
EP3163423A1 (en) Method and device for setting background of ui control and terminal
WO2016101524A1 (zh) 纠正被摄物体拍摄倾斜方法、装置及移动终端、存储介质
CN110874809A (zh) 图像处理方法及装置、电子设备和存储介质
WO2019090734A1 (zh) 拍摄方法及装置、移动终端及计算机可读存储介质
JP2017162371A (ja) 画像処理装置、画像処理方法及びプログラム
US8774556B2 (en) Perspective correction using a reflection
WO2015045679A1 (ja) 情報機器および制御プログラム
CN113056905B (zh) 用于拍摄类长焦图像的系统和方法
KR20160008407A (ko) 문자 인식 장치 및 방법
TW201640471A (zh) 可攜式視訊拍攝裝置及在其所聯結顯示螢幕上至少一視訊圖框之顯示方法
JP2015180091A (ja) デジタルカメラ
CN114286009A (zh) 倒影图像拍摄方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15886793

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 15561361

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15886793

Country of ref document: EP

Kind code of ref document: A1