Shooting method and device, electronic equipment and storage medium

By partially enlarging the preview image of the electronic device and matching the focus area position information in the high-magnification shooting mode, calculating the jitter coefficient and performing image compensation, the picture drift problem caused by jitter is solved, and image clarity and user experience are improved.

CN120021270APending Publication Date: 2025-05-20BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311551300.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-20
Publication Date
2025-05-20

AI Technical Summary

Technical Problem

In high-magnification shooting mode, the jitter of the electronic device will cause the image to drift, affecting the image clarity.

Method used

By partially enlarging the current preview image when switching the target shooting mode, the position information of the focus area indicated by the focus operation in the unenlarged preview image is determined, and whether there is a second focus area with similarity in the enlarged preview image is searched for in the enlarged preview image. If present, the jitter coefficient is calculated based on the position information of the two focusing areas, and the image is jitter compensation.

Benefits of technology

It effectively reduces imaging position drift caused by jitter, improves image clarity, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120021270A_ABST
    Figure CN120021270A_ABST
Patent Text Reader

Abstract

The invention relates to a shooting method and device, electronic equipment and a storage medium, and the method comprises the steps: carrying out the local amplification of a currently displayed first preview image in response to a target shooting mode switching instruction, and obtaining a second preview image; in response to a focusing operation for the second preview image, determining first position information of a first focusing area indicated by the focusing operation in the first preview image; determining whether a second focusing area exists in the second preview image or not; if the second focusing area exists in the second preview image, determining a jitter coefficient based on the second position information and the first position information of the second focusing area in the first preview image; performing jitter compensation on third position information of the second preview image in the first preview image based on the jitter coefficient to obtain fourth position information; and locally amplifying an image area indicated by the fourth position information in the first preview image to obtain a third preview image, and outputting the third preview image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of shooting technologies, and in particular, to a shooting method, apparatus, electronic device, and storage medium. Background Art

[0002] With the continuous development of electronic technologies, electronic devices with a photographing function (such as digital cameras or mobile phones equipped with cameras) have been widely used in people's daily lives.

[0003] During the shooting process of an electronic device, some jitters will be generated under the influence of the user, causing the position of the shooting object to shift in the direction of the device jitter in the image, resulting in a situation of picture drift in the captured image and affecting the clarity of the image. Especially in the high magnification shooting mode, due to the amplification effect of jitters, even very small jitters will cause an obvious shift in the position of the shooting object in the image. How to reduce the degree of picture drift of the captured image caused by jitters has become an urgent problem to be solved. Summary of the Invention

[0004] To overcome the problems existing in the related art, the present disclosure provides a shooting method, apparatus, electronic device, and storage medium.

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a shooting method, including:

[0006] In response to a target shooting mode switching instruction, locally magnify a first preview image currently displayed to obtain a second preview image;

[0007] In response to a focusing operation on the second preview image, determine first position information of a first focusing area indicated by the focusing operation within the first preview image;

[0008] Determine whether there is a second focusing area in the second preview image, where the similarity between the image pixels within the second focusing area and the image pixels within the first focusing area satisfies a preset condition;

[0009] If there is the second focusing area in the second preview image, determine a jitter coefficient based on second position information of the second focusing area within the first preview image and the first position information;

[0010] Based on the jitter coefficient, perform jitter compensation on third position information of the second preview image within the first preview image to obtain fourth position information;

[0011] Locally magnify an image area indicated by the fourth position information within the first preview image to obtain a third preview image, and output the third preview image.

[0012] Optionally, determining whether there is a second focus area in the second preview image includes:

[0013] Using a sliding window to slide within the second preview image to obtain a plurality of window images; wherein, the window size of the sliding window is determined by the first focus area; the position information of each window image within the second preview image is different;

[0014] Determining the cross-correlation coefficient between the image pixels of each window image and the image pixels within the first focus area;

[0015] Determining the maximum cross-correlation coefficient from the cross-correlation coefficients corresponding to the plurality of window images;

[0016] Determining whether there is a second focus area in the second preview image according to whether the maximum cross-correlation coefficient is greater than a coefficient threshold; the second focus area is: the window image corresponding to the maximum cross-correlation coefficient that is greater than the coefficient threshold.

[0017] Optionally, the method further includes:

[0018] Obtaining the zoom ratio corresponding to the target shooting mode;

[0019] Determining the expansion parameter corresponding to the zoom ratio, where the expansion parameter is used to perform boundary expansion on the image area corresponding to the second preview image within the first preview image;

[0020] Based on the expansion parameter and the third position information, determining the expanded second preview image from the first preview image;

[0021] Determining whether there is a second focus area in the second preview image includes:

[0022] Determining whether there is a second focus area in the expanded second preview image.

[0023] Optionally, determining the expansion parameter corresponding to the zoom ratio includes:

[0024] If the zoom ratio is greater than or equal to a first zoom threshold and less than the maximum zoom ratio, determining the expansion parameter corresponding to the zoom ratio; wherein, the expansion parameter corresponding to the zoom ratio is positively correlated with the zoom ratio.

[0025] Optionally, the method further includes:

[0026] Obtaining the zoom ratio corresponding to the target shooting mode;

[0027] Determining the downsampling parameter corresponding to the zoom ratio;

[0028] Downsample the second preview image and the first focus area respectively based on the downsampling parameter;

[0029] Determining whether there is a second focus area in the second preview image includes:

[0030] Determine whether there is a second focus area in the downsampled second preview image; the similarity between the pixel points in the second focus area and the pixel points in the downsampled first focus area meets a preset condition.

[0031] Optionally, determining the downsampling parameter corresponding to the zoom ratio includes:

[0032] If the zoom ratio is greater than or equal to a third zoom threshold and less than or equal to the maximum zoom ratio, determine that the downsampling rate corresponding to the zoom ratio is the minimum downsampling rate;

[0033] If the zoom ratio is greater than or equal to a second zoom threshold and less than the third zoom threshold, the downsampling rate corresponding to the zoom ratio is negatively correlated with the zoom ratio.

[0034] Optionally, in response to a focus operation on the second preview image, determining the first position information of the first focus area indicated by the focus operation in the first preview image includes:

[0035] In response to a focus operation on the second preview image, determine the fifth position information of the first focus area indicated by the focus operation in the second preview image;

[0036] Obtain the zoom ratio corresponding to the target shooting mode;

[0037] Based on the zoom ratio, the fifth position information, and the third position information of the second preview image in the first preview image, determine the first position information of the first focus area in the first preview image.

[0038] Optionally, the method further includes:

[0039] If there is no second focus area in the second preview image, output the second preview image.

[0040] According to a second aspect of the embodiments of the present disclosure, a shooting device is provided, including:

[0041] A first determination module, configured to, in response to a target shooting mode switching instruction, perform local magnification on a currently displayed first preview image to obtain a second preview image; and in response to a focusing operation on the second preview image, determine first position information of a first focusing area indicated by the focusing operation within the first preview image.

[0042] A second determination module, configured to determine whether there is a second focusing area in the second preview image, where a similarity between image pixels within the second focusing area and image pixels within the first focusing area meets a preset condition.

[0043] A third determination module, configured to, if there is the second focusing area in the second preview image, determine a jitter coefficient based on second position information of the second focusing area within the first preview image and the first position information.

[0044] A compensation module, configured to perform jitter compensation on third position information of the second preview image within the first preview image based on the jitter coefficient to obtain fourth position information; perform local magnification on an image area indicated by the fourth position information within the first preview image to obtain a third preview image, and output the third preview image.

[0045] Optionally, the second determination module is configured to:

[0046] Use a sliding window to slide within the second preview image to obtain a plurality of window images; where a window size of the sliding window is determined by the first focusing area; position information of each window image within the second preview image is different.

[0047] Determine a cross-correlation coefficient between image pixels of each window image and image pixels within the first focusing area.

[0048] Determine a maximum cross-correlation coefficient from cross-correlation coefficients corresponding to the plurality of window images.

[0049] Determine whether there is a second focusing area in the second preview image according to whether the maximum cross-correlation coefficient is greater than a coefficient threshold; the second focusing area is: the window image corresponding to the maximum cross-correlation coefficient greater than the coefficient threshold.

[0050] Optionally, the second determination module is configured to:

[0051] Obtain a zoom ratio corresponding to the target shooting mode.

[0052] Determine an expansion parameter corresponding to the zoom ratio, where the expansion parameter is used to perform boundary expansion on an image area corresponding to the second preview image within the first preview image.

[0053] Determine an extended second preview image from the first preview image based on the extended parameter and the third position information;

[0054] The determining whether there is a second focus area in the second preview image includes:

[0055] Determine whether there is a second focus area in the extended second preview image.

[0056] Optionally, the second determination module is configured to:

[0057] If the zoom ratio is greater than or equal to a first zoom threshold and less than the maximum zoom ratio, determine an extended parameter corresponding to the zoom ratio; wherein, the extended parameter corresponding to the zoom ratio is positively correlated with the zoom ratio.

[0058] Optionally, the second determination module is configured to:

[0059] Obtain a zoom ratio corresponding to a target shooting mode;

[0060] Determine a downsampling parameter corresponding to the zoom ratio;

[0061] Based on the downsampling parameter, perform downsampling processing on the second preview image and the first focus area respectively;

[0062] The determining whether there is a second focus area in the second preview image includes:

[0063] Determine whether there is a second focus area in the second preview image after downsampling processing; the similarity between the pixel points in the second focus area and the pixel points in the first focus area after downsampling processing meets a preset condition.

[0064] Optionally, the second determination module is configured to:

[0065] If the zoom ratio is greater than or equal to a third zoom threshold and less than or equal to the maximum zoom ratio, determine that the downsampling rate corresponding to the zoom ratio is the minimum downsampling rate;

[0066] If the zoom ratio is greater than or equal to a second zoom threshold and less than the third zoom threshold, the downsampling rate corresponding to the zoom ratio is negatively correlated with the zoom ratio.

[0067] Optionally, the first determination module is configured to:

[0068] In response to a focusing operation on the second preview image, determine fifth position information of the first focus area indicated by the focusing operation in the second preview image;

[0069] Obtain a zoom ratio corresponding to the target shooting mode;

[0070] Based on the zoom ratio, the fifth position information, and the third position information of the second preview image in the first preview image, determine the first position information of the first focus area within the first preview image.

[0071] Optionally, the compensation module is configured to:

[0072] If the second focus area does not exist in the second preview image, output the second preview image.

[0073] According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including:

[0074] A memory for storing processor-executable instructions;

[0075] A processor connected to the memory;

[0076] Wherein, the processor is configured to execute the shooting method according to any one of the embodiments of the first aspect of the present disclosure.

[0077] According to a fourth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the shooting method according to any one of the embodiments of the first aspect of the present disclosure.

[0078] The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:

[0079] In the embodiments of the present disclosure, when a focusing operation on a locally magnified second preview image is detected, the first position information of the first focus area indicated by the focusing operation in the non-magnified first preview image is determined; and it is searched whether there is a second focus area in the second preview image, where the similarity between the image pixels within the second focus area and the image pixels within the first focus area meets a preset condition; thus, by searching for the second focus area in the second preview image, the second focus area after the first focus area drifts is determined.

[0080] When there is a second focus area in the second preview image, determine a jitter coefficient according to the second position information and the first position information of the second focus area in the first preview image; thus, use the jitter coefficient that can reflect the imaging position drift caused by the drift to perform jitter compensation on the third position information of the second preview image to reduce the imaging position drift caused by jitter; and locally magnify and display the image area indicated by the fourth position information after jitter compensation to improve the clarity of the image, output the target image area on which the user focuses to the user, and enhance the user experience.

[0081] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] The accompanying drawings herein are incorporated into and constitute a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.

[0083] Figure 1 is a flowchart showing a shooting method according to an exemplary embodiment Figure 1 ;

[0084] Figure 2 is a schematic diagram showing a first preview image and a second preview image according to an exemplary embodiment Figure 1 ;

[0085] Figure 3 is a schematic diagram showing a first preview image and a second preview image according to an exemplary embodiment Figure 2 ;

[0086] Figure 4 is a schematic diagram showing boundary extension of a second preview image according to an exemplary embodiment;

[0087] Figure 5 is a schematic diagram showing a mapping relationship between extension parameters and zoom ratios according to an exemplary embodiment;

[0088] Figure 6 is a schematic diagram showing a mapping relationship between downsampling rates and zoom ratios according to an exemplary embodiment;

[0089] Figure 7 is a flowchart showing a shooting method according to an exemplary embodiment Figure 2 ;

[0090] Figure 8 is a schematic structural diagram of a shooting device according to an exemplary embodiment;

[0091] Figure 9 is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0092] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are merely examples of devices consistent with some aspects of the present disclosure as detailed in the appended claims.

[0093] In electronic devices with shooting functions, high-magnification zoom allows users to zoom in to clear images when shooting distant scenes, capturing more details of objects. However, when the electronic device is in high-magnification shooting mode, due to the amplification effect of jitter, even very small jitters will be amplified, causing the picture to drift, resulting in blurred pictures and reduced image quality. Therefore, reducing the degree of scene drift plays a vital role in electronic devices.

[0094] Related technologies usually use optical image stabilization and electronic image stabilization to reduce the scene drift of electronic devices; however, the optical image stabilization method requires more hardware costs and is difficult to popularize in low-end electronic devices. The electronic image stabilization method takes a long time to process and has poor real-time performance.

[0095] Based on this, the present disclosure provides a shooting method, such as Figure 1 As shown, Figure 1 is a schematic diagram of a shooting method according to an exemplary embodiment Figure 1 . The method comprises:

[0096] Step S101, in response to a target shooting mode switching instruction, partially enlarging the currently displayed first preview image to obtain a second preview image;

[0097] Step S102, in response to a focus operation on the second preview image, determining first position information of a first focus area indicated by the focus operation within the first preview image;

[0098] Step S103, determining whether there is a second focus area in the second preview image, and the similarity between the image pixels in the second focus area and the image pixels in the first focus area meets a preset condition;

[0099] Step S104, if the second focus area exists in the second preview image, determining a jitter coefficient based on second position information of the second focus area in the first preview image and the first position information;

[0100] Step S105, based on the jitter coefficient, performing jitter compensation on the third position information of the second preview image in the first preview image to obtain fourth position information;

[0101] Step S106, locally enlarging the image area indicated by the fourth position information in the first preview image to obtain a third preview image, and outputting the third preview image.

[0102] The shooting method shown in the embodiments of the present disclosure can be applied to electronic devices equipped with cameras, such as data cameras, terminals, and other electronic devices. The embodiments of the present disclosure do not limit this.

[0103] In step S101, when the electronic device is in the shooting state, a first preview image is displayed on the preview interface of the electronic device; in response to a target shooting mode switching instruction, the currently displayed first preview image is locally magnified to obtain a second preview image, and the second preview image is displayed on the preview interface.

[0104] Here, the target shooting mode switching instruction is used to control the electronic device to switch the shooting mode to the target shooting mode; the zoom ratio corresponding to the target shooting mode is greater than or equal to a preset zoom threshold.

[0105] It should be noted that the preset zoom threshold can be set according to the actual situation, and the embodiments of the present disclosure do not limit this. In the embodiments of the present disclosure, the target shooting mode can be a high magnification shooting mode.

[0106] Exemplarily, as Figure 2 shown, Figure 2 is a schematic diagram of a first preview image and a second preview image shown according to an exemplary embodiment. Figure 1 Among them, (A) is the first preview image displayed on the preview interface when the electronic device has not switched to the target shooting mode; (B) is the second preview image displayed on the preview interface after the electronic device has switched to the target shooting mode; it can be understood that in response to the target shooting mode switching instruction, a part of the image can be cropped from the first preview image (the cropping area is the area indicated by reference numeral 21), and the cropping area is interpolated and magnified to obtain the second preview image, and the size of the magnified second preview image is the same as that of the first preview image.

[0107] In step S102, when the electronic device is in the target shooting mode, in response to a focusing operation on the second preview image currently displayed on the preview interface, the first position information of the first focusing area indicated by the focusing operation within the first preview image is determined.

[0108] Here, the focusing operation can be a focusing operation manually triggered by the user. Exemplarily, as Figure 2 shown, the area indicated by reference numeral 22 is the first focusing area.

[0109] In some embodiments, the first position information of the first focusing area within the first preview image can be determined based on the correspondence between the pixel points of the first preview image and the second preview image.

[0110] Exemplarily, as Figure 3 shown, Figure 3Schematic diagram of a first preview image and a second preview image shown according to an exemplary embodiment Figure 2 . Among them, (A) is the second preview image displayed on the preview interface; (B) is the first preview image displayed on the preview interface; reference numeral 31 indicates the first focusing area; reference numeral 32 is the image position of the second preview image within the first preview image; reference numeral 33 is the image position of the first focusing area within the first preview image.

[0111] In step S103, the second preview image can be divided into multiple sub-images, and the similarity between the pixel points in each sub-image and the pixel points in the first focusing area is determined; based on the similarities corresponding to the multiple sub-images, it is determined whether there is a sub-image whose similarity meets a preset condition.

[0112] It should be noted that the similarity between the pixel points in each sub-image and the pixel points in the first focusing area can be the similarity between the pixel values of each pixel point in each sub-image and the corresponding pixel points in the first focusing area.

[0113] It is worth noting that by determining the similarity between the pixel values of each pixel point in each sub-image and the corresponding pixel points in the first focusing area, it is determined whether the image area corresponding to the sub-image and the image area indicated by the first focusing area are the same image area within the first preview image.

[0114] If there is a sub-image whose similarity meets the preset condition, it is determined that there is a second focusing area within the second preview image, and this second focusing area is the image area corresponding to the sub-image whose similarity meets the preset condition.

[0115] Here, the method for determining the similarity between the pixel points in the sub-image and the pixel points in the first focusing area can be selected according to actual needs, and the embodiments of the present disclosure do not limit this.

[0116] In some embodiments, the similarity meeting the preset condition can be that the similarity is greater than or equal to a similarity threshold. Here, the similarity threshold can be set according to actual needs.

[0117] In step S104, if it is determined that there is a second focusing area in the second preview image, the second position information of the second focusing area in the first preview image can be obtained; based on the second position information of the second focusing area and the first position information of the first focusing area, the jitter coefficient is determined.

[0118] It is worth noting that when the electronic device is in the target shooting mode, due to the amplification effect of jitter, even very small jitter during the shooting process will be amplified, resulting in the shooting screen drifting, thus making the shooting screen blurred and the image quality degraded.

[0119] It can be understood that the second focus area may be the image area after the first focus area drifts due to jitter. The images corresponding to the first focus area and the second focus area may be the same, and there is a positional difference between the first focus area and the second focus area due to jitter.

[0120] Based on this, in the embodiments of the present disclosure, by determining the positional difference between the first position information of the first focus area and the second position information of the second focus area according to the second position information of the second focus area and the first position information of the first focus area, the jitter coefficient is determined based on the positional difference.

[0121] In some embodiments, the jitter coefficient is used to indicate the positional offset between the first position information and the second position information.

[0122] In step S105, the third position information of the second preview image in the first preview image can be obtained, and the third position information is compensated for jitter according to the jitter coefficient to obtain the fourth position information.

[0123] It can be understood that since the jitter coefficient can be used to indicate the positional difference caused by jitter, the third position information of the second preview image is compensated for jitter by using the jitter coefficient.

[0124] The image area indicated by the fourth position information may be the image area of the second preview image after experiencing scene drift.

[0125] In step S106, the image area indicated by the fourth position information in the first preview image can be locally enlarged to obtain a third preview image, and the third preview image is output on the preview interface.

[0126] It can be understood that based on the fourth position information, the image area corresponding to the fourth position information can be determined from the first preview image, and the image area is interpolated and enlarged to obtain the third preview image. The size of the third preview image is the same as that of the first preview image.

[0127] In the embodiments of the present disclosure, when a focus operation on the locally enlarged second preview image is detected, the first position information of the first focus area indicated by the focus operation in the unenlarged first preview image is determined; and whether there is a second focus area is searched in the second preview image, wherein the similarity between the image pixels in the second focus area and the image pixels in the first focus area meets a preset condition; thus, by searching for the second focus area in the second preview image, the second focus area after the first focus area drifts is determined.

[0128] When there is a second focus area in the second preview image, determine a jitter coefficient according to the second position information and the first position information of the second focus area in the first preview image; in this way, use the jitter coefficient that can reflect the imaging position drift caused by drift to perform jitter compensation on the third position information of the second preview image, so as to reduce the imaging position drift caused by jitter; and locally magnify and display the image area indicated by the fourth position information after jitter compensation, improve the clarity of the image, output the target image area on which the user focuses, and enhance the user experience.

[0129] Optionally, determining whether there is a second focus area in the second preview image includes:

[0130] Use a sliding window to slide within the second preview image to obtain a plurality of window images; wherein, the window size of the sliding window is determined by the first focus area; the position information of each window image within the second preview image is different;

[0131] Determine the cross-correlation coefficient between the image pixels of each window image and the image pixels within the first focus area;

[0132] Determine the maximum cross-correlation coefficient from the cross-correlation coefficients corresponding to the plurality of window images;

[0133] Determine whether there is a second focus area in the second preview image according to whether the maximum cross-correlation coefficient is greater than a coefficient threshold; the second focus area is: the window image corresponding to the maximum cross-correlation coefficient greater than the coefficient threshold.

[0134] In the embodiments of the present disclosure, a sliding window having the same size as the first focus area can be used to traverse the second preview image to obtain a plurality of window images. The position information of each window image among the plurality of window images within the second preview image is different.

[0135] In some embodiments, a sliding window can be used to slide within the second preview image. Each time the sliding window moves one pixel position, a window image is obtained.

[0136] After obtaining a plurality of window images, the cross-correlation coefficient between the image pixels within each window image and the image pixels within the first focus area can be determined.

[0137] It should be noted that the cross-correlation coefficient is a measure of the relationship between two data sets and is used to describe the degree of similarity between two data sets.

[0138] In some embodiments, determining the cross-correlation coefficient between the image pixels of each window image and the image pixels within the first focus area includes:

[0139] Determine the first pixel mean value of the image pixels within the first focus area;

[0140] Determine the second pixel mean value of the image pixels within each of the window images;

[0141] Determine the first pixel difference between the pixel value of each pixel point within the first focus area and the first pixel mean value;

[0142] Determine the second pixel difference between the pixel value of each pixel point within each window image and the second pixel mean value;

[0143] Determine the normalized cross - correlation coefficient of the corresponding window image and the first focus area based on the first pixel differences of multiple pixel points within the first focus area and the second pixel differences of multiple pixel points within the window image.

[0144] In some embodiments, the first pixel mean value of the image pixels within the first focus area can be determined by the following formula:

[0145]

[0146] where, the Mean-refSample is the first pixel mean value; m is the width of the first focus area; n is the height of the first focus area; the refSample IMAGE(x,y) is the pixel value of the pixel point at the x - th row and y - th column within the first focus area.

[0147] In some embodiments, the second pixel mean value of the image pixels within the window image can be determined by the following formula:

[0148]

[0149] where, the Mean-Slid is the second pixel mean value, the Slid IMAGE(x,y) is the pixel value of the pixel point at the x - th row and y - th column within the window image.

[0150] In some embodiments, the normalized cross - correlation coefficient of the corresponding window image and the first focus area can be determined according to the following formula:

[0151]

[0152] where, the NCC(i,j) is the normalized cross - correlation coefficient of the window image corresponding to the position (i,j); the Dif ref is the first pixel difference; Dif ref =IMAGE refSample (x,y)-IMAGE Mean-refSample; the Dif Slid is the second pixel difference, and Dif Slid = IMAGE Slid (x,y) - IMAGE Mean-Slid .

[0153] After determining the cross - correlation coefficients corresponding to multiple window images, determine the maximum cross - correlation coefficient from the multiple cross - correlation coefficients; and determine whether the maximum cross - correlation coefficient is greater than a preset coefficient threshold; if the maximum cross - correlation coefficient is greater than the coefficient threshold, determine the window image corresponding to the maximum cross - correlation coefficient as the image corresponding to the second focus area.

[0154] Here, the coefficient threshold can be set according to actual needs, and the embodiments of the present disclosure do not limit this.

[0155] In some embodiments, the value range of the coefficient threshold can be: 0.75 - 0.95. In one embodiment, the coefficient threshold can be 0.9.

[0156] The embodiments of the present disclosure use a sliding window with the same size as the first focus area to traverse the second preview image to obtain multiple window images at different positions; according to the cross - correlation coefficients between each window image in the multiple window images and the first focus area, determine the similarity of the image pixels between each window image and the first focus area; and further determine whether there is a second focus area after the first focus area drifts in the second preview image.

[0157] Optionally, the method further includes:

[0158] Obtain the zoom ratio corresponding to the target shooting mode;

[0159] Determine the expansion parameter corresponding to the zoom ratio, where the expansion parameter is used to perform boundary expansion on the image area corresponding to the second preview image within the first preview image;

[0160] Based on the expansion parameter and the third position information, determine the expanded second preview image from the first preview image;

[0161] The determining whether there is a second focus area in the second preview image includes:

[0162] Determine whether there is a second focus area in the expanded second preview image.

[0163] In the embodiments of the present disclosure, the zoom ratio corresponding to the target shooting mode can be obtained according to the target shooting mode switching instruction; based on the zoom ratio, the expansion parameter corresponding to the zoom ratio is determined.

[0164] Here, the expansion parameter is used to perform boundary expansion on the image region corresponding to the second preview image within the first preview image.

[0165] It should be noted that performing boundary expansion on the image region corresponding to the second preview image within the first preview image can be understood as expanding outward along the image boundary of the second preview image in the first preview image, that is, the width and / or height of the expanded image is greater than the width and / or height of the second preview image.

[0166] Exemplarily, as Figure 4 shown, Figure 4 is a schematic diagram of performing boundary expansion on the second preview image according to an exemplary embodiment. Among them, label 41 is the image region corresponding to the second preview image; label 42 is the image region corresponding to the second preview image after boundary expansion.

[0167] In some embodiments, the expansion parameters corresponding to different zoom ratios may be different.

[0168] It should be noted that considering that in the case of different zoom ratios, the amplification effects of slight jitters during the shooting process by the user may vary; in order to reduce the situation where there is no second focus region in the second preview image during subsequent processing, the image region corresponding to the second preview image in the first preview image can be expanded outward to different degrees according to the zoom ratio.

[0169] After determining the expansion parameter corresponding to the zoom ratio, based on the expansion parameter, the third position information of the second preview image in the first preview image can be updated to obtain the updated third position information; wherein, the image region indicated by the updated third position information is the second preview image after boundary expansion.

[0170] If the third position information Loca Crop =(x Crop , y Crop , w Crop , h Crop ); where, the x Crop is the abscissa of the upper left corner of the second preview image in the first preview image; the y Crop is the ordinate of the upper left corner of the second preview image in the first preview image; the w Crop is the width of the image region corresponding to the second preview image in the first preview image; the h Crop is the height of the image region corresponding to the second preview image in the first preview image.

[0171] The updated third position information is Loca Search =(x Search , ySearch , w Search , h Search ); where, the x Search is the abscissa of the upper left corner of the second preview image after boundary expansion in the first preview image, and the y Search is the ordinate of the upper left corner of the second preview image after boundary expansion in the first preview image; the w Search is the width of the image area corresponding to the second preview image after boundary expansion, w Search = w Crop * Multi, where Multi is the expansion parameter; the h Search is the height of the image area corresponding to the second preview image after boundary expansion, h Search = h Crop * Multi; thus, x Search = x Crop - w Crop * (Multi - 1) / 2; y Search = y Crop - h Crop * (Multi - 1) / 2.

[0172] After determining the expanded second preview image from the first preview image based on the updated third position information, it is possible to determine whether there is a second focus area based on the expanded second preview image.

[0173] In this way, the expansion parameter corresponding to the zoom ratio can be determined according to the zoom ratio corresponding to the target shooting mode; the image area corresponding to the second preview image in the first preview image can be boundary-expanded according to the expansion parameter; whether there is a second focus area is determined based on the boundary-expanded second preview image; the situation where it is impossible to search for a second focus area in the second preview image whose similarity to the first focus area meets the preset conditions due to the difference in the amplification effect of jitter at different zoom ratios is reduced.

