CN114422687B - Preview image switching method and device, electronic equipment and storage medium - Google Patents

Preview image switching method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114422687B
CN114422687B CN202011176686.1A CN202011176686A CN114422687B CN 114422687 B CN114422687 B CN 114422687B CN 202011176686 A CN202011176686 A CN 202011176686A CN 114422687 B CN114422687 B CN 114422687B
Authority
CN
China
Prior art keywords
image
camera
preview image
determining
switching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011176686.1A
Other languages
Chinese (zh)
Other versions
CN114422687A (en
Inventor
姚海强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
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 Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN202011176686.1A priority Critical patent/CN114422687B/en
Publication of CN114422687A publication Critical patent/CN114422687A/en
Application granted granted Critical
Publication of CN114422687B publication Critical patent/CN114422687B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/64Computer-aided capture of images, e.g. transfer from script file into camera, check of taken image quality, advice or proposal for image composition or decision on when to take image
    • 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/66Remote control of cameras or camera parts, e.g. by remote control devices
    • H04N23/663Remote control of cameras or camera parts, e.g. by remote control devices for controlling interchangeable camera parts based on electronic image sensor signals
    • 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/268Signal distribution or switching

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Studio Devices (AREA)

Abstract

The disclosure relates to a preview image switching method and device, electronic equipment and storage medium. The method is applied to the electronic equipment and comprises the following steps: collecting a first image through a first camera, and displaying an initial preview image generated based on the first image; under the condition that the object distance between the first camera and the shot object is smaller than the preset distance, switching the currently used camera from the first camera to the second camera; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera; collecting a second image through a second camera, and determining a target area consistent with the image content presented by the initial preview image from the second image; and determining the image content belonging to the target area in the second image as a current preview image, and switching the displayed initial preview image into the current preview image.

Description

Preview image switching method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of image processing, and in particular, to a preview image switching method and apparatus, an electronic device, and a storage medium.
Background
With the continuous development of imaging technology, more and more users are added into the line of photography and video shooting, and even the hot trend of the national photography is created.
In order to collect images with good visual effects in different shooting scenes, a plurality of cameras are often assembled on current electronic devices such as mobile phones and tablets.
In the related art, when a subject is close to an electronic device, it is necessary to switch a camera having a larger focal length to a camera having a smaller focal length to obtain a clear image. However, in this switching process, since the focal length is drastically reduced and the size of the image sensor used with the camera is increased, there is a high possibility that only the middle area of the obtained image is clear and the edge area is blurred.
Disclosure of Invention
The disclosure provides a preview image switching method and device, electronic equipment and storage medium, which can avoid the problem of edge blurring of a finally obtained preview image in the process of switching from a camera with a larger focal length to a camera with a smaller focal length.
According to a first aspect of the present disclosure, there is provided a preview image switching method, applied to an electronic device, including:
Collecting a first image through a first camera, and displaying an initial preview image generated based on the first image;
under the condition that the object distance between the first camera and the shot object is smaller than the preset distance, switching the currently used camera from the first camera to the second camera; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera;
collecting a second image through a second camera, and determining a target area consistent with the image content presented by the initial preview image from the second image;
and determining the image content belonging to the target area in the second image as a current preview image, and switching the displayed initial preview image into the current preview image.
According to a second aspect of the present disclosure, there is provided a preview image switching apparatus, applied to an electronic device, including:
the generating unit is used for acquiring a first image through the first camera and displaying an initial preview image generated based on the first image;
the first switching unit is used for switching the currently used camera from the first camera to the second camera under the condition that the object distance between the first camera and the shot object is smaller than the preset distance; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera;
The determining unit is used for acquiring a second image through the second camera and determining a target area consistent with the image content presented by the initial preview image from the second image;
and the second switching unit is used for determining the image content belonging to the target area in the second image as a current preview image and switching the displayed initial preview image into the current preview image.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the method of the first aspect by executing the executable instructions.
According to a fourth aspect of the present disclosure there is provided a computer readable storage medium having stored thereon computer instructions which when executed by a processor perform the steps of the method according to the first aspect.
In the technical scheme of the disclosure, under the condition that a camera with a larger focal length is adopted to collect images, an initial preview image is displayed based on the images collected by the camera. And when the object distance between the camera and the shot object is smaller than the preset distance, switching the currently used camera into a camera with smaller focal length. After the camera is switched, the acquired image is not directly used as a preview image, but a target area consistent with the image content presented by the initial preview image is determined from the image acquired after the camera is switched, and the image content in the target area is determined as the current preview image.
It should be understood that, when the camera with a larger focal length is switched to the camera with a smaller focal length, the field angle becomes larger, the image content in the captured image increases, and the increased image content is typically displayed around the captured image because the relative position between the subject and the electronic device is unchanged. Accordingly, the present disclosure determines only the determined target area as the current preview image, which corresponds to clipping the surrounding screen (or the edge area of the image). Therefore, compared with the related art, the method and the device can not display the edge area of the picture acquired after the camera is switched, so that the problem of blurring of the edge of the displayed preview image after the camera with the larger focal length is switched to the camera with the smaller focal length is avoided.
In addition, in the above process, the target area in the second image is determined by taking the initial preview image before the camera is switched as a standard. Therefore, the current preview image is consistent with the display picture of the initial preview image, and jump of the preview picture in the camera switching process is avoided.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow chart of a preview image switching method shown in an exemplary embodiment of the present disclosure;
FIG. 2 is a flow chart of another preview image switching method shown in an exemplary embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a distribution of detection areas on an image sensor according to an exemplary embodiment of the present disclosure;
FIG. 4 is a schematic diagram of the relative position between a second image and a target area according to an exemplary embodiment of the present disclosure;
fig. 5 is a block diagram of a preview image switching apparatus shown in an exemplary embodiment of the present disclosure;
FIG. 6 is a block diagram of another preview image switching device shown in an exemplary embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an electronic device in an exemplary embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in this disclosure to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present disclosure. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
In order to collect images with good visual effects in different shooting scenes, a plurality of cameras are often assembled on current electronic devices such as mobile phones and tablets. For example, in a smart phone, it may include: main camera, wide-angle camera, super wide-angle camera, micro-distance camera, etc.
In the related art, when a subject is close to an electronic device, it is necessary to switch a camera having a larger focal length to a camera having a smaller focal length to obtain a clear image. When the switched camera (for example, a macro camera, an ultra-wide angle camera, or the like with a small focal length) is used for capturing a close-up, the switched capturing mode is also referred to as a close-up mode.
However, in this switching process, since the focal length becomes small, there is a high possibility that only the middle area of the obtained image is clear, and the edge area is blurred. It should be emphasized that in practical applications, the larger the focal length of the camera, the smaller the size of the image sensor used in combination. In other words, in switching from a camera with a larger focal length to a camera with a smaller focal length, the size of the image sensor for capturing an image becomes large. Therefore, the above-described problem of blurring of the edge region is also referred to as a problem of blurring of the image edge caused by an increase in the image sensor.
In order to solve the above problems, the disclosure provides a preview image switching method to solve the above technical problem of blurred edges of the preview image after the camera is switched.
Fig. 1 is a flowchart illustrating a preview image switching method according to an exemplary embodiment of the present disclosure. The method is applied to the electronic device, as shown in fig. 1, and can comprise the following steps:
step 102, a first image is acquired by a first camera, and an initial preview image generated based on the first image is displayed.
The electronic device in the present disclosure may be any type of electronic device, for example, the electronic device may be a mobile terminal such as a smart phone, a tablet computer, or a fixed terminal such as a smart television, a PC (personal computer ), or the like. It should be understood that only a plurality of cameras need to be equipped, and electronic devices with inconsistent focal lengths of the plurality of cameras can be used as the electronic devices in the present disclosure, and which type of electronic device is specifically applied to may be determined by those skilled in the art according to actual needs, which is not limited in the present disclosure.
In the related art, an application program with a shooting function is installed in an electronic device to control a plurality of assembled cameras, so as to achieve the purpose of shooting. This type of application is commonly referred to as a camera application. In practical applications, after a user opens a camera application in an electronic device, the camera automatically displays an image acquired by a camera, and the image is called a preview image, so that the user can adjust shooting parameters according to the preview image.
Similarly, in the present disclosure, in the case where a camera application in the electronic device is started, an image may be acquired by a first camera currently adopted, and then an initial preview image may be generated based on the acquired first image, so that a user previews the acquired image. It should be appreciated that the first camera in the present disclosure may be any type of camera, for example, the first camera may be any one of a main camera, a wide-angle camera, an ultra-wide-angle camera, etc. of an electronic device.
Step 104, switching the currently used camera from the first camera to the second camera under the condition that the object distance between the first camera and the shot object is smaller than the preset distance; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera.
In the present disclosure, a preset distance may be preset to determine whether the currently used first camera is unable to clearly capture the subject. In actual operation, the distance between the shot object and the first camera, namely the object distance, can be preferentially detected, and then the object distance is compared with the preset distance, so that the currently used camera is switched to the second camera with smaller focal length under the condition that the distance between the first camera and the shot object is smaller than the preset distance.
In the present disclosure, a conventional two-way ranging technique or one-way ranging technique may be used, or a ToF (Time of flight) ranging method may be used to measure a distance between a subject and a first camera. It should be noted that any manner of measuring the distance between the subject and the first camera may be used in the present disclosure, which is not limited by the present disclosure.
As described above, since the focal length of the first camera is greater than that of the second camera, the size of the image sensor used with the first camera is generally smaller than that of the image sensor used with the second camera. This is also one of the reasons for the image blurring phenomenon at the edge of the preview image in the related art.
And 106, acquiring a second image through a second camera, and determining a target area consistent with the image content presented by the initial preview image from the second image.
In the related art, an image acquired after switching the camera is directly used as a preview image. It will be appreciated that the above-mentioned switching of the camera changes the focal length of the camera for capturing the image and the size of the image sensor, which further causes an edge blurring phenomenon of the captured image, and if the captured image is directly used as the preview image, the edge blurring phenomenon is necessarily caused in the preview image. Meanwhile, due to the changes of the focal length of the camera and the size of the sensor, the angle of view of the obtained image is changed, so that an obvious image jump phenomenon is necessarily generated in the process of switching the original preview image to the current preview image. From the user's perspective, the edges of the preview image are not only blurred, but the content contained in the preview image also instantaneously increases.
In the present disclosure, the image acquired after the camera is switched is not directly used as the preview image as in the related art, but the acquired image is subjected to a certain preprocessing. Specifically, the image content presented in the initial preview image displayed before the camera is switched can be preferentially determined, and after the second image is acquired through the second camera, a target area consistent with the image content presented in the initial preview image is determined from the acquired second image. On the basis, the image content belonging to the target area in the second image can be determined as the current preview image.
It should be appreciated that, since the present disclosure determines the current preview image from the second image based on the image content of the initial preview image after the second image is obtained, the image content of the two images are consistent, which obviously does not occur the jump phenomenon of the preview image in the related art. In addition, the above-mentioned switching operation of the camera is performed in a case where the electronic device determines that the distance between the subject and the first camera is smaller than the preset distance, in other words, the switching operation is automatically performed by the electronic device. Obviously, the relative position of the second camera and the first camera is not changed at the switching moment. Therefore, under the condition that the angle of the field of view is enlarged due to camera switching, the collected image content presented by the second image comprises the image content of the first image, and the image content of the first image is positioned in a position which tends to be in the center in the second image. In other words, the determined target area is located at a position in the second image that tends to be centered, which corresponds to that the image content of the second image that is more than the first image is located around (or in other words, in the edge area of) the second image. It can be seen that determining the target area as the current preview image is equivalent to clipping the edge area in the second image and then taking the rest as the current preview image, namely clipping the blurred area in the related art and then displaying the clipped image.
In the present disclosure, the target region may be determined from the second image in a variety of ways.
In an embodiment, a plurality of references may be determined from the image content presented in the initial preview image, and a target area consistent with the image content presented in the initial preview image may be determined from the second image based on the determined plurality of references. For example, after the plurality of references are determined, a relative positional relationship between the plurality of references may be further determined to determine the target area from the second image based on the determined plurality of references and the relative positional relationship.
In another embodiment, the center point and the angle of view of the initial preview image may be preferentially determined, and then the target point corresponding to the center point is determined in the second image, so that the target area is determined from the second image based on the determined target point and angle of view. It will be appreciated that the angle of view determines how much content is contained in the image. Therefore, on the basis of determining the center point of the first image, the corresponding target point is determined in the second image, and the region consistent with the content of the image presented by the initial preview image, namely the target region, can be determined from the second image based on the view angle.
In practical use, an edge blurring phenomenon occurs, meaning that the image content in the center portion of the image remains clear, which occurs only when the subject is a planar object perpendicular to the optical axis of the camera. If the object is not a plane object perpendicular to the optical axis of the camera, it is assumed that the center of the image is the focusing point, the image content near the center and the center point are not on the same plane, and obviously, the blurring phenomenon occurs in the non-edge area, and the area on the same plane with the center point may exist in the edge area, but is clear. It can be seen that in the present disclosure, it is also necessary to determine whether the subject is a planar subject perpendicular to the optical axis of the first camera. Wherein the operation of switching the currently used camera from the first camera to the second camera is performed only in the case where it is determined that the subject is a planar subject perpendicular to the optical axis of the first camera; otherwise, the switching operation is not performed.
In an ideal case, when the distances between the subject and the respective detection areas on the image sensor are equal, the subject can be regarded as a planar subject perpendicular to the optical axis of the camera (for convenience of description, "planar subject perpendicular to the optical axis of the camera" will be hereinafter simply referred to as "planar subject"). However, in practical situations, there is an unavoidable error, and it is difficult to make perfect equality, for which purpose the present disclosure presets an object distance difference for judging whether the subject is a planar subject. It should be understood that, since the actual area of the image sensor is small, the difference between the image sensor and the subject is generally large, if the actual distance between the image sensor and the subject is directly detected, it can only be determined whether the area of the subject, which is as large as the area of the image sensor, is a plane, and it cannot be truly determined that the image contents contained in the acquired images are all in the same plane. In this disclosure, a phase focusing method is adopted to determine an equivalent distance between image content acquired by each detection area of the image sensor and a corresponding real object, and by comparing the equivalent distances, it is determined whether the object is a planar object.
In actual operation, at least two detection areas can be preferentially determined in the image sensor corresponding to the first camera, and phase focusing is performed by taking the determined at least two detection areas as references, so as to obtain focusing data of each detection area; on the basis, the equivalent distances corresponding to the detection areas respectively can be calculated according to the obtained focusing data, and the object distance difference between any two of the at least two equivalent distances is further determined; if the object distance difference between any two of the above objects is smaller than the preset object distance difference, the shot object can be determined to be a plane object; otherwise, it is determined that the subject is not a planar subject.
It should be noted that the equivalent distance is not the distance between the camera and the object in the conventional sense, but the equivalent distance between the image content collected in a certain detection area on the image sensor and the real object. In other words, the equivalent object distance is a virtual distance calculated to be dedicated to determining whether or not the subject is a planar object, and is not an actual distance. It can be understood that: after the image sensor is simulated and enlarged to an area as large as the shot object, the distances between the detected areas and the corresponding positions in the shot object are measured.
To further improve the accuracy of judging whether or not a subject is a planar subject. The determining at least two detection regions may include: the image sensor comprises a first area and at least one pair of detection areas, wherein the first area is positioned at the center of an image sensor of the first camera, and the at least one pair of detection areas are symmetrically arranged with the first area as a reference. For example, in a square image sensor, it is possible to include 4 equal-sized detection areas at four corners in addition to the first area at the center of the square. Of course, this example is merely illustrative, and the arrangement of the detection area may be determined by one skilled in the art according to actual needs, which is not limited by the present disclosure.
And step 108, determining the image content belonging to the target area in the second image as a current preview image, and switching the displayed initial preview image into the current preview image.
In the present disclosure, after determining the target area from the second image, the image content belonging to the target area in the second image may be determined as the current preview image, and the displayed initial preview image may be switched to the current preview image.
In the switching process, the current preview image is consistent with the image content of the initial preview image, so that the phenomenon that the preview image picture in the related art jumps does not occur. Meanwhile, when the object distance between the shot object and the camera is smaller than the preset distance, the first camera with larger focal length is switched to the second camera with smaller focal length, so that the definition of the picture can be obviously improved. Therefore, the method and the device can improve the definition of the preview image while avoiding the jump of the preview image.
In the related art, when the distance between the subject and the camera is below a certain threshold, the camera application is switched to the macro mode. In the switching process, the camera application needs to be restarted, and the electronic device needs to be equipped with the corresponding macro camera in advance, so that when the camera mode is switched to the macro mode, the currently used camera is switched to the macro camera. The process is complex, and the preview image also jumps due to the camera focal length change.
In one aspect of the disclosure, the first camera may be a wide angle camera, and the second camera may be an ultra wide angle camera. In this case, when the object distance between the subject and the first camera is smaller than the preset distance, the wide-angle camera may be switched to the ultra-wide-angle camera. The above-described operation of determining the target object, and switching between preview images are included in this process. It should be understood that, because the image is cut, the advantage of large field angle of the traditional ultra-wide angle camera is eliminated, and meanwhile, the advantage of smaller focal length of the ultra-wide angle camera is utilized, so that the close-range shooting is realized. In short, the technical scheme of the disclosure can realize micro-distance photography by using the ultra-wide angle camera, and avoids the limitation that the micro-distance photography can be carried out only by switching the camera mode in the related technology and the limitation that the micro-distance camera must be assembled.
Of course, in the case where it is determined that the subject is not a planar subject perpendicular to the optical axis of the first camera, macro photography cannot be achieved by the above-described ultra-wide angle camera. In this case, the present disclosure may also switch the shooting mode of the electronic device to the macro mode as in the related art, so as to perform image acquisition by the macro camera. Specifically, the camera application may be restarted to switch to the macro mode, and the currently used camera is switched to the macro camera.
According to the technical scheme, when the object distance between the camera and the shot object is smaller than the preset distance, the camera with the larger focal length is used for switching the camera with the smaller focal length. After the camera is switched, the acquired image is not directly used as a preview image, but a target area consistent with the image content presented by the initial preview image is determined from the image acquired after the camera is switched, and the image content in the target area is determined as the current preview image.
It should be understood that, when the camera with a larger focal length is switched to the camera with a smaller focal length, the field angle becomes larger, the image content in the captured image increases, and the increased image content is typically displayed around the captured image because the relative position between the subject and the electronic device is unchanged. Accordingly, the present disclosure determines only the determined target area as the current preview image, which corresponds to cropping the surrounding screen (or edge area). Therefore, compared with the related art, the method and the device can not display the edge area of the picture acquired after the camera is switched, so that the problem of blurring of the edge of the preview image under the condition that the camera with a larger focal length is switched to the camera with a smaller focal length is avoided.
In addition, in the above process, the target area in the second image is determined by taking the initial preview image before the camera is switched as a standard. Therefore, the current preview image is consistent with the display picture of the initial preview image, and jump of the preview picture in the camera switching process is avoided.
It is stated that, the detection of whether the object distance is smaller than the preset distance or not and the operation of switching the camera are all automatically executed by the electronic device. From the user's perspective, only the preview screen in the electronic device becomes clear. In the process, the problems of frame jump and edge blurring do not exist, and the shooting experience of a user is improved.
In the following, a smart phone equipped with a plurality of cameras is taken as an example to describe the technical scheme of the present disclosure.
Fig. 2 is another preview image switching method according to an exemplary embodiment of the present disclosure, which is applied to a smart phone equipped with a plurality of cameras, as shown in fig. 2, and may include the steps of:
step 201, a first image is acquired by a wide angle camera.
The smart phone may include: a plurality of cameras such as main camera, wide angle camera, super wide angle camera. The present embodiment is described taking the example of switching from the wide-angle camera to the ultra-wide-angle camera.
The smart phone can be used with a wide-angle camera in a plurality of scenes. For example, when a user needs to photograph indoor furnishings, in order to make the photographed image contain more objects, the photographing may be performed by a wide-angle camera.
Step 202, displaying an initial preview image based on the acquired first image.
With the above example in mind, during a user's shooting of an indoor display using a wide angle camera, the user may suddenly want to shoot a display somewhere, and then approach the display. At this time, an image can still be acquired by the wide-angle camera and the image sensor used in combination with the wide-angle camera, and the acquired image is used as the first image in the step. Further, an initial preview image can be displayed in a screen of the smart phone based on the first image.
Step 203, judging whether the distance between the shot object and the wide-angle camera is smaller than a preset distance; if yes, go to step 204; otherwise, jump to step 211.
In this embodiment, a preset distance may be set according to the focal lengths of the wide-angle camera and the ultra-wide-angle camera, where the preset distance is smaller than the object distance calculated according to the focal length of the wide-angle camera and the imaging formula, and the specific value of the preset distance may be determined by those skilled in the art according to actual requirements.
By adopting the above example, in the process that the user approaches the display, the object distance between the detected object and the wide-angle camera can be detected by the ToF ranging method, and when the detected object distance is smaller than the preset distance, whether the detected object is a plane object can be further detected.
It should be noted that the planar object in this embodiment is not an absolute plane. It should be appreciated that, for any object, the difference in distance between the various parts of the object and the camera is small when approaching to a certain extent, it is also possible to determine the object as a planar object.
Step 204, judging whether the shot object is a plane object; if yes, go to step 205, otherwise, go to step 211.
In this embodiment, 5 detection areas may be preferentially determined on the image sensor corresponding to the wide-angle camera, and equivalent distances between the 5 detection areas and the corresponding real objects may be determined respectively. And judging whether the shot object is a plane object or not based on the distance difference between any two of the determined 5 equivalent distances and the preset distance difference.
For example, the detection area on the image sensor may be as shown in fig. 3. Assuming that the shape of the image sensor is a square with a side length of 1, a square detection area with a side length of 0.3 may be taken at the center of the image sensor, and a square detection area with a side length of 0.2 may be taken at four corners of the image sensor. And may be labeled as detection region a and detection regions B1-B4 as shown in fig. 3. On this basis, it is assumed that the equivalent distance corresponding to the detection area a is measured as X1, and the equivalent distances corresponding to the detection areas B1 to B4 are measured as X2 to X5. In this step, the object distance differences between any two of them can be calculated respectively, that is, X1-X2, X1-X3, X1-X4, X1-X5, X2-X3, X2-X4, X2-X5, X3-X4, X3-X5, and X4-X5 can be calculated respectively, and after these object distance differences are obtained, these object distance differences can be compared with preset object distance differences respectively, and when these object distance differences are all smaller than the preset object distance differences, it can be determined that the object to be photographed is a planar object.
Step 205, switching the wide-angle camera to the ultra-wide-angle camera.
Step 206, acquiring a second image by the wide-angle camera.
In step 207, a plurality of references are determined from the initial preview image.
And step 208, determining a target area consistent with the image content presented by the initial preview image from the second image according to the plurality of references.
After the wide-angle camera is switched to the ultra-wide-angle camera, the focal length of the camera is reduced, the matched image sensor is enlarged, and accordingly, the field angle of the acquired second image is enlarged, and the image content is increased. If the second image is directly used as the preview image, the phenomena of blurring of the edge area and jumping of the preview image are likely to occur.
For this reason, the present embodiment preferentially determines a plurality of references from the initial preview image, determines a target area that coincides with the image content presented in the initial preview image from the second image using the plurality of references as a standard, and uses the image content contained in the target area as the current preview image.
In this process, the relationship between the second image and the target area may be as shown in fig. 4, where the target area includes image content consistent with the image content presented by the initial preview image.
As is clear from fig. 4, the edge area (shadow area) in the second image will not be presented as the current preview image, and it is obvious that blurring of the edge area of the image in the related art can be avoided.
In step 209, the image content included in the determined target area is determined as the current preview image.
Step 210, the initial preview image is switched to the current preview image.
Step 211, no operation of camera switching is performed.
In this embodiment, if the distance between the camera and the object is not smaller than the preset distance, or the object is not a planar object, the operation of camera switching is not performed. Of course, when the distance between the camera and the shot object is smaller than the preset distance, but the shot object is not a planar object, the smart phone can be switched to a macro mode so as to complete macro shooting of the non-planar object through the macro camera.
According to the technical scheme, the first camera in the disclosure can be a wide-angle camera, and the second camera can be a super-wide-angle camera. When the distance between the wide-angle camera and the shot object is detected to be smaller than the preset distance, the wide-angle camera can be switched to the ultra-wide-angle camera. It is to be appreciated that the present disclosure takes advantage of the smaller focal length of the ultra-wide angle camera, and achieves close-up shooting, which is equivalent to achieving macro shooting through the ultra-wide angle camera. Meanwhile, a target area is determined from the second image based on the initial preview image to serve as a current preview image, so that the phenomenon of blurring of an edge area is avoided, and the jumping situation of the preview image is prevented.
Fig. 5 is a block diagram of a preview image switching apparatus shown in an exemplary embodiment of the present disclosure. Referring to fig. 5, the apparatus includes a generating unit 501, a first switching unit 502, a determining unit 503, and a second switching unit 504.
A generating unit 501 configured to acquire a first image by a first camera and to display an initial preview image generated based on the first image;
a first switching unit 502 configured to switch a currently used camera from the first camera to the second camera in a case where it is determined that an object distance between the first camera and the subject is smaller than a preset distance; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera;
a determining unit 503 configured to acquire a second image by the second camera, and determine a target area consistent with the image content presented by the initial preview image from the second image;
and a second switching unit 504 configured to determine image contents belonging to the target area in a second image as a current preview image, and switch the presented initial preview image to the current preview image.
Optionally, the determining unit 503 is further configured to:
determining a plurality of references in the image content presented by the initial preview image;
and determining a target area consistent with the image content presented by the initial preview image from the second image according to the plurality of references.
Optionally, the determining unit 503 is further configured to:
determining a center point and a view angle of the initial preview image;
and determining a target point corresponding to the central point in the second image, and determining a target area consistent with the image content presented by the initial preview image from the second image based on the target point and the field angle.
As shown in fig. 6, fig. 6 is a block diagram of another preview image switching device according to an exemplary embodiment of the present disclosure, which further includes, on the basis of the foregoing embodiment shown in fig. 5: a judging unit 505, an executing unit 506, and a third switching unit 507.
Alternatively to this, the method may comprise,
a determination unit 505 configured to determine whether the subject is a planar subject perpendicular to an optical axis of the first camera;
an execution unit 506 configured to execute an operation of switching the currently used camera from the first camera to the second camera in a case where it is determined that the subject is a planar subject perpendicular to the optical axis of the first camera.
Optionally, the judging unit 505 is further configured to:
determining at least two detection areas in an image sensor of a first camera, and carrying out phase focusing by taking the at least two detection areas as references respectively to obtain focusing data of each detection area;
calculating equivalent distances corresponding to the detection areas respectively according to the obtained focusing data, and determining an object distance difference between any two of the at least two equivalent distances;
under the condition that the object distance difference between any two of the two is smaller than the preset object distance difference, determining that the shot object is a plane object perpendicular to the optical axis of the first camera; otherwise, the subject is not a planar subject perpendicular to the optical axis of the first camera.
Optionally, the at least two detection areas include:
the image sensor comprises a first area and at least one pair of detection areas, wherein the first area is positioned at the center of an image sensor of the first camera, and the at least one pair of detection areas are symmetrically arranged with the first area as a reference.
Alternatively to this, the method may comprise,
a third switching unit 507 configured to switch the photographing mode of the electronic apparatus to the macro mode to perform image acquisition by the macro camera in a case where it is determined that the subject is not a planar subject perpendicular to the optical axis of the first camera.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the objectives of the disclosed solution. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
Correspondingly, the disclosure further provides a preview image switching device, which comprises: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the preview image switching method according to any of the above embodiments, for example, the method may include: collecting a first image through a first camera, and displaying an initial preview image generated based on the first image; under the condition that the object distance between the first camera and the shot object is smaller than the preset distance, switching the currently used camera from the first camera to the second camera; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera; collecting a second image through a second camera, and determining a target area consistent with the image content presented by the initial preview image from the second image; and determining the image content belonging to the target area in the second image as a current preview image, and switching the displayed initial preview image into the current preview image.
Accordingly, the present disclosure also provides an electronic device including a memory, and one or more programs, where the one or more programs are stored in the memory, and configured to be executed by the one or more processors, where the one or more programs include instructions for implementing the preview image switching method according to any of the foregoing embodiments, for example, the method may include: collecting a first image through a first camera, and displaying an initial preview image generated based on the first image;
under the condition that the object distance between the first camera and the shot object is smaller than the preset distance, switching the currently used camera from the first camera to the second camera; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera; collecting a second image through a second camera, and determining a target area consistent with the image content presented by the initial preview image from the second image; and determining the image content belonging to the target area in the second image as a current preview image, and switching the displayed initial preview image into the current preview image.
Fig. 7 is a block diagram illustrating an apparatus 700 for implementing preview image switching in accordance with an exemplary embodiment. For example, apparatus 700 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 7, an apparatus 700 may include one or more of the following components: a processing component 702, a memory 704, a power component 706, a multimedia component 708, an audio component 710, an input/output (I/O) interface 712, a sensor component 714, and a communication component 716.
The processing component 702 generally controls overall operation of the apparatus 700, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 702 can include one or more modules that facilitate interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate interaction between the multimedia component 708 and the processing component 702.
The memory 704 is configured to store various types of data to support operations at the apparatus 700. Examples of such data include instructions for any application or method operating on the apparatus 700, contact data, phonebook data, messages, pictures, videos, and the like. The memory 704 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 706 provides power to the various components of the device 700. The power components 706 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the device 700.
The multimedia component 708 includes a screen between the device 700 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front-facing camera and/or a rear-facing camera. The front-facing camera and/or the rear-facing camera may receive external multimedia data when the apparatus 700 is in an operational mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 710 is configured to output and/or input audio signals. For example, the audio component 710 includes a Microphone (MIC) configured to receive external audio signals when the device 700 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 704 or transmitted via the communication component 716. In some embodiments, the audio component 710 further includes a speaker for outputting audio signals.
The I/O interface 712 provides an interface between the processing component 702 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 714 includes one or more sensors for providing status assessment of various aspects of the apparatus 700. For example, the sensor assembly 714 may detect an on/off state of the device 700, a relative positioning of the components, such as a display and keypad of the device 700, a change in position of the device 700 or a component of the device 700, the presence or absence of user contact with the device 700, an orientation or acceleration/deceleration of the device 700, and a change in temperature of the device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 716 is configured to facilitate communication between the apparatus 700 and other devices in a wired or wireless manner. The apparatus 700 may access a wireless network based on a communication standard, such as WiFi,2G or 3G,4G LTE, 7G NR (New Radio), or a combination thereof. In one exemplary embodiment, the communication component 716 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 704, including instructions executable by processor 720 of apparatus 700 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
The foregoing description of the preferred embodiments of the present disclosure is not intended to limit the disclosure, but rather to cover all modifications, equivalents, improvements and alternatives falling within the spirit and principles of the present disclosure.

Claims (8)

1. A preview image switching method, applied to an electronic device, comprising:
collecting a first image through a first camera, and displaying an initial preview image generated based on the first image;
Under the condition that the object distance between the first camera and the shot object is smaller than the preset distance, switching the currently used camera from the first camera to the second camera; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera;
collecting a second image through a second camera, and determining a target area consistent with the image content presented by the initial preview image from the second image;
determining the image content belonging to the target area in the second image as a current preview image, and switching the displayed initial preview image into the current preview image;
wherein the determining, from the second image, a target area consistent with the image content presented by the initial preview image includes: determining a plurality of references in the image content presented by the initial preview image; determining a target area consistent with the image content presented by the initial preview image from a second image according to the multiple references; or,
the determining the target area consistent with the image content presented by the initial preview image from the second image comprises the following steps: determining a center point and a view angle of the initial preview image; and determining a target point corresponding to the central point in the second image, and determining a target area consistent with the image content presented by the initial preview image from the second image based on the target point and the field angle.
2. The method as recited in claim 1, further comprising:
judging whether the shot object is a plane object perpendicular to the optical axis of the first camera;
in a case where it is determined that the subject is a planar subject perpendicular to the optical axis of the first camera, an operation of switching the currently used camera from the first camera to the second camera is performed.
3. The method according to claim 2, wherein the determining whether the subject is a planar subject perpendicular to an optical axis of the first camera includes:
determining at least two detection areas in an image sensor of a first camera, and carrying out phase focusing by taking the at least two detection areas as references respectively to obtain focusing data of each detection area;
calculating equivalent distances corresponding to the detection areas respectively according to the obtained focusing data, and determining an object distance difference between any two of the at least two equivalent distances;
under the condition that the object distance difference between any two of the two is smaller than the preset object distance difference, determining that the shot object is a plane object perpendicular to the optical axis of the first camera; otherwise, the subject is not a planar subject perpendicular to the optical axis of the first camera.
4. A method according to claim 3, wherein the at least two detection areas comprise:
the image sensor comprises a first area and at least one pair of detection areas, wherein the first area is positioned at the center of an image sensor of the first camera, and the at least one pair of detection areas are symmetrically arranged with the first area as a reference.
5. A method according to claim 3, further comprising:
and under the condition that the shot object is not a plane object perpendicular to the optical axis of the first camera, switching the shooting mode of the electronic equipment to a macro mode so as to acquire images through the macro camera.
6. A preview image switching apparatus, applied to an electronic device, comprising:
the generating unit is used for acquiring a first image through the first camera and displaying an initial preview image generated based on the first image;
the first switching unit is used for switching the currently used camera from the first camera to the second camera under the condition that the object distance between the first camera and the shot object is smaller than the preset distance; the focal length of the first camera is larger than that of the second camera, and the size of the image sensor of the first camera is smaller than that of the image sensor of the second camera;
The determining unit is used for acquiring a second image through the second camera and determining a target area consistent with the image content presented by the initial preview image from the second image;
the second switching unit is used for determining the image content belonging to the target area in the second image as a current preview image and switching the displayed initial preview image into the current preview image;
wherein the determining, from the second image, a target area consistent with the image content presented by the initial preview image includes: determining a plurality of references in the image content presented by the initial preview image; determining a target area consistent with the image content presented by the initial preview image from a second image according to the multiple references; or,
the determining the target area consistent with the image content presented by the initial preview image from the second image comprises the following steps: determining a center point and a view angle of the initial preview image; and determining a target point corresponding to the central point in the second image, and determining a target area consistent with the image content presented by the initial preview image from the second image based on the target point and the field angle.
7. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the method of any of claims 1-5 by executing the executable instructions.
8. A computer readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the method according to any of claims 1-5.
CN202011176686.1A 2020-10-28 2020-10-28 Preview image switching method and device, electronic equipment and storage medium Active CN114422687B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011176686.1A CN114422687B (en) 2020-10-28 2020-10-28 Preview image switching method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011176686.1A CN114422687B (en) 2020-10-28 2020-10-28 Preview image switching method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114422687A CN114422687A (en) 2022-04-29
CN114422687B true CN114422687B (en) 2024-01-19

Family

ID=81260639

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011176686.1A Active CN114422687B (en) 2020-10-28 2020-10-28 Preview image switching method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114422687B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117939289A (en) * 2022-10-24 2024-04-26 荣耀终端有限公司 Method for switching cameras and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107277371A (en) * 2017-07-27 2017-10-20 青岛海信移动通信技术股份有限公司 A kind of method and device in mobile terminal amplification picture region
CN110505389A (en) * 2019-09-03 2019-11-26 RealMe重庆移动通信有限公司 Camera control method, device, storage medium and electronic equipment
CN110602409A (en) * 2019-10-23 2019-12-20 Oppo广东移动通信有限公司 Photographing method and device, electronic equipment and storage medium
CN110691193A (en) * 2019-09-03 2020-01-14 RealMe重庆移动通信有限公司 Camera switching method and device, storage medium and electronic equipment
CN111541845A (en) * 2020-04-30 2020-08-14 维沃移动通信(杭州)有限公司 Image processing method and device and electronic equipment
CN111654629A (en) * 2020-06-11 2020-09-11 展讯通信(上海)有限公司 Camera switching method and device, electronic equipment and readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107277371A (en) * 2017-07-27 2017-10-20 青岛海信移动通信技术股份有限公司 A kind of method and device in mobile terminal amplification picture region
CN110505389A (en) * 2019-09-03 2019-11-26 RealMe重庆移动通信有限公司 Camera control method, device, storage medium and electronic equipment
CN110691193A (en) * 2019-09-03 2020-01-14 RealMe重庆移动通信有限公司 Camera switching method and device, storage medium and electronic equipment
CN110602409A (en) * 2019-10-23 2019-12-20 Oppo广东移动通信有限公司 Photographing method and device, electronic equipment and storage medium
CN111541845A (en) * 2020-04-30 2020-08-14 维沃移动通信(杭州)有限公司 Image processing method and device and electronic equipment
CN111654629A (en) * 2020-06-11 2020-09-11 展讯通信(上海)有限公司 Camera switching method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN114422687A (en) 2022-04-29

Similar Documents

Publication Publication Date Title
CN108419016B (en) Shooting method and device and terminal
CN110493526B (en) Image processing method, device, equipment and medium based on multiple camera modules
CN110557547B (en) Lens position adjusting method and device
CN108040204B (en) Image shooting method and device based on multiple cameras and storage medium
CN113364965A (en) Shooting method and device based on multiple cameras and electronic equipment
CN115134505B (en) Preview picture generation method and device, electronic equipment and storage medium
CN110876014B (en) Image processing method and device, electronic device and storage medium
CN114422687B (en) Preview image switching method and device, electronic equipment and storage medium
CN112188096A (en) Photographing method and device, terminal and storage medium
CN111586280B (en) Shooting method, shooting device, terminal and readable storage medium
CN114666490B (en) Focusing method, focusing device, electronic equipment and storage medium
CN113099113B (en) Electronic terminal, photographing method and device and storage medium
US11252341B2 (en) Method and device for shooting image, and storage medium
CN112866555B (en) Shooting method, shooting device, shooting equipment and storage medium
CN113315903B (en) Image acquisition method and device, electronic equipment and storage medium
CN110874829B (en) Image processing method and device, electronic device and storage medium
CN107707819B (en) Image shooting method, device and storage medium
CN115134517A (en) Shooting control method and device and storage medium
CN112346606A (en) Picture processing method and device and storage medium
CN109862252B (en) Image shooting method and device
CN114268731B (en) Camera switching method, camera switching device and storage medium
US11838655B2 (en) Image acquiring method and apparatus, electronic device, and storage medium
CN109447929B (en) Image synthesis method and device
CN114339017B (en) Distant view focusing method, device and storage medium
WO2023225910A1 (en) Video display method and apparatus, terminal device, and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant