Photographing method, device, equipment, storage medium and computer program product
By cropping and edge pixel processing on single-frame images, the ghosting and ghosting problems when electronic devices take pictures of distant objects are solved, and image quality and clarity are improved.
Patent Information
- Application Number
- CN202410108122.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-25
- Publication Date
- 2025-07-25
AI Technical Summary
When a user photographs distant objects through an electronic device, the jitter of the handheld device or the object movement causes multiple frames of image displacement, resulting in ghosting and ghosting, and the image clarity is low.
In response to the photo instruction, a single frame image is acquired and cropped, the edge pixel points in the cropped image are determined, and the preview image with the preset photo size is determined based on the edge pixel points and the cropped image.
Improve image production efficiency, reduce the probability of ghosting and ghosting, and enhance image contour clarity and quality.
Smart Images

Figure CN120378744A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of photographing technologies, and in particular, to a photographing method, apparatus, device, storage medium, and computer program product. Background Art
[0002] Nowadays, more and more users like to record their wonderful moments by taking pictures. For example, a user takes pictures of distant objects through an electronic device. However, when the user obtains a distant object through the electronic device, due to reasons such as the shaking of the handheld electronic device or the movement of the object, there may be a large displacement between multiple frames of images captured, resulting in poor effects such as ghosting and double imaging in the image output after multi-frame fusion, and the image clarity is low. Summary of the Invention
[0003] To overcome the problems existing in the related art, the present disclosure provides a photographing method, apparatus, device, storage medium, and computer program product.
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided a photographing method, including:
[0005] In response to detecting a photographing instruction, obtain a single-frame image; wherein, the photographing instruction carries a zoom ratio, and the focal length indicated by the zoom ratio is greater than the focal length for collecting the single-frame image;
[0006] Crop the single-frame image to obtain a cropped image; wherein, the content of the cropped image corresponds to the content of the shooting area at the focal length indicated by the zoom ratio;
[0007] Determine edge pixel points in the cropped image;
[0008] Based on the edge pixel points and the cropped image, determine a preview image of a preset photographing size.
[0009] In some embodiments, the determining a preview image of a preset photographing size based on the edge pixel points and the cropped image includes:
[0010] Based on the edge pixel points, the cropped image, and the preset photographing size, determine target edge pixel points;
[0011] Based on the cropped image and the preset photographing size, determine non-edge pixel points other than the target edge pixel points;
[0012] Based on the target edge pixel points and the non-edge pixel points, determine the preview image.
[0013] In some embodiments, the determining target edge pixel points based on the edge pixel points, the cropped image, and the preset photographing size includes:
[0014] Based on the edge pixel points, a first contour expression is fitted; wherein, the first contour expression is used to characterize the edge information in the cropped image;
[0015] Based on the first contour expression, the cropped image, and the preset photographing size, the target edge pixel points are determined.
[0016] In some embodiments, the first contour expression includes a sub - contour expression corresponding to a first image block in the cropped image where there are edge pixel points;
[0017] The determining the target edge pixel points based on the first contour expression, the cropped image, and the preset photographing size includes:
[0018] Based on the size of the cropped image and the preset photographing size, an image scaling ratio is determined;
[0019] For each first image block, based on the image scaling ratio, the edge pixel points in the first image block, and the sub - contour expression corresponding to the first image block, sub - target edge pixel points corresponding to the first image block are determined; wherein, the sub - target edge pixel points corresponding to the first image block belong to the local edge pixel points in the preview image;
[0020] Based on the sub - target edge pixel points corresponding to all the first image blocks, the target edge pixel points are determined.
[0021] In some embodiments, the determining the sub - target edge pixel points corresponding to the first image block based on the image scaling ratio, the edge pixel points in the first image block, and the sub - contour expression corresponding to the first image block includes:
[0022] Determine the first coordinates after scaling the coordinates of each edge pixel point in the first image block in a first preset direction based on the image scaling ratio;
[0023] Based on the first coordinates corresponding to each edge pixel point and the sub - contour expression corresponding to the first image block, determine the second coordinates in a second preset direction corresponding to each edge pixel point;
[0024] Based on the first coordinates and the second coordinates corresponding to all the edge pixel points in the first image block, determine the coordinates of the sub - target edge pixel points corresponding to the first image block;
[0025] Interpolate the sub - target edge pixel points based on all the edge pixel points in the first image block to obtain the pixel values of the sub - target edge pixel points.
[0026] In some embodiments, the method further includes:
[0027] Divide the cropped image into regions to obtain multiple image blocks;
[0028] Determine a first image block among the multiple image blocks that has at least two edge pixel points;
[0029] For each first image block, fit a sub - contour expression based on the coordinates of at least two edge pixel points in the first image block.
[0030] In some embodiments, the fitting of the sub - contour expression based on the coordinates of at least two edge pixel points in the first image block includes:
[0031] Use a preset fitting function to fit fitting coefficients based on the coordinates of at least two edge pixel points in the first image block; wherein, the preset fitting function forms a sub - contour expression based on the fitting coefficients.
[0032] In some embodiments, determining non - edge pixel points other than the target edge pixel points based on the cropped image and the preset photographing size includes:
[0033] Determine a coordinate mapping relationship based on the size of the cropped image and the preset photographing size; wherein, the coordinate mapping relationship represents the mapping between the coordinates of pixel points in the cropped image and the coordinates of pixel points in the preview image;
[0034] Determine the coordinates of the non - edge pixel points based on the coordinates of the target edge pixel points and the preset photographing size;
[0035] Based on the coordinate mapping relationship, determine a first pixel point in the cropped image corresponding to the non - edge pixel point;
[0036] Interpolate the non - edge pixel points based on the first pixel point to obtain the pixel values of the non - edge pixel points.
[0037] In some embodiments, the method further includes:
[0038] Fit a second contour expression based on the target edge pixel points in the preview image; wherein, the second contour expression is used to represent the edge information in the preview image, and the second contour expression is used to assist in the scaling process of the preview image.
[0039] In some embodiments, the obtaining of a single - frame image in response to detecting a photographing instruction includes:
[0040] In response to detecting the photographing instruction, obtain a frame of image within a preset time range from the detection time of the photographing instruction as the single - frame image.
[0041] In some embodiments, the zoom ratio carried in the photographing instruction is greater than a preset ratio threshold.
[0042] According to a second aspect of the embodiments of the present disclosure, a photographing device is provided, the device includes:
[0043] An acquisition module, configured to acquire a single-frame image in response to detecting a photographing instruction; wherein, a zoom ratio is carried in the photographing instruction, and the focal length indicated by the zoom ratio is greater than the focal length for acquiring the single-frame image;
[0044] A cropping module, configured to crop the single-frame image to obtain a cropped image; wherein, the content of the cropped image corresponds to the content of the shooting area at the focal length indicated by the zoom ratio;
[0045] A first determination module, configured to determine edge pixel points in the cropped image;
[0046] An image processing module, configured to determine a preview image of a preset photographing size based on the edge pixel points and the cropped image.
[0047] In some embodiments, the image processing module is further configured to determine target edge pixel points based on the edge pixel points, the cropped image, and the preset photographing size; determine non-edge pixel points other than the target edge pixel points based on the cropped image and the preset photographing size; and determine the preview image based on the target edge pixel points and the non-edge pixel points.
[0048] In some embodiments, the image processing module is further configured to fit a first contour expression based on the edge pixel points; wherein, the first contour expression is used to characterize the edge information in the cropped image; and determine the target edge pixel points based on the first contour expression, the cropped image, and the preset photographing size.
[0049] In some embodiments, the first contour expression includes a sub-contour expression corresponding to a first image block in the cropped image where there are edge pixel points, and the image processing module is further configured to determine an image scaling ratio based on the size of the cropped image and the preset photographing size; for each first image block, determine sub-target edge pixel points of the first image block based on the image scaling ratio, the edge pixel points in the first image block, and the sub-contour expression corresponding to the first image block; wherein, the sub-target edge pixel points of the first image block belong to local edge pixel points in the preview image; and determine the target edge pixel points based on the sub-target edge pixel points corresponding to all the first image blocks.
[0050] In some embodiments, the image processing module is further configured to determine a first coordinate obtained by scaling the coordinate of each edge pixel point in the first preset direction in the first image block based on the image scaling ratio; determine a second coordinate of each edge pixel point in a second preset direction based on the first coordinate corresponding to each edge pixel point and the sub - contour expression corresponding to the first image block; determine the coordinates of the sub - target edge pixel points corresponding to the first image block based on the first coordinates and the second coordinates of all the edge pixel points in the first image block; and interpolate the sub - target edge pixel points based on all the edge pixel points in the first image block to obtain the pixel values of the sub - target edge pixel points.
[0051] In some embodiments, the apparatus further includes:
[0052] A partitioning module, configured to partition the cropped image into multiple image blocks;
[0053] A second determination module, configured to determine a first image block having at least two edge pixel points among the multiple image blocks;
[0054] A first fitting module, configured to, for each first image block, fit a sub - contour expression based on the coordinates of at least two edge pixel points in the first image block.
[0055] In some embodiments, the fitting module is further configured to obtain fitting coefficients by fitting based on the coordinates of at least two edge pixel points in the first image block using a preset fitting function; wherein the preset fitting function forms a sub - contour expression based on the fitting coefficients.
[0056] In some embodiments, the image processing module is further configured to determine a coordinate mapping relationship based on the size of the cropped image and a preset photographing size; wherein the coordinate mapping relationship represents the mapping between the coordinates of pixel points in the cropped image and the coordinates of pixel points in the preview image; determine the coordinates of non - edge pixel points based on the coordinates of the target edge pixel points and the preset photographing size; determine a first pixel point corresponding to the non - edge pixel point in the cropped image based on the coordinate mapping relationship; and interpolate the non - edge pixel points based on the first pixel point to obtain the pixel values of the non - edge pixel points.
[0057] In some embodiments, the apparatus further includes:
[0058] A second fitting module, configured to fit a second contour expression based on the target edge pixel points in the preview image; wherein the second contour expression is used to represent the edge information in the preview image, and the second contour expression is used to assist in the scaling process of the preview image.
[0059] In some embodiments, the obtaining module is further configured to obtain, in response to detecting the photographing instruction, a frame of image within a preset time range from the detection time of the photographing instruction as the single-frame image.
[0060] In some embodiments, the zoom ratio carried in the photographing instruction is greater than a preset magnification threshold.
[0061] According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, which includes:
[0062] A processor;
[0063] A memory for storing computer programs or instructions of the processor;
[0064] Wherein, the processor executes the computer program or instruction to implement the method described in the first aspect.
[0065] According to a fourth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, which stores computer programs or instructions, including:
[0066] When the computer program or instruction in the storage medium is executed by the processor, the method described in the first aspect is implemented.
[0067] According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product, including a computer program or instruction, wherein when the computer program or instruction is executed by the processor, the method described in the first aspect is implemented.
[0068] The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
[0069] In the embodiments of the present disclosure, the electronic device obtains a single-frame image in response to a photographing instruction, then crops the single-frame image to obtain a cropped image, determines the edge pixel points in the cropped image, and finally determines a preview image of a preset photographing size based on the edge pixel points and the cropped image. On the one hand, processing the single-frame image without performing difference or fusion on multiple frames of images can reduce the probability of ghosting and double imaging in the image while improving the image output efficiency, and improve the image quality; on the other hand, determining the preview image based on the edge pixel points can improve the contour clarity of the image and further improve the image quality.
[0070] It should be understood that the above general description and subsequent detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The accompanying drawings here are incorporated into the specification and form 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.
[0072] Figure 1 is a flowchart of a high-magnification scene photographing method in the related art.
[0073] Figure 2 is a flowchart of a photographing method shown according to an exemplary embodiment.
[0074] Figure 3 is a flowchart of a Canny edge detection method shown according to an exemplary embodiment.
[0075] Figure 4 is an example diagram of obtaining a single-frame image shown according to an exemplary embodiment.
[0076] Figure 5 is a schematic diagram of a photographing method shown according to an exemplary embodiment.
[0077] Figure 6 is a block diagram of a photographing device shown according to an exemplary embodiment.
[0078] Figure 7 is a block diagram of a structure of an electronic device shown according to an exemplary embodiment. Detailed Description of the Embodiments
[0079] Exemplary embodiments will be described in detail here, 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 and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0080] In the related art, there is a high-magnification scene photographing method based on a Super Resolution (SR) algorithm. Figure 1 is a flowchart of a high-magnification scene photographing method in the related art, as Figure 1As shown, after the user clicks to take a photo in a high-magnification scenario, the electronic device with a photo-taking function sends a YUV photo-taking request to the underlying layer. After receiving the photo-taking request, the underlying layer sets multiple-frame photo-taking requests and normal exposure information. The sensor collects images multiple times according to the normal exposure information and outputs multiple images with different exposure parameters, forming a set of exposure sequences. Then, through an Image Signal Processor (ISP), multiple YUV images are obtained, and multiple YUV images are fused based on the SR algorithm to output a high-definition image. Among them, the underlying layer refers to the hardware or software components in the electronic device responsible for processing camera functions, such as physical devices like the camera's sensor, lens, flash, etc., or the driver camera program and firmware layer, etc.; the exposure parameters include aperture speed, shutter speed, sensitivity, etc.; the SR algorithm means that after obtaining multiple images with clearer detail texture information by pixel difference between multiple images in the exposure sequence and the image that meets the normal exposure information, the information in multiple images is fused to obtain an image with higher quality.
[0081] In the above solution, multiple images with different exposure parameters are obtained by collecting images multiple times, and an image is synthesized based on the SR algorithm. When the user holds the device to take pictures of still or moving objects, since the sensor outputs images frame by frame, there is a situation of Field of view (FOV) offset in the multiple images obtained. And the SR algorithm needs to perform pixel difference on multiple images and then fuse them. Therefore, when the FOV offset is too large, the difference between adjacent images will be too large, resulting in less overlapping areas in image difference or fusion, reducing the accuracy of image difference or fusion, and thus reducing the quality of the output image; and if the user wants to improve the quality of the obtained image, a tripod or other fixing devices need to be used to fix the electronic device to improve the stability of the electronic device during shooting, thereby improving the quality of the output image, but this will greatly reduce the user experience.
[0082] In view of this, the embodiments of the present disclosure provide a photo-taking method. Figure 2 It is a flowchart of a photo-taking method shown according to an exemplary embodiment, as Figure 2 shown. The method mainly includes the following steps:
[0083] S11. In response to detecting a photo-taking instruction, obtain a single-frame image; wherein, the photo-taking instruction carries a zoom magnification, and the focal length indicated by the zoom magnification is greater than the focal length for collecting the single-frame image;
[0084] S12. Crop the single-frame image to obtain a cropped image; wherein, the content of the cropped image corresponds to the content of the shooting area under the focal length indicated by the zoom magnification;
[0085] S13. Determine the edge pixel points in the cropped image;
[0086] S14: Determine a preview image of a preset photographing size based on the edge pixels and the cropped image.
[0087] In the embodiments of the present disclosure, the photographing method can be applied to user equipment (UE), mobile devices, user terminals, mobile phones, tablet computers, personal digital assistants (PDAs), handheld devices, computing devices, vehicle-mounted devices, wearable devices, video cameras, camcorders, cameras, and other electronic devices with photographing or video recording functions. The photographing method of the embodiments of the present disclosure can be applied to digital zoom scenarios.
[0088] In step S11, the electronic device acquires a single frame image in response to detecting a photographing instruction. The photographing instruction may be a touch instruction detected by the electronic device, a voice instruction detected by the electronic device, or a gesture instruction detected by the electronic device; in some embodiments, the electronic device may be provided with an image acquisition component, and after detecting the photographing instruction, the electronic device acquires a single frame image through the image acquisition component, and the image acquisition component is, for example, a front camera or a rear camera.
[0089] In the disclosed embodiments, the single-frame image acquired by the electronic device may refer to the original image (RAW image) acquired by the image sensor, and the electronic device performs ISP processing on the RAW image to obtain and output a preview image. The single-frame image may be a full-size image, that is, an image corresponding to the maximum field of view angle range of the image acquisition component.
[0090] In the disclosed embodiment, the photographing instruction also carries a zoom ratio, wherein the zoom ratio refers to the multiple by which the electronic device can magnify or reduce the photographed object. The larger the zoom ratio, the larger the focal length, the farther the electronic device can shoot, and the less content in the photographed image. If the focal length indicated by the zoom ratio carried in the photographing instruction is greater than the focal length of the captured single-frame image, then the content of the photographing area corresponding to the focal length indicated by the zoom ratio carried in the photographing instruction belongs to part of the content in the single-frame image.
[0091] In step S12, the electronic device crops the single-frame image to obtain a cropped image, and the content of the cropped image corresponds to the content of the shooting area at the focal length indicated by the zoom ratio. The electronic device can compare the focal length indicated by the zoom ratio carried in the photographing instruction with the focal length when the electronic device captures the single-frame image, and crop the single-frame image to obtain a cropped image. For example, when the zoom ratio when the electronic device captures the single-frame image is 1, and the zoom ratio carried in the photographing instruction is 2, the electronic device can use the center of the single-frame image as a reference, and crop an image whose width and height are half of the width and height of the single-frame image as the cropped image.
[0092] In the embodiments of the present disclosure, the electronic device can also obtain the shooting target indicated in the shooting instruction, where the shooting target can be set by manual input. For example, the user is provided to select the desired shooting target in the shooting screen collected by the electronic device; the shooting target can also be automatically generated by the system program according to preset conditions. For example, the system program can automatically identify the shooting target in the shooting screen based on a preset algorithm. In addition, it can also be manually modified by the user after being automatically generated by the system program so that the shooting target meets the actual shooting requirements. The electronic device determines the cropped image after cropping a single-frame image based on the zoom ratio and the shooting target, so that the entire content of the shooting target is included in the cropped image.
[0093] In step S13, the electronic device determines the edge pixel points in the cropped image. The edge pixel points are located at positions where the pixel intensity changes rapidly in the image, usually corresponding to the object contour or texture boundary. In the embodiments of the present disclosure, the electronic device can determine the edge pixel points in the cropped image based on edge detection methods, such as morphological methods, edge detection operators, etc. Among them, the edge detection operator is, for example, the Roberts edge detection operator, the Sobel edge detection operator, the Laplacian edge detection operator, the Canny edge detection operator, etc.
[0094] In some embodiments, for example, the electronic device performs edge detection on the cropped image by the Canny edge detection method. Figure 3 is a flowchart of the Canny edge detection method shown according to an exemplary embodiment. Figure 3As shown, the electronic device first grayscales the cropped image, that is, converts the cropped image into a grayscale image. Among them, the electronic device can grayscale the cropped image based on the maximum value method, the average value method, or the weighted mean method. Then, it performs Gaussian filtering on the grayscale image. Since edge detection is easily affected by noise, using a Gaussian filter to remove noise can smooth the image and reduce the impact of noise on edge detection. The electronic device then uses methods such as the energy gradient function, the Roberts function, and the Sobel function to calculate the image gradient and direction on the smoothed image, that is, to determine the grayscale value change rate of each pixel point in the image, so as to find the edge pixel points of the image. After obtaining the direction and magnitude of the image gradient, the electronic device also needs to scan the cropped image based on the non-maximum suppression method to remove the pixel points at non-edge positions. That is, the electronic device determines whether the gradient of each pixel point is the maximum among the pixel points with the same gradient direction around it. If the gradient of the pixel point is the maximum among the pixel points with the same gradient direction around it, the pixel point is retained; otherwise, the pixel point is smoothed, thereby making the blurred edge clear. Finally, the electronic device uses the double-threshold algorithm to determine the final edge pixel points, that is, sets two thresholds, a high threshold and a low threshold, and determines whether the pixel value of each pixel point in the cropped image exceeds the high threshold. If it does, the pixel point is retained as an edge pixel point; if the pixel value is less than the low threshold, the pixel point is smoothed; if the pixel value is between the two, the pixel point is retained when connected to a pixel point higher than the high threshold, otherwise it is smoothed, which can further remove false edges and obtain more accurate edge pixel points.
[0095] In step S14, the electronic device determines a preview image of a preset photographing size based on the edge pixel points in the cropped image and the cropped image. Among them, the photographing instruction may carry a preset photographing size, and the preset photographing size determines the number of pixel points in the image. The preset photographing size can be determined based on the proportional relationship set by the user. For example, when the proportional relationship set by the user is 16:9, the preset photographing size can be 1920*1080 pixels; when the proportional relationship set by the user is 4:3, the preset photographing size can be 1280*960 pixels. In addition, the preset photographing size can also be determined by the electronic device according to the current shooting scene and the size of the image sensor, etc., and the embodiments of the present disclosure do not limit this.
[0096] In some embodiments, the electronic device can determine the edge pixel points in the preview image based on the positions of the edge pixel points in the cropped image in the cropped image and the relationship between the size of the cropped image and the preset photographing size, and then determine the pixel points other than the edge pixel points, thereby determining the preview image.
[0097] In some other embodiments, the function expression for characterizing the edge shape in the cropped image may be determined based on the coordinates of the edge pixel points of the cropped image first, and then the edge pixel points in the preview image may be determined based on the expression and the relationship between the size of the cropped image and the preset photographing size, and then the pixel points other than the edge pixel points may be determined to determine the preview image.
[0098] In the embodiments of the present disclosure, the electronic device obtains a single-frame image in response to a photographing instruction, then crops the single-frame image to obtain a cropped image, determines the edge pixel points in the cropped image, and finally determines a preview image of the preset photographing size based on the edge pixel points and the cropped image. On the one hand, by processing the single-frame image, there is no need to perform differential or fusion on multiple frames of images, which can reduce the probability of ghosting and double imaging in the image while improving the image output efficiency and improve the image quality; on the other hand, by determining the preview image based on the edge pixel points, the contour clarity of the image can be improved, further improving the image quality.
[0099] In some embodiments, the determining the preview image of the preset photographing size based on the edge pixel points and the cropped image includes:
[0100] Determining target edge pixel points based on the edge pixel points, the cropped image, and the preset photographing size;
[0101] Determining non-edge pixel points other than the target edge pixel points based on the cropped image and the preset photographing size;
[0102] Determining the preview image based on the target edge pixel points and the non-edge pixel points.
[0103] In the embodiments of the present disclosure, the electronic device determines target edge pixel points based on the edge pixel points in the cropped image, the cropped image, and the preset photographing size; in some embodiments, the electronic device obtains the edge pixel points of the cropped image and determines the target edge pixel points corresponding to the edge pixel points of the cropped image based on the relationship between the size of the cropped image and the preset photographing size.
[0104] In some other embodiments, the electronic device determines an expression that can characterize the edge information based on the edge pixel points in the cropped image, and then determines the target edge pixel points based on the edge pixel points in the cropped image, the expression characterizing the edge information, and the relationship between the size of the cropped image and the preset photographing size.
[0105] In the embodiments of the present disclosure, after determining the target edge pixel points, the electronic device also needs to determine the non-edge pixel points outside the target edge pixel points. In some embodiments, the electronic device can obtain the coordinates and pixel values of the pixel points outside the edge pixel points in the cropped image, and determine the coordinates and pixel values of the non-edge pixel points outside the target edge pixel points corresponding to the cropped image based on the relationship between the size of the cropped image and the preset photographing size.
[0106] In other embodiments, the electronic device can use the determined target edge pixel points to guide the interpolation of non-target edge pixel points based on the relationship between the size of the cropped image and the preset photographing size and the cropped image, so as to obtain the non-edge pixel points outside the target edge pixel points.
[0107] In the embodiments of the present disclosure, after the electronic device determines the target edge pixel points and the non-edge pixel points outside the target edge pixel points, it can determine all the pixel points in the preview image, thereby determining the preview image.
[0108] In the embodiments of the present disclosure, the electronic device separately determines the target edge pixel points and other pixel points in the preview image, which can specifically determine the pixel points based on whether they are edge information, improve the accuracy of the pixel points, and thus improve the image quality.
[0109] In some embodiments, determining the target edge pixel points based on the edge pixel points, the cropped image, and the preset photographing size includes:
[0110] Based on the edge pixel points, a first contour expression is fitted; wherein, the first contour expression is used to characterize the edge information in the cropped image;
[0111] Based on the first contour expression, the cropped image, and the preset photographing size, the target edge pixel points are determined.
[0112] In the embodiments of the present disclosure, the electronic device fits a first contour expression that characterizes the edge information in the cropped image based on the edge pixel points in the cropped image. The first contour expression characterizes the coordinate mapping of the edge pixel points in the cropped image in different coordinate directions. For example, based on the coordinates of the edge pixel points in the cropped image in the first preset direction and the first contour expression, the coordinates of the edge pixel points in the second preset direction can be mapped, and the first contour expression can reflect the shape of the edge formed by the edge pixel points. In some embodiments, the electronic device can set a preset function, obtain the coordinates of the edge pixel points in the cropped image, and fit the preset function according to the coordinates to determine the first contour expression, where the preset function can be a linear function, a quadratic function, an exponential function, or other functions.
[0113] In some other embodiments, the electronic device may first divide the cropped image into multiple image blocks, and based on the coordinates of the edge pixel points in each image block having edge pixel points, fit an expression representing the edge shape of the image block, and determine a first contour expression based on the expressions of all the image blocks including edge pixel points in the cropped image.
[0114] In the embodiments of the present disclosure, as described above, the electronic device can obtain the edge pixel points in the cropped image. The electronic device may first, according to the edge pixel points in the cropped image and the relationship between the size of the cropped image and the preset photographing size, select a suitable interpolation direction and weight based on the edge shape reflected by the first contour expression and the edge direction indicated by the edge shape to obtain target edge pixel points.
[0115] In some embodiments, the electronic device may also determine the coordinate of the target edge pixel point corresponding to the edge pixel point of the cropped image in one coordinate direction (such as the x coordinate or the y coordinate) based on the coordinates of the edge pixel points of the cropped image and the relationship between the size of the cropped image and the preset photographing size, then determine the coordinate of the target edge pixel point in the other coordinate direction based on the first contour expression, and then perform interpolation on the target edge pixel point based on the mapping between the coordinates of the edge pixel points in the cropped image and the coordinates of the target edge pixel point and the pixel values of the edge pixel points in the cropped image to obtain the pixel value of the target edge pixel point.
[0116] In the embodiments of the present disclosure, the electronic device first determines the first contour expression representing the edge information in the cropped image, and then determines the target edge pixel point based on the first contour expression, which can improve the accuracy of obtaining the target edge pixel point, improve the clarity of the contour in the preview image, reduce adverse effects such as jaggedness of the contour, and thus improve the image quality of the preview image.
[0117] In some embodiments, the first contour expression includes a sub - contour expression corresponding to a first image block having edge pixel points in the cropped image;
[0118] Determining the target edge pixel point based on the first contour expression, the cropped image, and the preset photographing size includes:
[0119] Determine an image scaling ratio based on the size of the cropped image and the preset photographing size;
[0120] For each first image block, determine the sub - target edge pixel point corresponding to the first image block based on the image scaling ratio, the edge pixel points in the first image block, and the sub - contour expression corresponding to the first image block; wherein, the sub - target edge pixel point corresponding to the first image block belongs to the local edge pixel points in the preview image;
[0121] Determine the target edge pixels based on the sub-target edge pixels corresponding to all the first image blocks.
[0122] In the embodiments of the present disclosure, as described above, the electronic device can divide the cropped image into multiple image blocks, where each image block includes at least one pixel. The electronic device can determine whether the pixels in the image block are edge pixels, and determine the sub-profile expression corresponding to the first image block with edge pixels, where the sub-profile expression characterizes the edge information in the first image block.
[0123] In the embodiments of the present disclosure, the electronic device determines an image scaling ratio based on the size of the cropped image and a preset photographing size. For example, when the size of the cropped image is 2000*2000 and the preset photographing size is 1000*1000, the image scaling ratio is 25%.
[0124] In the embodiments of the present disclosure, for each first image block with edge pixels in the cropped image, the electronic device can determine the sub-target edge pixels corresponding to the first image block based on the image scaling ratio. It should be noted that the sub-target edge pixels belong to the local edge pixels in the preview image.
[0125] Among them, when the electronic device determines the sub-target edge pixels corresponding to the first image block, according to the principle described above, the electronic device can obtain the edge pixels in the first image block of the cropped image, and based on the edge pixels in the first image block and the image scaling ratio, select an appropriate interpolation direction and weight according to the edge shape characterized by the sub-profile expression corresponding to the first image block and the edge direction indicated by the edge shape to obtain the sub-target edge pixels.
[0126] In some embodiments, the electronic device can first determine the coordinates of the sub-target edge pixels in one coordinate direction, then determine the coordinates of the sub-target edge pixels in the other coordinate direction based on the sub-profile expression, and then perform interpolation on the sub-target edge pixels based on the mapping between the coordinates of the edge pixels in the first image block and the coordinates of the sub-target edge pixels and the pixel values of the edge pixels in the first image block to obtain the pixel values of the sub-target edge pixels.
[0127] In the embodiments of the present disclosure, by determining the sub-profile expression corresponding to the first image block with edge pixels in the cropped image, and for each first image block, determining the sub-target edge pixels corresponding to the first image block based on the image scaling ratio, the edge pixels in the first image block, and the sub-profile expression corresponding to the first image block, and finally determining the target edge pixels based on the sub-target edge pixels corresponding to all the first image blocks, the edge information in the preview image can be determined more carefully, and the contour of the preview image can be outlined better.
[0128] In some embodiments, determining the sub-target edge pixel points corresponding to the first image block based on the image scaling ratio, the edge pixel points in the first image block, and the sub-contour expression corresponding to the first image block includes:
[0129] Determining a first coordinate after scaling the coordinate of each edge pixel point in the first image block in a first preset direction based on the image scaling ratio;
[0130] Based on the first coordinate corresponding to each edge pixel point and the sub-contour expression corresponding to the first image block, determining a second coordinate of each edge pixel point in a second preset direction;
[0131] Based on the first coordinates and second coordinates corresponding to all the edge pixel points in the first image block, determining the coordinates of the sub-target edge pixel points corresponding to the first image block;
[0132] Interpolating the sub-target edge pixel points based on all the edge pixel points in the first image block to obtain the pixel values of the sub-target edge pixel points.
[0133] In the embodiments of the present disclosure, the electronic device can determine a first coordinate after scaling the coordinate of each edge pixel point in the first image block in a first preset direction based on the image scaling ratio. For example, when the image scaling ratio is 125% and the first preset direction is the x direction, if the coordinate value of the edge pixel point in the x direction in the first image block is 960, then the first coordinate value after scaling this coordinate based on a ratio of 125% is 768.
[0134] In the embodiments of the present disclosure, the electronic device determines the second coordinate of each edge pixel point in a second preset direction based on the first coordinate corresponding to each edge pixel point and the sub-contour expression corresponding to the first image block. Since the first coordinate of the corresponding edge pixel point in the first preset direction is known, the first coordinate can be substituted into the sub-contour expression to determine the second coordinate of the edge pixel point in the second preset direction. For example, if the sub-contour expression of this first image block is y = x, and the obtained x value based on the above calculation is 768, then the corresponding y value is 768, and the second coordinate is 768.
[0135] In the embodiments of the present disclosure, after obtaining the first coordinate and the second coordinate corresponding to the edge pixel point, the coordinates of the sub-target edge pixel points corresponding to the first image block can be determined. For example, when the first coordinate is 768 and the second coordinate is 768, the coordinates of the sub-target edge pixel points are (768, 768).
[0136] In an embodiment of the present disclosure, after determining the coordinates of the sub-target edge pixel points, interpolation can be performed on the sub-target edge pixel points based on the pixel values and coordinates of the edge pixel points in the first image block to obtain the pixel values of the sub-target edge pixel points. Among them, the electronic device can perform interpolation on the sub-target edge pixel points based on methods such as the nearest neighbor interpolation method, the bilinear interpolation method, and the bicubic interpolation method. For example, when the electronic device uses the nearest neighbor interpolation method to perform interpolation on the sub-target edge pixel points, it can first determine, based on the coordinates of the sub-target edge pixel points and the image scaling ratio, the edge pixel point that is closest to the pixel point corresponding to the sub-target edge pixel point in the first image block of the cropped image, and assign the pixel value of this edge pixel point to the sub-target edge pixel point.
[0137] In an embodiment of the present disclosure, first, determine the first coordinates after scaling the coordinates of the edge pixel points in the first image block in the first preset direction based on the image scaling ratio, and then, based on the sub-contour expression, determine the second coordinates in the second preset direction corresponding to the edge pixel points, thereby forming the coordinates of the sub-target edge pixel points. Finally, perform interpolation on the sub-target edge pixel points based on the edge pixel points of the first image block to obtain the pixel values of the sub-target edge pixel points, which can improve the clarity and coherence of the target image, thereby improving the image quality.
[0138] In some embodiments, the method further includes:
[0139] Perform regional division on the cropped image to obtain a plurality of image blocks;
[0140] Determine the first image blocks among the plurality of image blocks that have at least two edge pixel points;
[0141] For each first image block, fit a sub-contour expression based on the coordinates of at least two edge pixel points in the first image block.
[0142] In an embodiment of the present disclosure, as described above, the electronic device can perform regional division on the cropped image to obtain a plurality of image blocks. Among them, the number of image blocks can be set according to the size of the cropped image and / or the image content of the cropped image, or the number of image blocks can also be the default value of the electronic device. In this regard, the embodiments of the present disclosure do not make any limitations.
[0143] In an embodiment of the present disclosure, the electronic device determines the first image blocks among the plurality of image blocks that have at least two edge pixel points, and for each first image block, fits a sub-contour expression based on the coordinates of at least two edge pixel points in the first image block.
[0144] In some embodiments, the fitting of the sub-contour expression based on the coordinates of at least two edge pixel points in the first image block includes:
[0145] Fitting coefficients are obtained by fitting based on the coordinates of at least two edge pixel points in the first image block; wherein, the preset fitting function forms a sub-profile expression based on the fitting coefficients.
[0146] In the embodiments of the present disclosure, as described above, the electronic device can set a preset fitting function and obtain the fitting coefficients of the preset fitting function based on the coordinates of the edge pixel points in the first image block. Among them, the preset fitting function can be a linear function, a quadratic function, an exponential function, etc. In this regard, the embodiments of the present disclosure do not make limitations. When the preset fitting function is a quadratic function, since the first image block includes at least two edge pixel points, the coefficients of the quadratic function can be determined based on the coordinates of these two edge pixel points, that is, the sub-profile expression of the first image block is determined. In the embodiments of the present disclosure, the coefficients of the preset fitting function are determined through the coordinates of the edge pixel points, and then the sub-profile expression is determined. The method is simple and effective, easy to implement, and has high intelligence.
[0147] In the embodiments of the present disclosure, the method of fitting and determining the sub-profile expression based on at least two edge pixel points can improve the accuracy of the sub-profile expression with less computational effort, thereby improving the accuracy of determining the edge pixel points.
[0148] In some embodiments, the determining the non-edge pixel points other than the target edge pixel points based on the cropped image and the preset photographing size includes:
[0149] Determining a coordinate mapping relationship based on the size of the cropped image and the preset photographing size; wherein, the coordinate mapping relationship represents the mapping between the coordinates of the pixel points in the cropped image and the coordinates of the pixel points in the preview image;
[0150] Determining the coordinates of the non-edge pixel points based on the coordinates of the target edge pixel points and the preset photographing size;
[0151] Determining a first pixel point corresponding to the non-edge pixel point in the cropped image based on the coordinate mapping relationship;
[0152] Interpolating the non-edge pixel points based on the first pixel point to obtain the pixel values of the non-edge pixel points.
[0153] In the embodiments of the present disclosure, as described above, the electronic device can determine the image scaling ratio based on the size of the cropped image and the preset photographing size. The electronic device determines the coordinate mapping relationship between the pixel points in the preview image and the pixel points in the cropped image based on the scaling ratio. For example, when the image scaling ratio is 125%, the pixel point coordinates of the preview image are 0.8 times the pixel point coordinates of the cropped image.
[0154] In addition, since the preset photographing size and the coordinates of the target edge pixel points are known, the electronic device can determine the coordinates of the non-edge pixel points. In the embodiments of the present disclosure, based on the coordinate mapping relationship, the electronic device can determine the first pixel point corresponding to the non-edge pixel point in the cropped image, so as to interpolate the non-edge pixel point by using the first pixel point corresponding to the non-edge pixel point in the cropped image. For example, when the image scaling ratio is 125%, the coordinates of the non-edge pixel point (768, 432) correspond to the coordinates of the first pixel point (960, 540) in the cropped image. The electronic device can interpolate the non-edge pixel point based on the pixel value of the first pixel point in the cropped image and / or the pixel values of the pixel points near the first pixel point, so as to obtain the pixel value of the non-edge pixel point.
[0155] It should be noted that in the embodiments of the present disclosure, for each non-edge pixel point other than the target edge pixel point, the above method can be used for interpolation. For example, the electronic device can use the bilinear interpolation method. For each non-edge pixel point other than the target edge pixel point, the electronic device can first determine four adjacent pixel points (usually the pixel points above, below, left, and right of the pixel point) of the first pixel point corresponding to it in the cropped image, and perform linear interpolation calculation according to the pixel values of these four pixel points to obtain the pixel value of each non-edge pixel point other than the target edge pixel point.
[0156] In the embodiments of the present disclosure, based on the coordinate mapping relationship, the first pixel point corresponding to each non-edge pixel point other than the target edge pixel point in the cropped image is determined, and interpolation filling is performed to obtain the non-edge pixel points other than the target edge pixel points representing the contour, so as to obtain a complete image, which can restore the image pixel point information to the greatest extent, improve the image restoration degree, and improve the image clarity through the interpolation method.
[0157] In some embodiments, the method further includes:
[0158] Based on the target edge pixel points in the preview image, a second contour expression is fitted; wherein, the second contour expression is used to represent the edge information in the preview image, and the second contour expression is used to assist in the scaling process of the preview image.
[0159] In the embodiments of the present disclosure, after the electronic device determines the preview image, it can also perform a scaling process on the preview image based on the detected scaling instruction for the preview image. For example, when the electronic device detects a reduction instruction for the preview image, it performs downsampling on the preview image based on the image size indicated in the reduction instruction, so as to obtain a reduced target image. In some embodiments, the electronic device can directly perform downsampling processing on the preview image based on the size of the preview image and the image size indicated in the reduction instruction.
[0160] In an embodiment of the present disclosure, the electronic device fits a second contour expression based on target edge pixel points in a preview image. In some embodiments, the electronic device may first determine a preset fitting function and the coordinates of the target edge pixel points in the preview image, and use the coordinates of the target edge pixel points to determine the coefficients of the preset fitting function based on the preset fitting function. The second contour expression is obtained by fitting the preset fitting function based on the corresponding coefficients. The second contour expression is used to characterize the edge information in the preview image. Among them, the second contour expression characterizes the coordinate mapping of the target edge pixel points in the preview image in different coordinate directions. For example, based on the coordinates of the target edge pixel points in the preview image in the first preset direction and the second contour expression, the coordinates of the target edge pixel points in the second preset direction can be mapped. The second contour expression can reflect the shape of the edge formed by the target edge pixel points.
[0161] In other embodiments, the electronic device may divide the preview image into multiple image blocks, fit a second sub - contour expression corresponding to the image block including the target edge pixel points, and determine the second contour expression based on the second sub - contour expressions of each image block.
[0162] In an embodiment of the present disclosure, the second contour expression is used to assist in the scaling process of the preview image. After the electronic device obtains the second contour expression characterizing the target edge information of the preview image, it can perform a scaling process on the image based on the second contour expression. Among them, performing a scaling process on the image includes cropping the preview image to obtain a target image, enlarging the preview image, reducing the preview image, etc. For example, when the electronic device enlarges the preview image based on the second contour expression, it can first determine the relationship between the size of the enlarged image and the size of the preview image, determine the image scaling ratio, and then determine the coordinates of the edge pixel points of the enlarged image based on the image scaling ratio and the coordinates of the target edge pixel points in the preview image, determine the pixel values of the edge pixel points of the enlarged image based on the pixel values of the target edge pixel points in the preview image, so as to determine the edge contour information of the image after the method, and then determine the information of the pixel points other than the edge pixel points in the enlarged image according to the interpolation method, and further determine all the image contents of the enlarged image.
[0163] In an embodiment of the present disclosure, by determining a second contour expression for assisting in the scaling process of the preview image based on the target edge pixel points in the preview image, it is possible for the user to still perform scaling editing on the image after obtaining the preview image. And based on the second contour expression, it is possible to improve the contour clarity of the image after scaling and editing the preview image, thereby improving the image quality and also improving the user's interaction experience.
[0164] In some embodiments, the obtaining a single - frame image in response to detecting a photographing instruction includes:
[0165] In response to detecting the photographing instruction, obtain a frame of image within a preset time range from the detection time of the photographing instruction as the single-frame image.
[0166] In the embodiments of the present disclosure, in response to detecting a photographing instruction, the image acquisition component may first generate a preview cache frame queue including multiple frames of images. It should be noted that the images in the preview cache frame queue here are not the preview images in the embodiments of the present disclosure. The electronic device may, based on the acquisition time of each image in the preview cache frame queue, select a frame of image within a preset time range from the detection time of the photographing instruction as the single-frame image. Among them, the detection time of the photographing instruction is the time when the electronic device detects the photographing instruction, such as the time when the electronic device detects the shutter button, or the time when the electronic device detects a voice instruction indicating photographing, or the time when the electronic device detects a click operation on a virtual control indicating photographing. In this regard, the embodiments of the present disclosure do not make any restrictions. In the embodiments of the present disclosure, the electronic device selects a frame of image within a preset time range from the detection time of the photographing instruction as the single-frame image. For example, it may select the image corresponding to the acquisition time closest to the detection time of the photographing instruction.
[0167] Figure 4 is an example diagram of obtaining a single-frame image shown according to an exemplary embodiment, as Figure 4 shown, where M1 to M10 identify the images in the preview cache frame queue generated by the image acquisition component. The single-frame high-magnification algorithm is the photographing method. Since M4 is the image closest to the photographing time, M4 is selected as the single-frame image to perform the photographing method of the embodiments of the present disclosure.
[0168] In the embodiments of the present disclosure, determining the single-frame image according to the photographing time and then processing the single-frame image can make the single-frame image the image that the user most wants, and can improve the user experience after outputting the preview image.
[0169] In some embodiments, the zoom ratio carried in the photographing instruction is greater than a preset magnification threshold.
[0170] In the embodiments of the present disclosure, the zoom ratio carried in the photographing instruction being greater than the preset magnification threshold indicates that the electronic device is shooting in a high-magnification scenario at this time, such as when the electronic device is shooting in scenarios with high zoom ratios such as 10 times, 20 times, 30 times, etc.
[0171] Figure 5 is a schematic diagram of a photographing method shown according to an exemplary embodiment, as Figure 5As shown in the figure, it includes the following processes: In L51, after the user clicks to take a photo in a high magnification scenario, the electronic device can detect the touch instruction for taking a photo, that is, the electronic device detects the photo-taking instruction. After the electronic device detects the photo-taking instruction, the application layer sends a photo-taking request to the underlying layer. Here, the underlying layer includes the hardware or software components in the electronic device responsible for the photo-taking function, such as physical devices like the camera's sensor, lens, flash, etc., or the driver camera program and firmware layer. As shown in L52, the underlying layer receives the photo-taking request sent by the application layer and sets a single-frame photo-taking request and photo-taking request parameters based on the photo-taking request in L53. The photo-taking request parameters at least include the zoom magnification. In L54, the sensor outputs the original image, that is, obtains the single-frame image of the embodiment of the present disclosure. After the electronic device obtains the original image, it performs image signal processing on the original image in L55, such as denoising processing, black level correction, etc. Then in L56, it executes the single-frame high magnification algorithm based on the steps included in S12 to S14 of the foregoing embodiment of the present disclosure. Finally, in L57, it outputs a high-definition high magnification image and vector matrix data. Here, the high-definition high magnification image is the preview image, and the vector matrix data is the first contour expression of the embodiment of the present disclosure.
[0172] The following table shows the data comparison of the images obtained by the photo-taking method based on the embodiment of the present disclosure and the images obtained by the SR photo-taking scheme in the related art:
[0173]
[0174] Among them, the image acquisition time corresponding to the photo-taking method of the embodiment of the present disclosure is the time for acquiring a single-frame image. Since the embodiment of the present disclosure reduces the number of acquired images compared to the SR photo-taking scheme, it can improve the speed of obtaining the preview image after taking a photo and enhance the user experience.
[0175] In the embodiment of the present disclosure, the electronic device obtains a single-frame image (i.e., the original image) based on a single-frame photo-taking request, and then performs a single-frame high magnification algorithm on the single-frame image to output a high-definition high magnification image and the corresponding vector matrix data. On the one hand, by processing the single-frame image without performing differential or fusion on multiple frames of images, it can reduce the probability of ghosting and double imaging in the image while improving the image output efficiency, and improve the image quality. On the other hand, by determining the high-definition high magnification image based on the single-frame high magnification algorithm, it can improve the contour clarity of the image and further improve the image quality.
[0176] It should be noted that in the above method of the specific implementation manner, the writing order of each step does not mean a strict execution order and does not constitute any limitation to the implementation process. The specific execution order of each step should be determined according to its function and possible internal logic.
[0177] Figure 6 is a block diagram of a photo-taking device shown according to an exemplary embodiment, asFigure 6 As shown, the device mainly includes:
[0178] An acquisition module 601, configured to acquire a single-frame image in response to detecting a photographing instruction; wherein, the photographing instruction carries a zoom ratio, and the focal length indicated by the zoom ratio is greater than the focal length for acquiring the single-frame image;
[0179] A cropping module 602, configured to crop the single-frame image to obtain a cropped image; wherein, the content of the cropped image corresponds to the content of the shooting area at the focal length indicated by the zoom ratio;
[0180] A first determination module 603, configured to determine edge pixel points in the cropped image;
[0181] An image processing module 604, configured to determine a preview image of a preset photographing size based on the edge pixel points and the cropped image.
[0182] In some embodiments, the image processing module 604 is further configured to determine target edge pixel points based on the edge pixel points, the cropped image, and the preset photographing size; determine non-edge pixel points other than the target edge pixel points based on the cropped image and the preset photographing size; and determine the preview image based on the target edge pixel points and the non-edge pixel points.
[0183] In some embodiments, the image processing module 604 is further configured to fit a first contour expression based on the edge pixel points; wherein, the first contour expression is used to characterize the edge information in the cropped image; and determine the target edge pixel points based on the first contour expression, the cropped image, and the preset photographing size.
[0184] In some embodiments, the first contour expression includes a sub-contour expression corresponding to a first image block in the cropped image where there are edge pixel points. The image processing module 604 is further configured to determine an image scaling ratio based on the size of the cropped image and the preset photographing size; for each first image block, determine sub-target edge pixel points corresponding to the first image block based on the image scaling ratio, the edge pixel points in the first image block, and the sub-contour expression corresponding to the first image block; wherein, the sub-target edge pixel points corresponding to the first image block belong to the local edge pixel points in the preview image; and determine the target edge pixel points based on all the sub-target edge pixel points corresponding to the first image blocks.
[0185] In some embodiments, the image processing module 604 is further configured to determine a first coordinate obtained by scaling the coordinate of each edge pixel point in the first preset direction in the first image block based on the image scaling ratio; determine a second coordinate of each edge pixel point in the second preset direction based on the first coordinate corresponding to each edge pixel point and the sub - contour expression corresponding to the first image block; determine the coordinates of the sub - target edge pixel points corresponding to the first image block based on the first coordinates and the second coordinates of all the edge pixel points in the first image block; and interpolate the sub - target edge pixel points based on all the edge pixel points in the first image block to obtain the pixel values of the sub - target edge pixel points.
[0186] In some embodiments, the apparatus further includes:
[0187] A partitioning module, configured to partition the cropped image into multiple image blocks;
[0188] A second determination module, configured to determine a first image block in which there are at least two edge pixel points among the multiple image blocks;
[0189] A first fitting module, configured to, for each first image block, fit a sub - contour expression based on the coordinates of at least two edge pixel points in the first image block.
[0190] In some embodiments, the fitting module is further configured to obtain fitting coefficients by fitting based on the coordinates of at least two edge pixel points in the first image block using a preset fitting function; wherein the preset fitting function forms a sub - contour expression based on the fitting coefficients.
[0191] In some embodiments, the image processing module 604 is further configured to determine a coordinate mapping relationship based on the size of the cropped image and a preset photographing size; wherein the coordinate mapping relationship represents the mapping between the coordinates of pixel points in the cropped image and the coordinates of pixel points in the preview image; determine the coordinates of the non - edge pixel points based on the coordinates of the target edge pixel points and the preset photographing size; determine the first pixel points corresponding to the non - edge pixel points in the cropped image based on the coordinate mapping relationship; and interpolate the non - edge pixel points based on the first pixel points to obtain the pixel values of the non - edge pixel points.
[0192] In some embodiments, the apparatus further includes:
[0193] A second fitting module, configured to fit a second contour expression based on the target edge pixel points in the preview image; wherein the second contour expression is used to represent the edge information in the preview image, and the second contour expression is used to assist in the scaling process of the preview image.
[0194] In some embodiments, the obtaining module 601 is further configured to, in response to detecting the photographing instruction, obtain a frame of image within a preset time range from the detection time of the photographing instruction as the single-frame image.
[0195] In some embodiments, the zoom ratio carried in the photographing instruction is greater than a preset magnification threshold.
[0196] Regarding Figure 6 For the device in the illustrated embodiment, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0197] Figure 7 FIG. is a block diagram of an electronic device 700 shown according to an exemplary embodiment. For example, the electronic device 700 may be a smart phone, a computer, a game console, a tablet device, a medical device, a personal digital assistant, a wearable device, a camera, a video camera, a camera, etc.
[0198] Referring to Figure 7 , the electronic device 700 may include one or more of the following components: a processing component 702, a memory 704, a power supply 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.
[0199] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with at least one of display, telephone call, data communication, camera operation, and recording operation. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0200] The memory 704 is configured to store various types of data to support the operations on the electronic device 700. Examples of such data include at least one of the following: instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, and videos. The memory 704 can 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.
[0201] The power supply component 706 provides power to various components of the electronic device 700. The power supply component 706 can include at least one of the following: a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 700.
[0202] The multimedia component 708 includes a screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the screen can 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 touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating 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 focal length and optical zoom capabilities.
[0203] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC). When the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive external audio signals. The received audio signals can 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.
[0204] The I / O interface 712 provides an interface between the processing component 702 and a peripheral interface module, and the peripheral interface module may be a keyboard, a click wheel, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a power button, and a lock button.
[0205] The sensor component 714 includes one or more sensors for providing status assessments of various aspects of the electronic device 700. For example, the sensor component 714 can detect the on / off state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700. The sensor component 714 can also detect a change in the position of the electronic device 700 or a component in the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor component 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 714 may also include a light sensor, such as a complementary metal oxide semiconductor (CMOS) or a charge coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor component 714 may further include at least one of the following, but is not limited to: an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, and a temperature sensor.
[0206] The communication component 716 is configured to facilitate communication between the electronic device 700 and other devices in a wired or wireless manner. The electronic device 700 can access a communication standard-based wireless network, such as Wi-Fi, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 716 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 716 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 Wide Band (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0207] In an exemplary embodiment, the electronic device 700 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.
[0208] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including executable instructions or a computer program, and the above instructions or computer program can be executed by a processor 720 of the electronic device 700 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0209] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute any one of the above-mentioned photographing methods in the embodiments of the present disclosure. For example, the method includes:
[0210] In response to detecting a photographing instruction, obtain a single-frame image; wherein, the photographing instruction carries a zoom ratio, and the focal length indicated by the zoom ratio is greater than the focal length for collecting the single-frame image;
[0211] Crop the single-frame image to obtain a cropped image; wherein, the content of the cropped image corresponds to the content of the shooting area at the focal length indicated by the zoom ratio;
[0212] Determine the edge pixel points in the cropped image;
[0213] Based on the edge pixel points and the cropped image, determine a preview image of a preset photographing size.
[0214] An embodiment of the present disclosure provides a computer program product, which includes: a computer program or executable instructions, and the computer program or executable instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer program or executable instructions from the computer-readable storage medium, and the processor executes the computer program or executable instructions, so that the computer device executes any one of the photographing methods in the embodiments of the present disclosure.
[0215] 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 general 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.
[0216] It should be understood that the present disclosure is not limited to the exact structures already described 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 photographing method, characterized in that, The method includes: In response to detecting a photographing instruction, obtaining a single-frame image; wherein, a zoom ratio is carried in the photographing instruction, and the focal length indicated by the zoom ratio is greater than the focal length for collecting the single-frame image; Cropping the single-frame image to obtain a cropped image after cropping; wherein, the content of the cropped image corresponds to the content of the shooting area at the focal length indicated by the zoom ratio; Determining edge pixel points in the cropped image; Based on the edge pixel points and the cropped image, determining a preview image of a preset photographing size.
2. The method according to claim 1, wherein The determining a preview image of a preset photographing size based on the edge pixel points and the cropped image includes: Based on the edge pixel points, the cropped image, and the preset photographing size, determining target edge pixel points; Based on the cropped image and the preset photographing size, determining non-edge pixel points other than the target edge pixel points; Based on the target edge pixel points and the non-edge pixel points, determining the preview image.
3. The method according to claim 2, wherein The determining target edge pixel points based on the edge pixel points, the cropped image, and the preset photographing size includes: Based on the edge pixel points, fitting to obtain a first contour expression; wherein, the first contour expression is used to characterize the edge information in the cropped image; Based on the first contour expression, the cropped image, and the preset photographing size, determining the target edge pixel points.
4. The method according to claim 3, characterized in that, The first contour expression includes sub-contour expressions corresponding to first image blocks in the cropped image where there are edge pixel points; The determining the target edge pixel points based on the first contour expression, the cropped image, and the preset photographing size includes: Based on the size of the cropped image and the preset photographing size, determining an image scaling ratio; For each first image block, based on the image scaling ratio, the edge pixel points in the first image block, and the sub-contour expression corresponding to the first image block, determining sub-target edge pixel points corresponding to the first image block; wherein, the sub-target edge pixel points corresponding to the first image block belong to local edge pixel points in the preview image; Based on the sub-target edge pixel points corresponding to all first image blocks, determining the target edge pixel points.
5. The method according to claim 4, wherein The determining sub-target edge pixel points corresponding to a first image block based on the image scaling ratio, the edge pixel points in the first image block, and the sub-contour expression corresponding to the first image block includes: Determining first coordinates after scaling the coordinates of each edge pixel point in the first image block in a first preset direction based on the image scaling ratio; Based on the first coordinates corresponding to each edge pixel point and the sub-contour expression corresponding to the first image block, determining second coordinates of each edge pixel point in a second preset direction; Based on the first coordinates and the second coordinates corresponding to all edge pixel points in the first image block, determining the coordinates of the sub-target edge pixel points corresponding to the first image block; Interpolating the sub-target edge pixel points based on all edge pixel points in the first image block to obtain the pixel values of the sub-target edge pixel points.
6. The method according to claim 4, wherein The method further includes: Divide the cropped image into regions to obtain a plurality of image blocks; Determine a first image block among the plurality of image blocks that has at least two edge pixel points; For each first image block, fit a sub-contour expression based on the coordinates of at least two edge pixel points in the first image block.
7. The method according to claim 6, characterized in that The fitting of the sub-contour expression based on the coordinates of at least two edge pixel points in the first image block includes: Fit fitting coefficients based on the coordinates of at least two edge pixel points in the first image block using a preset fitting function; wherein, the preset fitting function forms a sub-contour expression based on the fitting coefficients.
8. The method according to claim 2, wherein The determination of the non-edge pixel points other than the target edge pixel points based on the cropped image and the preset photographing size includes: Determine a coordinate mapping relationship based on the size of the cropped image and the preset photographing size; wherein, the coordinate mapping relationship represents the mapping between the coordinates of pixel points in the cropped image and the coordinates of pixel points in the preview image; Determine the coordinates of the non-edge pixel points based on the coordinates of the target edge pixel points and the preset photographing size; Based on the coordinate mapping relationship, determine the first pixel points in the cropped image corresponding to the non-edge pixel points; Interpolate the non-edge pixel points based on the first pixel points to obtain the pixel values of the non-edge pixel points.
9. The method according to claim 2, wherein The method further includes: Fit a second contour expression based on the target edge pixel points in the preview image; wherein, the second contour expression is used to represent the edge information in the preview image, and the second contour expression is used to assist in the scaling process of the preview image.
10. The method according to claim 1, characterized in that, The obtaining of a single-frame image in response to detecting a photographing instruction includes: In response to detecting the photographing instruction, obtain a frame of image within a preset time range from the detection time of the photographing instruction as the single-frame image.
11. The method according to any one of claims 1-10, characterized in that, The zoom ratio carried in the photographing instruction is greater than a preset ratio threshold.
12. A photographing device, characterized in that, The apparatus includes: An obtaining module configured to obtain a single-frame image in response to detecting a photographing instruction; wherein, the photographing instruction carries a zoom ratio, and the focal length indicated by the zoom ratio is greater than the focal length for collecting the single-frame image; A cropping module configured to crop the single-frame image to obtain a cropped image after cropping; wherein, the content of the cropped image corresponds to the content of the shooting area at the focal length indicated by the zoom ratio; A first determination module configured to determine the edge pixel points in the cropped image; An image processing module configured to determine a preview image of a preset photographing size based on the edge pixel points and the cropped image.
13. An electronic device, characterized in that, Includes: A processor; A memory for storing computer programs or instructions for the processor; Wherein, the processor executes the computer program or instructions to implement the method according to any one of claims 1 to 11.
14. A non-transitory computer-readable storage medium storing a computer program or instructions, characterized in that, When the computer program or instructions in the storage medium are executed by the processor, the method according to any one of claims 1 to 11 is implemented.
15. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, the method according to any one of claims 1 to 11 is implemented.