[0174] Optionally, determining the expansion parameter corresponding to the zoom ratio includes:

[0175] If the zoom ratio is greater than or equal to the first zoom threshold and less than the maximum zoom ratio, determine the expansion parameter corresponding to the zoom ratio; where, the expansion parameter corresponding to the zoom ratio is positively correlated with the zoom ratio.

[0176] In the embodiments of the present disclosure, according to the zoom ratio corresponding to the target shooting mode, if the zoom ratio is greater than or equal to the first zoom threshold and less than the maximum zoom ratio, the image area corresponding to the second preview image in the first preview image is boundary-expanded.

[0177] Here, the first zoom threshold may be a zoom ratio that triggers boundary expansion of the image area corresponding to the second preview image within the first preview image. The first zoom threshold can be set according to the zoom capability of the electronic device. The maximum zoom ratio is the maximum zoom ratio supported by the electronic device.

[0178] It should be noted that in this case, the expansion parameter corresponding to the zoom ratio is positively correlated with the zoom ratio; that is, the larger the zoom ratio, the larger the expansion parameter.

[0179] In some embodiments, the expansion parameter corresponding to the zoom ratio can be determined by the following formula:

[0180]

[0181] Wherein, the Multi is the expansion parameter; the Multi max is the maximum expansion parameter, and the value range is 1.5 - 2; the Zoom mid is the first zoom threshold, and the value range is 15 - 55; the Zoom max is the maximum zoom ratio; the value range is 60 - 100.

[0182] In some embodiments, if the zoom ratio is less than the first zoom region, the boundary of the image area corresponding to the second preview image within the first preview image is not expanded. In this case, the expansion parameter corresponding to the zoom ratio can be 1.

[0183] Exemplarily, as Figure 5 shown, Figure 5 is a schematic diagram of the mapping relationship between the expansion parameter and the zoom ratio shown according to an exemplary embodiment.

[0184] Thus, when the zoom ratio is greater than or equal to the first zoom threshold and less than the maximum zoom ratio, that is, when the zoom ratio is relatively large, the boundary of the image area corresponding to the second preview image within the first preview image is expanded, so as to perform subsequent processing based on the second preview image after boundary expansion, in order to reduce the situation that during shooting with a relatively large zoom ratio, the slight shaking of the user during the shooting process causes the captured image to exceed the image area corresponding to the second preview image within the first preview image, that is, there is no second focus area in the second preview image.

[0185] Optionally, the method further includes:

[0186] Obtaining the zoom ratio corresponding to the target shooting mode;

[0187] Determining the downsampling parameter corresponding to the zoom ratio;

[0188] Perform downsampling processing on the second preview image and the first focus area respectively based on the downsampling parameters;

[0189] Determining whether there is a second focus area in the second preview image includes:

[0190] Determine whether there is a second focus area in the second preview image after downsampling processing; the similarity between the pixel points in the second focus area and the pixel points in the first focus area after downsampling processing meets a preset condition.

[0191] In an embodiment of the present disclosure, a zoom ratio corresponding to a target shooting mode can be obtained according to a target shooting mode switching instruction; based on the zoom ratio, downsampling parameters corresponding to the zoom ratio are determined.

[0192] Here, the downsampling parameters can be processing parameters for downsampling processing, such as the downsampling rate.

[0193] In some embodiments, the downsampling parameters corresponding to different zoom ratios can be different.

[0194] Based on the downsampling parameters, downsampling processing can be performed on the second preview image and the first focus area to obtain the second preview image and the first focus area after downsampling processing.

[0195] It should be noted that the width and height of the second preview image after downsampling processing are smaller than the width and height of the second preview image before downsampling processing; the width and height of the first focus area after downsampling processing are smaller than the width and height of the first focus area before downsampling processing.

[0196] By performing downsampling processing on the second preview image and the first focus area, the image data of the second preview image and the first focus area can be reduced, so as to improve the image processing speed in subsequent processing.

[0197] Based on the first focus area after downsampling processing, a sliding window can be determined; the size of the sliding window is the same as the size of the first focus area after downsampling processing.

[0198] Use the sliding window to slide within the second preview image after downsampling processing to obtain multiple window images; based on the multiple window images, determine whether there is a second focus area in the second preview image after downsampling processing.

[0199] It should be noted that the size of the window image is the same as the size of the first focus area after downsampling processing, and the similarity between the pixel points in the second focus area and the pixel points in the first focus area after downsampling processing meets a preset condition.

[0200] In this way, by determining the downsampling parameter corresponding to the zoom ratio, and based on the downsampling parameter, the second preview image and the first focus area are downsampled to facilitate improving the image processing speed in subsequent processing.

[0201] Optionally, the determining the downsampling parameter corresponding to the zoom ratio includes:

[0202] If the zoom ratio is greater than or equal to the third zoom threshold and less than or equal to the maximum zoom ratio, determining the downsampling rate corresponding to the zoom ratio as the minimum downsampling rate;

[0203] If the zoom ratio is greater than or equal to the second zoom threshold and less than the third zoom threshold, the downsampling rate corresponding to the zoom ratio is negatively correlated with the zoom ratio.

[0204] In an embodiment of the present disclosure, according to the zoom ratio corresponding to the target shooting mode, if the zoom ratio is greater than or equal to the third zoom threshold and less than or equal to the maximum zoom ratio, the minimum downsampling rate supported by the electronic device is determined as the downsampling rate corresponding to the zoom ratio.

[0205] If the zoom ratio is greater than or equal to the second zoom threshold and less than the third zoom threshold, the downsampling rate corresponding to the zoom ratio is negatively correlated with the zoom ratio.

[0206] It should be noted that in this case, the larger the zoom ratio, the smaller the corresponding downsampling rate.

[0207] The second zoom threshold may be the minimum zoom ratio that triggers the downsampling process; the second zoom threshold can be set according to the zooming ability of the electronic device. In some embodiments, the value range of the second zoom threshold is 10 - 20. In one embodiment, the second zoom threshold is 15.

[0208] The third zoom threshold may be the minimum zoom ratio corresponding to the case where the downsampling parameter is the minimum downsampling rate. The third zoom threshold can be set according to the zooming ability of the electronic device. In some embodiments, the value range of the third zoom threshold is 25 - 50. In one embodiment, the third zoom threshold is 30.

[0209] In some embodiments, the downsampling rate corresponding to the zoom ratio can be determined by the following formula:

[0210]

[0211] where, the f is the downsampling rate; the f min is the minimum downsampling rate, and the value range is 1 - 3; the f max is the maximum downsampling rate, and the value range is 5 - 10; the Zoom mid2is the third zoom threshold, and the Zoom mid1 is the second zoom threshold; represents the floor operation. For example,

[0212] Exemplarily, as Figure 6 shown, Figure 6 is a schematic diagram of the mapping relationship between the downsampling rate and the zoom ratio shown according to an exemplary embodiment.

[0213] In this way, according to the zoom ratio corresponding to the target shooting mode, the downsampling rate corresponding to the zoom ratio is determined, and the image processing speed is improved without affecting the subsequent processing process.

[0214] Optionally, the determining the first position information of the first focus area indicated by the focus operation in the first preview image in response to the focus operation on the second preview image includes:

[0215] In response to the focus operation on the second preview image, determining the fifth position information of the first focus area indicated by the focus operation in the second preview image;

[0216] Obtaining the zoom ratio corresponding to the target shooting mode;

[0217] Based on the zoom ratio, the fifth position information, and the third position information of the second preview image in the first preview image, determining the first position information of the first focus area in the first preview image.

[0218] In the embodiments of the present disclosure, in response to the user's focus operation on the second preview image currently output on the preview interface, the fifth position information of the first focus area indicated by the focus operation in the second preview image is determined.

[0219] In some embodiments, the fifth position information may be Loca=(x touch , y touch , w touch , h touch ); the x touch is the abscissa of the upper left corner of the first focus area in the second preview image, and the y touch is the ordinate of the upper left corner of the first focus area in the second preview image; the w touch is the width of the first focus area in the second preview image; the h touch is the height of the first focus area in the second preview image.

[0220] The zoom ratio corresponding to the target shooting mode can be obtained according to the target shooting mode switching instruction.

[0221] It should be noted that since the second preview image is obtained by locally magnifying the first preview image, and the magnification ratio is determined by the zoom ratio corresponding to the target shooting mode.

[0222] The first position information of the first focusing area in the first preview image can be determined according to the third position information of the second preview image in the first preview image, the fifth position information, and the zoom ratio.

[0223] In some embodiments, it is assumed that the third position information is Loca Crop =(x Crop ,y Crop ,w Crop ,h Crop ); where, the x Crop is the abscissa of the upper left corner of the second preview image in the first preview image, and the y Crop is the ordinate of the upper left corner of the second preview image in the first preview image; the w Crop is the width of the second preview image in the first preview image; the h touch is the height of the second preview image in the first preview image. The determined first position information of the first focusing area can be Loca ref =(x Crop +x touch / Zoom,y Crop +y touch / Zoom,w touch / Zoom,h touch / Zoom); where, the Zoom is the zoom ratio corresponding to the target shooting mode.

[0224] In the embodiments of the present disclosure, according to the fifth position information of the first focusing area indicated by the focusing operation in the currently displayed second preview image, the zoom ratio, and the third position information of the second preview image in the first preview image, the positional relationship between the second preview image and the first preview image is determined, and then the first position information of the first focusing area in the first preview image is determined.

[0225] Optionally, the method further includes:

[0226] If the second focusing area does not exist in the second preview image, output the second preview image.

[0227] In the embodiments of the present disclosure, if the second focusing area does not exist in the second preview image, it indicates that the shaking range of the electronic device is relatively large, or the shooting object of the electronic device changes greatly. At this time, the second preview image can be output on the preview interface.

[0228] The embodiments of the present disclosure provide a shooting method, such asFigure 7 As shown Figure 7 is a schematic flowchart of a shooting method shown according to an exemplary embodiment Figure 2 . The method includes:

[0229] Step S201: When a user manually triggers a focusing operation in the high magnification zoom mode, obtain the position coordinates of the pixels in the area within the manual focusing window and the manual focusing window of the camera in the high magnification zoom mode;

[0230] When the camera switches to the high magnification zoom mode, a partial area, i.e., the cropped area IMAGE Crop , will be cropped from the original focusing window Crop and the cropped area IMAGE

[0231] will be interpolated and enlarged to the same size as the original focusing window. When the user manually triggers focusing in the high magnification zoom mode, the camera will obtain the pixels in the area within the manual focusing window where the user manually triggers focusing IMAGE Touch ; Exemplarily, as Figure 2 shown, the area indicated by reference numeral 22 may be the area corresponding to the manual focusing window. Assume that the coordinates of the manual focusing window IMAGE Touch in the currently output picture window are Loca=(x touch , y touch , w touch , h touch ).

[0232] Step S202: Determine the area corresponding to the manual focusing window in the cropped area before interpolation and enlargement as the template image according to the position coordinates of the manual focusing window and the zoom ratio.

[0233] Since the area pixels corresponding to the manual focusing window IMAGE Touch and the currently output picture window of the camera are obtained by interpolating and enlarging the cropped area IMAGE Crop , the coordinates of the manual focusing window IMAGE Touch can be divided by the zoom ratio to obtain the coordinates of the manual focusing window in the cropped area IMAGE Crop before interpolation and enlargement.

[0234] Assume that the coordinates of the cropped area in the original focusing window are Loca Crop =(x Crop , y Crop , w Crop , h Crop ). According to the coordinates of the cropped area in the original focusing window and the coordinates of the manual focusing window in the cropped area IMAGE CropCoordinates within it are used to determine the area corresponding to the manual focus window in the original focus window, IMAGE Touch-Crop of the coordinates. Exemplarily, as Figure 3 shown, the area labeled 33 is IMAGE Touch-Crop .

[0235] Here, the area corresponding to the manual focus window in the original focus window, IMAGE Touch-Crop can be used as the template image, IMAGE reference . According to the interpolation magnification relationship, the coordinates of the template image, IMAGE reference within the original focus window, Loca ref =(x Crop +x touch / Zoom, y Crop +y touch / Zoom, w touch / Zoom, h touch / Zoom).

[0236] Step S203: Use the cropped area as the floating image, determine the expansion factor according to the zoom ratio, and expand the floating image.

[0237] The cropped area, IMAGE Crop can be used as the floating image, Window Search . Expand Window Search by a certain proportion to increase the target search window.

[0238] It should be noted that when the zoom ratio is small, the floating image, Window Search is not expanded; when the zoom ratio is large, the floating image, Window Search is expanded by a certain proportion along the cropped area.

[0239] The coordinates of the expanded floating image, Window Search , are Loca Search =(x Search , y Search , w Search , h Search ).

[0240] Step S204: Determine the downsampling rate of the floating image and the template image according to the zoom ratio.

[0241] To improve the subsequent image processing speed, the floating image and the template image at different zoom ratios can be downsampled horizontally and vertically by a certain proportion. It should be noted that the larger the zoom ratio, the smaller the downsampling rate, f.

[0242] Step S205: Downsample the floating image and the template image according to the downsampling rate, and convert the downsampled floating image and template image into grayscale images.

[0243] The floating image Window Search and the template image IMAGE reference can be downsampled based on the downsampling rate f and converted into grayscale images to obtain the processed floating image Window Sample and the template image IMAGE refSample .

[0244] Step S206: Move a sliding window of the same size as the template image within the floating image to determine the normalized cross-correlation coefficient between the image within the sliding window after each pixel is determined and the template image.

[0245] The width and height of the downsampled template image IMAGE refSample are m = w touch / Zoom / f and n = h touch / Zoom / f respectively. Move the sliding window with width m = w touch / Zoom / f and height n = h touch / Zoom / f on the floating image Window Sample to obtain the image IMAGE Slid within the window at each position.

[0246] Determine the mean value IMAGE refSample of IMAGE Mean-refSample :

[0247]

[0248] Determine the mean value IMAGE Slid of IMAGE Mean-Slid :

[0249]

[0250] Determine the normalized cross-correlation coefficient NCC between IMAGE refSample and IMAGE Slid :

[0251]

[0252] In the above formula, Dif ref = IMAGE refSample (x,y) - IMAGE Mean-refSample ;

[0253] Dif Slid = IMAGESlid (x, y)-IMAGE Mean-Slid 。

[0254] Slide the window over the floating image Window Sample and move the window from left to right and top to bottom in sequence to determine the image IMAGE within the window at each position Slid and the template image IMAGE refSample Calculate the normalized cross-correlation coefficient, and store the obtained NCC(i, j) in a matrix.

[0255] Step S207: Determine whether there is an optimal matching position.

[0256] Determine the maximum value NCC in the matrix NCC(i, j) max , when NCC max > σ, it is determined that there is an optimal matching position. The value range of σ is 0.75 - 0.95, and here σ = 0.9; otherwise, it is determined that there is no optimal matching position.

[0257] Step S208: If there is an optimal matching position, output the image corresponding to the optimal matching position in the current focusing window.

[0258] When there is an optimal matching position, the position corresponding to the maximum value NCC in the matrix NCC(i, j) max is the optimal matching position of the template image IMAGE refSample in the image Window Sample . Assume the optimal matching position is:

[0259] Loca Best =(x Best , y Best , m, n) (9)

[0260] where x Best , y Best , m, and n are the abscissa of the upper left corner, the ordinate of the upper left corner, the width of the image corresponding to the optimal matching position, and the height of the image corresponding to the optimal matching position respectively.

[0261] According to the downsampling rate f, the optimal matching position of IMAGE reference in the floating image Window Search can be determined as:

[0262]

[0263] In this way, the displacement of the scene offset of the template image IMAGE reference can be determined as:

[0264]

[0265] Among them, △ x represents the displacement in the x direction, and △ y represents the displacement in the y direction.

[0266] Determine the cropping area IMAGE according to the offset position of the scene Crop The coordinates after offset are:

[0267] Loca Crop-final =(x Crop +△ x , y Crop +△ y , w Crop , h Crop )(12)

[0268] Find the image IMAGE corresponding to it after offset according to the coordinates of the cropping area IMAGE Crop after offset, interpolate and enlarge it to IMAGE Best , and output IMAGE Best-enlarge in the current focus window Best-enlarge .

[0269] Step S209: If there is no best matching position, output the original image in the current focus window.

[0270] If there is no best matching position, it means that the camera movement range is relatively large or the shooting target changes greatly at this time. At this time, directly output the image corresponding to the original camera screen window in the focus window, that is, the image after interpolation and enlargement of the cropping area IMAGE Crop .

[0271] The embodiments of the present disclosure provide a shooting device. Figure 8 is a schematic structural diagram of a shooting device shown according to an exemplary embodiment, as Figure 8 shown, the shooting device 200 includes:

[0272] The first determination module 201 is configured to, in response to a target shooting mode switching instruction, perform local magnification on the currently displayed first preview image to obtain a second preview image; in response to a focusing operation on the second preview image, determine first position information of a first focusing area indicated by the focusing operation within the first preview image;

[0273] The second determination module 202 is configured to determine whether there is a second focusing area in the second preview image, and the similarity between the image pixels within the second focusing area and the image pixels within the first focusing area satisfies a preset condition;

[0274] A third determination module 203, configured to determine a jitter coefficient based on second position information of the second focus area in the first preview image and the first position information if the second focus area exists in the second preview image;

[0275] A compensation module 204, configured to perform jitter compensation on third position information of the second preview image in the first preview image based on the jitter coefficient to obtain fourth position information; locally magnify an image area indicated by the fourth position information in the first preview image to obtain a third preview image, and output the third preview image.

[0276] Optionally, the second determination module 202 is configured to:

[0277] Slide a sliding window within the second preview image to obtain a plurality of window images; wherein, a window size of the sliding window is determined by the first focus area; position information of each window image within the second preview image is different;

[0278] Determine a cross-correlation coefficient between image pixels of each window image and image pixels within the first focus area;

[0279] Determine a maximum cross-correlation coefficient from cross-correlation coefficients corresponding to the plurality of window images;

[0280] Determine whether a second focus area exists in the second preview image according to whether the maximum cross-correlation coefficient is greater than a coefficient threshold; the second focus area is: the window image corresponding to the maximum cross-correlation coefficient greater than the coefficient threshold.

[0281] Optionally, the second determination module 202 is configured to:

[0282] Obtain a zoom ratio corresponding to a target shooting mode;

[0283] Determine an expansion parameter corresponding to the zoom ratio, where the expansion parameter is used to perform boundary expansion on an image area corresponding to the second preview image within the first preview image;

[0284] Determine an expanded second preview image from the first preview image based on the expansion parameter and the third position information;

[0285] The determining whether a second focus area exists in the second preview image includes:

[0286] Determine whether a second focus area exists in the expanded second preview image.

[0287] Optionally, the second determination module 202 is configured to:

[0288] If the zoom ratio is greater than or equal to the first zoom threshold and less than the maximum zoom ratio, determine the expansion parameter corresponding to the zoom ratio; wherein, the expansion parameter corresponding to the zoom ratio is positively correlated with the zoom ratio.

[0289] Optionally, the second determination module 202 is configured to:

[0290] Obtain the zoom ratio corresponding to the target shooting mode;

[0291] Determine the downsampling parameter corresponding to the zoom ratio;

[0292] Based on the downsampling parameter, perform downsampling processing on the second preview image and the first focus area respectively;

[0293] The determining whether there is a second focus area in the second preview image includes:

[0294] Determine whether there is a second focus area in the downsampled second preview image; the similarity between the pixel points in the second focus area and the pixel points in the downsampled first focus area meets a preset condition.

[0295] Optionally, the second determination module 202 is configured to:

[0296] If the zoom ratio is greater than or equal to the third zoom threshold and less than or equal to the maximum zoom ratio, determine that the downsampling rate corresponding to the zoom ratio is the minimum downsampling rate;

[0297] If the zoom ratio is greater than or equal to the second zoom threshold and less than the third zoom threshold, the downsampling rate corresponding to the zoom ratio is negatively correlated with the zoom ratio.

[0298] Optionally, the first determination module 201 is configured to:

[0299] In response to a focusing operation on the second preview image, determine the fifth position information of the first focus area indicated by the focusing operation in the second preview image;

[0300] Obtain the zoom ratio corresponding to the target shooting mode;

[0301] Based on the zoom ratio, the fifth position information, and the third position information of the second preview image in the first preview image, determine the first position information of the first focus area in the first preview image.

[0302] Optionally, the compensation module 204 is configured to:

[0303] If the second focus area does not exist in the second preview image, output the second preview image.

[0304] Figure 9 It is a block diagram of an electronic device shown according to an exemplary embodiment. For example, the electronic device may be a smartphone, a tablet computer, etc.

[0305] Referring to Figure 9 , the electronic device 80 may include one or more of the following components: a processing component 83, a memory 84, a power component 85, a multimedia component 86, an audio component 87, an input / output (I / O) interface 88, a sensor component 89, and a communication component 810.

[0306] The processing component 83 generally controls the overall operation of the electronic device 80, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 83 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above methods. In addition, the processing component 83 may include one or more modules to facilitate the interaction between the processing component 83 and other components. For example, the processing component 83 may include a multimedia module to facilitate the interaction between the multimedia component 86 and the processing component 83.

[0307] The memory 84 is configured to store various types of data to support the operation of the electronic device 80. Examples of such data include instructions for any application or method operating on the electronic device 80, contact data, phone book data, messages, pictures, videos, etc. The memory 84 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, 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, a magnetic disk, or an optical disk.

[0308] The power component 85 provides power to various components of the electronic device 80. The power component 85 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 80.

[0309] The multimedia component 86 includes a screen that provides an output interface between the electronic device 80 and the user. 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 can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of the touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 86 includes a front camera and / or a rear camera. When the electronic device 80 is in an operation mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.

[0310] The audio component 87 is configured to output and / or input audio signals. For example, the audio component 87 includes a microphone (MIC) that is configured to receive external audio signals when the electronic device 80 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 84 or transmitted via the communication component 810. In some embodiments, the audio component 87 further includes a speaker for outputting audio signals.

[0311] The I / O interface 88 provides an interface between the processing component 83 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons can include but are not limited to: a home button, a volume button, a power button, and a lock button.

[0312] The sensor component 89 includes one or more sensors for providing a status assessment of various aspects of the electronic device 80. For example, the sensor component 89 can detect the on / off state of the electronic device 80, the relative positioning of components, such as the display and the keypad of the electronic device 80. The sensor component 89 can also detect a change in the position of the electronic device 80 or a component of the electronic device 80, the presence or absence of user contact with the electronic device 80, the orientation or acceleration / deceleration of the electronic device 80, and the temperature change of the electronic device 80. The sensor component 89 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 89 can also include a light sensor, such as a CMOS or a CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 89 can further include an acceleration sensor, a gyro sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0313] The communication component 810 is configured to facilitate communication between the electronic device 80 and other devices in a wired or wireless manner. The electronic device 80 can access a communication standard-based wireless network, such as Wi-Fi, 4G, or 5G, or a combination thereof. In an exemplary embodiment, the communication component 810 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 810 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0314] In an exemplary embodiment, the electronic device 80 can 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 components for performing the above method.

[0315] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 84 including instructions, and the above instructions can be executed by a processor 820 of the electronic device 80 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, Random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0316] Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include known common knowledge or conventional technical means in the technical field not disclosed by the present disclosure. The specification and embodiments are only to be considered as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.

[0317] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.

Claims

1. A shooting method, characterized in that: The method comprises: In response to the target shooting mode switching instruction, partially enlarging the currently displayed first preview image to obtain a second preview image; In response to a focus operation on the second preview image, determining first position information of a first focus area indicated by the focus operation within the first preview image; Determining whether there is a second focus area in the second preview image, and the similarity between the image pixels in the second focus area and the image pixels in the first focus area meets a preset condition; If the second focus area exists in the second preview image, determining a jitter coefficient based on second position information of the second focus area in the first preview image and the first position information; Based on the jitter coefficient, performing jitter compensation on third position information of the second preview image in the first preview image to obtain fourth position information; A third preview image is obtained by partially enlarging an image area indicated by the fourth position information in the first preview image, and the third preview image is output.

2. The method according to claim 1, characterized in that: The determining whether there is a second focus area in the second preview image includes: Using a sliding window to slide in the second preview image to obtain a plurality of window images; wherein the window size of the sliding window is determined by the first focus area; and the position information of each window image in the second preview image is different; Determining a correlation coefficient between each image pixel of the window image and image pixels within the first focus area; Determining a maximum mutual correlation coefficient from the mutual correlation coefficients corresponding to the plurality of window images; According to whether the maximum mutual correlation coefficient is greater than a coefficient threshold, it is determined whether there is a second focus area in the second preview image; the second focus area is: a window image corresponding to the maximum mutual correlation coefficient greater than the coefficient threshold.

3. The method according to claim 1, characterized in that The method further comprises: Get the zoom ratio corresponding to the target shooting mode; determining an expansion parameter corresponding to the zoom ratio, wherein the expansion parameter is used to perform boundary expansion on an image area corresponding to the second preview image within the first preview image; Determining an expanded second preview image from the first preview image based on the expansion parameter and the third position information; The determining whether there is a second focus area in the second preview image includes: Determine whether a second focus area exists in the expanded second preview image.

4. The method according to claim 3, characterized in that The determining of the extended parameter corresponding to the zoom ratio includes: If the zoom ratio is greater than or equal to the first zoom threshold and less than the maximum zoom ratio, an extended parameter corresponding to the zoom ratio is determined; wherein the extended parameter corresponding to the zoom ratio is positively correlated with the zoom ratio.

5. The method according to claim 1, characterized in that The method further comprises: Get the zoom ratio corresponding to the target shooting mode; Determining a downsampling parameter corresponding to the zoom ratio; Based on the downsampling parameters, downsampling the second preview image and the first focus area respectively; The determining whether there is a second focus area in the second preview image includes: It is determined whether there is a second focus area in the second preview image after downsampling processing; and the similarity between the pixel points in the second focus area and the pixel points in the first focus area after downsampling processing meets a preset condition.

6. The method according to claim 5, characterized in that The determining of the downsampling parameter corresponding to the zoom ratio includes: If the zoom ratio is greater than or equal to a third zoom threshold and less than or equal to a maximum zoom ratio, determining that the downsampling rate corresponding to the zoom ratio is a minimum downsampling rate; If the zoom ratio is greater than or equal to the second zoom threshold and less than the third zoom threshold, the downsampling rate corresponding to the zoom ratio is negatively correlated with the zoom ratio.

7. The method according to claim 1, characterized in that The step of determining, in response to a focus operation on the second preview image, first position information of a first focus area indicated by the focus operation within the first preview image comprises: In response to a focus operation on the second preview image, determining fifth position information of the first focus area indicated by the focus operation in the second preview image; Obtaining the zoom ratio corresponding to the target shooting mode; The first position information of the first focus area in the first preview image is determined based on the zoom magnification, the fifth position information, and the third position information of the second preview image in the first preview image.

8. The method according to claim 1, characterized in that The method further comprises: If the second focus area does not exist in the second preview image, the second preview image is output.

9. A photographing device, characterized in that: include: A first determining module, configured to, in response to a target shooting mode switching instruction, partially amplify the currently displayed first preview image to obtain a second preview image; In response to a focus operation on the second preview image, determining first position information of a first focus area indicated by the focus operation within the first preview image; A second determination module is used to determine whether there is a second focus area in the second preview image, and the similarity between the image pixels in the second focus area and the image pixels in the first focus area meets a preset condition; a third determining module, configured to determine a jitter coefficient based on second position information of the second focus area in the first preview image and the first position information if the second focus area exists in the second preview image; a compensation module, configured to perform jitter compensation on third position information of the second preview image in the first preview image based on the jitter coefficient to obtain fourth position information; locally amplify an image area indicated by the fourth position information in the first preview image to obtain a third preview image, and output the third preview image.

10. An electronic device, characterized in that: include: processor; a memory for storing executable instructions; Wherein, the processor is configured to: implement the shooting method according to any one of claims 1 to 8 when executing the executable instructions stored in the memory. 11 . A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the shooting method according to any one of claims 1 to 8.