Photographing method and device, storage medium, terminal and computer program product

By obtaining preview scene images of multiple shooting positions in the preview mode of the photography device, performing brightness differences and composition analysis, and guiding users to move the device to the target position, solving the problem of difficult composition of non-professional users, achieving high-quality shooting effects and convenient operation.

CN120378736APending Publication Date: 2025-07-25RDA MICROELECTRONICS TECH SHANGHAI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510557395.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

Non-professional users find it difficult to obtain beautiful and expressive photos during shooting. The existing technology relies on manual imitation solutions to have imitation deviations and cumbersome operations, and poor user experience.

Method used

In the preview mode of the photography device, preview scene images of multiple shooting positions are obtained, the reference position is determined through brightness difference analysis, and the user is prompted to move the device to the target position based on composition analysis until the preset distance is reached, and the final photo is taken.

Benefits of technology

It realizes intelligent photography guidance, improves the brightness effect and composition ratio of the captured images, simplifies the operation process, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120378736A_ABST
    Figure CN120378736A_ABST
Patent Text Reader

Abstract

The invention discloses a photographing method and device, a storage medium, a terminal and a computer program product. The method comprises the following steps: acquiring a plurality of first preview scene images collected by photographing equipment at various photographing positions in a preview mode; brightness difference analysis is carried out on each first preview scene image and a first image template selected by the user, a target preview image with the minimum brightness difference with the first image template is determined, and a shooting position corresponding to the target preview image is recorded as a reference position; performing first composition analysis based on the target preview image and a target photographing object in the target preview image to determine a target position of the photographing device; and based on the difference between the actual position of the photographing device and the target position, prompting a user to move the photographing device until the distance between the actual position of the photographing device and the target position is determined to be smaller than a preset distance, and determining a final photographing image of the photographing device at the target position. According to the scheme, intelligent photographing prompting can be performed on the user, and the photographed image with relatively good brightness and composition proportion can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of camera technologies, and in particular, to a photographing method and apparatus, a storage medium, a terminal, and a computer program product. Background Art

[0002] With the wide popularization of intelligent camera devices and the continuous progress of camera technologies, photography has become an important tool for people to record their lives and share experiences. However, for many non-professional users, due to the lack of professional photography knowledge, how to use a camera device to take photos with beautiful compositions and rich expressiveness remains a great challenge.

[0003] In the prior art, by recommending some photos with better shooting effects to users, users are allowed to take photos by imitating the shooting angles, composition ratios, etc. of the recommended photos. However, this photographing scheme relying on manual imitation may, on the one hand, have imitation deviations, resulting in the photos taken being difficult to achieve the expected effects; on the other hand, when users face changing environments and scenes, they often need to repeatedly exit the shooting interface to compare with the recommended photos during the shooting process, and the operation process is cumbersome and time-consuming, and the user experience is poor. Summary of the Invention

[0004] One of the purposes achieved by the embodiments of the present invention is to provide a photographing method, which can more intelligently prompt a user to move a camera device to a more appropriate shooting position to obtain a high-quality photographed image with both an expected better brightness effect and a better composition ratio effect.

[0005] To solve the above technical problems, an embodiment of the present invention provides a photographing method, including the following steps: in a preview mode of a photographing device, obtaining a plurality of first preview scene images collected by the photographing device at a plurality of shooting positions, where each first preview scene image includes a target shooting object; respectively performing brightness difference analysis on the plurality of first preview scene images and a first image template selected by a user, and determining a first preview scene image with the smallest brightness difference from the first image template, which is denoted as a target preview image, and a shooting position corresponding to the target preview image is denoted as a reference position; performing a first composition analysis based on the target preview image and the target shooting object therein to determine a target position of the photographing device relative to the reference position; based on a difference between an actual position of the photographing device and the target position, prompting the user to move the photographing device until it is confirmed that a distance between the actual position of the photographing device and the target position is less than a preset distance, and determining a final photographed image of the photographing device at the target position.

[0006] Optionally, perform brightness difference analysis on the multiple first preview scene images and the first image template selected by the user respectively to determine the first preview scene image with the smallest brightness difference from the first image template, including: performing histogram statistics on the brightness values of each pixel of the multiple first preview scene images respectively to obtain a first brightness histogram corresponding to each first preview scene image; performing histogram statistics on the brightness values of each pixel of the first image template to obtain a corresponding second brightness histogram, where the first brightness histogram and the second brightness histogram include a preset number of brightness value intervals; for the first brightness histogram corresponding to each first preview scene image, calculate the absolute value of the difference between the number of pixels in each brightness value interval of this first brightness histogram and the number of pixels in this brightness value interval of the second brightness histogram, and record it as the quantity difference corresponding to this brightness value interval; perform weighted operation on the multiple quantity differences corresponding to each brightness value interval of this first brightness histogram to obtain a weighted quantity difference, where the larger the weighted quantity difference, the greater the brightness difference between the first preview scene image to which this first brightness histogram belongs and the first image template; use the first preview scene image with the smallest weighted quantity difference among the multiple first preview scene images as the first preview scene image with the smallest brightness difference from the first image template.

[0007] Optionally, perform first composition analysis based on the target preview image and the target shooting object therein to determine the target position of the photographing device relative to the reference position, including: extracting the contour of the target shooting object in the target preview image to obtain a plurality of first boundary points; predicting boundary points based on the positions of the plurality of first boundary points in the target preview image to obtain corresponding plurality of predicted boundary points; determining the target position of the photographing device relative to the reference position based on the positions of the plurality of predicted boundary points in the target preview image and the positions of the plurality of first boundary points in the target preview image.

[0008] Optionally, determining the final photographed image of the photographing device at the target position includes: in response to receiving a photographing instruction, obtaining an initial photographed image taken by the photographing device at the target position, where the initial photographed image includes the target shooting object; performing second composition analysis based on the initial photographed image and the target shooting object therein to determine a cropping parameter; cropping the initial photographed image using the cropping parameter to obtain the final photographed image; where the method of the second composition analysis is different from the method of the first composition analysis.

[0009] Optionally, perform a second composition analysis based on the initial captured image and the target subject therein to determine cropping parameters, including: extracting the contour of the target subject in the initial captured image to obtain a plurality of second boundary points; for each edge line of the initial captured image, determining several second boundary points with a smaller distance from the edge line among the plurality of second boundary points to obtain a boundary point set corresponding to the edge line; for each boundary point set corresponding to an edge line, calculating the average value of the distances between the second boundary points in the boundary point set and the edge line, denoted as the average distance corresponding to the edge line; determining the cropping parameters based on the average distances corresponding to the respective edge lines of the initial captured image.

[0010] Optionally, the photographing instruction is triggered after receiving a start photographing prompt; after confirming that the actual position of the photographing device is consistent with the target position, the method further includes: in the preview mode of the photographing device, obtaining a second preview scene image captured by the photographing device at the target position; determining the average brightness value of the second preview scene image, and calculating the difference between the average brightness value and the average brightness value of the first image template, denoted as the average brightness difference; adjusting the exposure parameters of the photographing device based on the average brightness difference, then re-obtaining the second preview scene image captured by the photographing device at the target position based on the adjusted exposure parameters and re-determining the average brightness difference until the re-determined average brightness difference is less than a preset brightness difference, and sending the start photographing prompt.

[0011] An embodiment of the present invention further provides a photographing device, including: a preview scene image acquisition module, configured to obtain a plurality of first preview scene images captured by a photographing device at a plurality of shooting positions in the preview mode of the photographing device, wherein each first preview scene image includes a target subject; a brightness difference analysis module, configured to perform brightness difference analysis on the plurality of first preview scene images and a first image template selected by a user respectively, and determine a first preview scene image with the smallest brightness difference from the first image template, denoted as a target preview image, and the shooting position corresponding to the target preview image is denoted as a reference position; a first composition analysis module, configured to perform a first composition analysis based on the target preview image and the target subject therein to determine a target position of the photographing device relative to the reference position; a shooting prompt module, configured to prompt the user to move the photographing device based on the difference between the actual position and the target position of the photographing device until it is confirmed that the distance between the actual position and the target position of the photographing device is less than a preset distance, and determine a final captured image of the photographing device at the target position.

[0012] An embodiment of the present invention further provides a storage medium, on which a computer program is stored, and when the computer program is run by a processor, the steps of the above-mentioned photographing method are executed.

[0013] An embodiment of the present invention further provides a terminal, including a memory and a processor. A computer program capable of running on the processor is stored on the memory, and when the processor runs the computer program, the steps of the above-mentioned photographing method are executed.

[0014] An embodiment of the present invention further provides a computer program product, including a computer program, characterized in that when the computer program is run by a processor, the steps of the above-mentioned photographing method are executed.

[0015] Compared with the prior art, the technical solution of the embodiment of the present invention has the following beneficial effects:

[0016] In the embodiment of the present invention, by acquiring multiple first preview scene images collected by a photographing device at multiple photographing positions, and respectively performing brightness difference analysis on each first preview image and a first image template to determine the first preview scene image with better brightness and its corresponding photographing position, and taking this photographing position as the reference position of the photographing device; then by performing a first composition analysis on the first preview scene image with better brightness, on the basis of the reference position, further determine the target position where the photographing device is located and prompt the user to move the photographing device close to this target position. Since the target position is actually the better photographing position of the photographing device, the image taken at this target position can achieve a better image brightness effect and a better composition ratio effect that meet the user's expectations, thereby improving the quality of the photographed image as a whole. Further, the photographing method of this implementation scheme does not need to rely on artificially imitating a photo template or repeatedly exiting the shooting interface to compare with the recommended photo template, and the entire shooting guidance process has the advantages of being intelligent, efficient, and convenient.

[0017] Further, in the embodiment of the present invention, a brightness histogram statistics scheme is adopted to perform brightness difference analysis on the first preview scene image and the first image template selected by the user. Since the brightness histogram of the image can provide objective and accurate information on the overall brightness distribution characteristics of the image, based on the pixel quantity difference in different brightness intervals in the brightness histogram, analyzing the brightness difference between images helps to obtain an objective and accurate comparison result to determine the target preview image with the closest brightness difference to the first image template selected by the user. Furthermore, the image taken at the photographing position corresponding to this target preview image (i.e., the reference position) can have the image brightness effect expected by the user.

[0018] Further, in the embodiments of the present invention, a two - round composition analysis scheme is adopted to optimize the quality of the final captured image as much as possible. Specifically, the first - round composition analysis is a composition analysis based on the preview image before the user captures an image, aiming to provide the user with an accurate and appropriate shooting position (i.e., the target position) of the photographing device, so as to obtain an initial captured image with both the brightness effect and the composition ratio effect expected by the user at the target position; the second - round composition analysis is a composition analysis based on the initial captured image after the user triggers the photographing instruction and obtains the initial captured image taken at the target position, aiming to determine appropriate cropping parameters to further perform secondary composition optimization on the initial captured image that already has a good brightness effect and composition ratio effect, so as to obtain a higher - quality captured image. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flowchart of a photographing method in an embodiment of the present invention;

[0020] Figure 2 is Figure 1 a flowchart of a specific implementation manner of step S12 therein;

[0021] Figure 3 is Figure 1 a flowchart of a specific implementation manner of step S13 therein;

[0022] Figure 4 is Figure 1 a flowchart of a specific implementation manner of step S14 therein;

[0023] Figure 5 is a schematic structural diagram of a photographing device in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0024] To make the above - mentioned objects, features, and beneficial effects of the present invention more obvious and understandable, the following detailed description of the specific embodiments of the present invention will be given with reference to the accompanying drawings.

[0025] Refer to Figure 1 , Figure 1 is a flowchart of a photographing method in an embodiment of the present invention. The method can be applied to various terminal devices with a photographing function, such as but not limited to: smart phones, tablet computers, computers, smart wearable devices (such as smart watches), self - driving vehicle - mounted terminals, etc.

[0026] The method may include steps S11 to S14:

[0027] Step S11: In the preview mode of the photographing device, obtain multiple first preview scene images collected by the photographing device at multiple shooting positions, where each first preview scene image contains a target shooting object;

[0028] Step S12: Analyze the brightness differences between the multiple first preview scene images and the first image template selected by the user respectively, and determine the first preview scene image with the smallest brightness difference from the first image template, which is denoted as the target preview image. The shooting position corresponding to the target preview image is denoted as the reference position.

[0029] Step S13: Perform a first composition analysis based on the target preview image and the target shooting object therein to determine the target position of the photographing device relative to the reference position.

[0030] Step S14: Based on the difference between the actual position and the target position of the photographing device, prompt the user to move the photographing device until it is confirmed that the distance between the actual position and the target position of the photographing device is less than a preset distance, and determine the final photographed image of the photographing device at the target position.

[0031] It can be understood that in specific implementation, the method can be implemented in the form of a software program, and the software program runs in a processor integrated inside a chip or a chip module; or, the method can be implemented in a hardware or a combination of hardware and software manner.

[0032] In the specific implementation of step S11, the preview mode of the photographing device may refer to the mode or state before a photographing instruction is triggered (for example, it can be triggered by pressing a photographing function key). In the preview mode, the image sensor of the photographing device usually collects and stores preview scene images in real time.

[0033] Among them, the multiple first preview scene images collected at the multiple shooting positions can be obtained specifically in the following way: Prompt the user to place the photographing device at the multiple shooting positions respectively, and obtain at least one preview scene image collected for the target scene at each shooting position (for example, the at least one preview scene image can be randomly selected from several preview scene images collected in real time by the image sensor for the target scene at each shooting position), so as to obtain the multiple first preview scene images. Among them, the shooting position may refer to the position corresponding to the geometric center point or the centroid of the photographing device.

[0034] In a specific implementation, the multiple shooting positions may be shooting positions determined by the user according to actual needs, or may be preset shooting positions, or may be shooting positions determined based on the scene type to which the target scene currently targeted by the photographing device belongs (for example, multiple shooting positions corresponding to different scene types may be set in advance). In practical applications, the scene type may be selected from, but not limited to: natural scenery, urban architecture, food, people, cultural landscapes, etc. The method of prompting the shooting position to the user may be implemented by using appropriate prompts such as text and arrows on the display screen of the photographing device, or by using other conventional methods (such as voice prompt signals) for prompting.

[0035] Among them, the same target shooting object is included in each first preview scene image. The target shooting object may be, for example, a target person, a target building, a target animal or other shooting target objects in the target scene, and the embodiments of the present invention do not limit this.

[0036] In a specific implementation of step S12, the first image template may be determined based on the scene type to which the captured target scene belongs. In a specific implementation manner, before performing step S12, the method may further include: randomly selecting a preview scene image from the multiple first preview scene images as the target scene image; inputting the target scene image into a preset scene classification model to determine the scene type to which the target scene image belongs, denoted as the target scene type; searching for each image template corresponding to the target scene type in the image template library and recommending it to the user; and determining the first image template selected by the user in response to the selection instruction triggered by the user. Among them, the image template library contains one or more image templates corresponding to different scene types.

[0037] Refer to Figure 2 , Figure 2 is Figure 1 a flowchart of a specific implementation manner of step S12 in

[0038] In step S121, the brightness values of each pixel of the multiple first preview scene images are respectively subjected to histogram statistics to obtain a first brightness histogram corresponding to each first preview scene image.

[0039] In step S122, a histogram statistics is performed on the brightness values of each pixel of the first image template to obtain a corresponding second brightness histogram, where the first brightness histogram and the second brightness histogram include a preset plurality of brightness value intervals.

[0040] In step S123, for the first brightness histogram corresponding to each first preview scene image, the absolute value of the difference between the number of pixels in each brightness value interval of the first brightness histogram and the number of pixels in the second brightness histogram in the same brightness value interval is calculated, and is denoted as the quantity difference corresponding to this brightness value interval.

[0041] In step S124, a weighted operation is performed on the plurality of quantity differences corresponding to each brightness value interval of the first brightness histogram to obtain a weighted quantity difference corresponding to this first preview scene image.

[0042] Among them, the larger the weighted quantity difference, the greater the brightness difference between the first preview scene image to which the first brightness histogram belongs and the first image template.

[0043] In step S125, the first preview scene image with the smallest weighted quantity difference among the plurality of first preview scene images is used as the first preview scene image with the smallest brightness difference from the first image template.

[0044] In a specific implementation, each brightness value interval may respectively have a corresponding weight, and the weighted quantity difference is obtained by performing a weighted operation on the plurality of quantity differences corresponding to each brightness value interval by using the respective weights corresponding to each brightness value interval.

[0045] In the embodiment of the present invention, since the brightness histogram of an image can provide objective and accurate information on the overall brightness distribution characteristics of the image, analyzing the brightness difference between images based on the difference in the number of pixels belonging to different brightness intervals helps to obtain an objective and accurate comparison result to determine the target preview image with the closest brightness difference from the first image template selected by the user. Further, the image taken at the shooting position corresponding to the target preview image (i.e., the reference position) may have the image brightness effect expected by the user.

[0046] Further, the brightness value intervals can be divided into brightness levels based on the magnitude of the brightness values; among them, each brightness value interval has the belonging brightness level, each brightness level has one or more corresponding brightness value intervals; the higher the brightness level, the larger the brightness values of the corresponding brightness value intervals. For the brightness value intervals belonging to the same brightness level, the same weight can be set, and for the brightness value intervals belonging to different brightness levels, the same or different weights can be set according to actual needs.

[0047] As a non-limiting embodiment, each of the luminance value ranges can be divided into three luminance value levels: a low luminance level, a medium luminance level, and a high luminance level. Among them, the weights of the luminance value ranges belonging to the low luminance level are denoted as the first weights, the weights of the luminance value ranges belonging to the medium luminance level are denoted as the second weights, and the weights of the luminance value ranges belonging to the high luminance level are denoted as the third weights; the second weight is greater than the first weight, and the third weight is greater than the first weight; the second weight and the third weight can be the same or different.

[0048] In the embodiments of the present invention, the luminance value ranges can be hierarchically divided according to actual needs, and appropriate weights can be adaptively set to perform weighted operations on the multiple quantity differences corresponding to each luminance value range, and use the weighted quantity difference as an index to characterize the luminance difference between the first preview scene image and the first image template, which helps to improve the accuracy of the luminance difference analysis result.

[0049] It should be noted that Figure 2 In the shown solution, the execution order of steps S121 and S122 can be interchanged or they can be executed synchronously.

[0050] Referring to Figure 3 , Figure 3 is Figure 1 a flowchart of a specific implementation manner of step S13 in ; in step S13, based on the target preview image and the target shooting object therein, a first composition analysis is performed to determine the target position of the photographing device relative to the reference position, which may specifically include steps S131 to S133.

[0051] In step S131, the outline of the target shooting object in the target preview image is extracted to obtain a plurality of first boundary points.

[0052] Among them, the plurality of first boundary points may be several boundary points obtained by sampling the outline extracted from the target shooting object.

[0053] In step S132, based on the positions of the plurality of first boundary points in the target preview image, boundary point prediction is performed to obtain corresponding plurality of predicted boundary points.

[0054] It can be understood that the positions of the plurality of predicted boundary points in the target preview image are actually the reference positions or standard positions of the corresponding plurality of first boundary points in the target preview image.

[0055] In specific implementation, the boundary point prediction can be implemented by using a pre-trained boundary point prediction model.

[0056] The boundary point prediction model can be trained in the following manner: Obtain multiple first sample images, where each first sample image contains a sample photographing object; extract the contour of the sample photographing object in each first sample image to obtain first sample boundary points, and perform boundary point annotation on each first sample image to obtain corresponding annotated boundary points; construct training data using the positions of the first sample boundary points in the first sample images, and based on a first loss function, input the training data into an initial model for iterative training to obtain the boundary point prediction model.

[0057] Among them, performing boundary point annotation on each first sample image can be performed based on the boundary point positions of the reference photographing object in the reference image template (which can also be referred to as "boundary point standard position" or "boundary point reference position").

[0058] Among them, in each iteration, the function value of the first loss function is determined based on the position differences between the predicted sample boundary points of the first sample image output by the initial model in this iteration and the corresponding annotated boundary points. The first loss function can use existing conventional loss functions, for example, L1 loss function, L2 loss function, cross-entropy loss function, mean square error loss function, etc.

[0059] In step S133, based on the positions of the multiple predicted boundary points in the target preview image and the positions of the multiple first boundary points in the target preview image, determine the target position of the photographing device relative to the reference position.

[0060] Furthermore, the reference position and the target position of the photographing device are positions in a target coordinate system. In a specific implementation manner of step S133, the following method can be used to determine the target position of the photographing device relative to the reference position: Map the multiple first boundary points and the multiple predicted boundary points to the target coordinate system respectively to obtain multiple first mapped points corresponding to the multiple first boundary points in the target coordinate system and multiple second mapped points corresponding to the multiple predicted boundary points in the target coordinate system; determine an offset vector based on the multiple first mapped points and the multiple second mapped points; offset the reference position of the photographing device based on the offset vector to obtain the target position of the photographing device.

[0061] Among them, the target coordinate system may be a world coordinate system. In a specific implementation, based on the internal parameters of the photographing device, the multiple first boundary points can be mapped from the image coordinate system where the target preview image is located to the camera coordinate system to obtain multiple initial mapping points; then, based on the external parameters of the photographing device, the multiple initial mapping points are mapped from the camera coordinate system to the world coordinate system. Among them, the internal parameters of the photographing device are used to represent the rotation relationship and translation relationship between the image coordinate system and the camera coordinate system, and the external parameters of the photographing device are used to represent the rotation relationship and translation relationship between the image coordinate system and the camera coordinate system.

[0062] Continue to refer to Figure 1 , in the specific implementation of step S14, the method of prompting the user to move the photographing device based on the difference between the actual position and the target position of the photographing device can be implemented by conventional methods. For example, by displaying "arrows" and / or "text" or other appropriate prompts on the display screen of the photographing device to prompt the user to move the photographing device towards the target position, or, alternatively, by voice to prompt the user to move the photographing device towards the target position until it is confirmed that the distance between the actual position and the target position of the photographing device is less than a preset distance, and then a prompt to stop moving the photographing device and a prompt to start photographing can be issued to the user.

[0063] Refer to Figure 4 , Figure 4 is Figure 1 a flowchart of a specific implementation manner of step S14 in

[0064] In step S141, in response to receiving a photographing instruction, an initial photographing image taken by the photographing device at the target position is obtained, and the target photographing object is included in the initial photographing image.

[0065] Among them, the photographing instruction can be triggered by the user pressing a photographing function key, or, alternatively, by the user issuing a specific voice control instruction or making a specific gesture action.

[0066] Further, the photographing instruction is triggered after receiving a start photographing prompt; after confirming that the actual position of the photographing device is consistent with the target position, the method further includes: in the preview mode of the photographing device, obtaining a second preview scene image collected by the photographing device at the target position; determining an average brightness value of the second preview scene image, and calculating a difference between the average brightness value and the average brightness value of the first image template, denoted as the average brightness difference; adjusting the exposure parameter of the photographing device based on the average brightness difference, then re-obtaining the second preview scene image collected by the photographing device at the target position based on the adjusted exposure parameter and re-determining the average brightness difference until the re-determined average brightness difference is less than a preset brightness difference, and sending out the start photographing prompt.

[0067] Wherein, the average brightness value of the second preview scene image may specifically refer to an average calculation result of the brightness values of the pixels of the second preview scene image.

[0068] Since in step S14, the photographing device is offset based on the reference position, and the difference between the brightness of the first preview scene image obtained corresponding to the reference position and the brightness of the first image template is the smallest. To further ensure that the brightness effect of the second preview scene image obtained by the photographing device at the target position after offset is still as close as possible to the brightness effect of the first image template, this implementation scheme cyclically obtains the second preview scene image collected by the photographing device at the target position, and adjusts the exposure parameter of the photographing device based on the average brightness difference between the second preview scene image and the first image template until it is confirmed that the average brightness difference between the two meets the expectation, and then sends out the start photographing prompt.

[0069] Thus, this implementation scheme realizes the effect of minimizing the brightness difference between the final photographed image and the first image template selected by the user through the "two-step brightness difference adjustment mechanism" and adopting the "exposure parameter cyclic adjustment mechanism" in the second brightness adjustment, maximally meeting the expected brightness effect of the user and enhancing the user experience.

[0070] In step S142, based on the initial photographed image and the target shooting object therein, a second composition analysis is performed to determine the cropping parameter.

[0071] In step S143, the initial photographed image is cropped using the cropping parameter to obtain the final photographed image.

[0072] Wherein, the method of the second composition analysis is different from the method of the first composition analysis.

[0073] Further, in step S142, a second composition analysis is performed based on the initial captured image and the target object to be captured therein to determine the cropping parameters, including: extracting the contour of the target object in the initial captured image to obtain a plurality of second boundary points; for each edge line of the initial captured image, determining several second boundary points with a smaller distance from the edge line among the plurality of second boundary points to obtain a boundary point set corresponding to the edge line; for each boundary point set corresponding to an edge line, calculating the average value of the distances between each second boundary point in the boundary point set and the edge line, and denoting it as the average distance corresponding to the edge line; and determining the cropping parameters based on the average distances corresponding to the respective edge lines of the initial captured image.

[0074] Among them, the cropping parameters may be, for example, parameters such as the length and ratio of cropping each edge line of the initial captured image.

[0075] In the embodiment of the present invention, a two-round composition analysis scheme is adopted to optimize the quality of the final captured image as much as possible. Specifically, the first-round composition analysis is a composition analysis based on the preview image before the user captures the image, aiming to provide the user with an accurate and appropriate shooting position (i.e., the target position) of the shooting device, so as to obtain an initial captured image with both the expected brightness effect and composition ratio effect at the target position; the second-round composition analysis is a composition analysis based on the initial captured image after the user triggers the shooting instruction and obtains the initial captured image taken at the target position, aiming to determine appropriate cropping parameters to further perform secondary composition optimization on the initial captured image that already has a better brightness effect and composition ratio effect, so as to obtain a higher-quality captured image.

[0076] Furthermore, for each edge line of the initial captured image, determining several second boundary points with a smaller distance from the edge line among the plurality of second boundary points to obtain a boundary point set corresponding to the edge line may specifically include: selecting, among the plurality of second boundary points, the second boundary points with a distance less than a preset distance threshold from the edge line as the boundary point set corresponding to the edge line; or sorting the distances between the plurality of second boundary points and the edge line from small to large, and selecting the preset number of second boundary points with a higher ranking as the boundary point set corresponding to the edge line.

[0077] In a specific embodiment, each edge line of the initial captured image has a corresponding preset standard distance; determining the cropping parameters based on the average distances corresponding to the respective edge lines of the initial captured image includes: for each edge line, determining the difference obtained by subtracting the preset standard distance from the average distance corresponding to the edge line, and denoting it as the distance deviation; and using the distance deviations with positive numerical values as the cropping parameters.

[0078] In another specific embodiment, based on the average distances corresponding to the respective edge lines of the initial captured image, the cropping parameters are determined, including: inputting the average distances corresponding to the respective edge lines of the initial captured image into a pre-trained cropping parameter prediction model to predict and obtain the cropping parameters.

[0079] Among them, the pre-trained cropping parameter prediction model can be trained in the following manner: Obtain multiple second sample images, each of which contains a sample shooting object; perform contour extraction on the sample shooting object in each second sample image to obtain second sample contour points; based on the second sample contour points, determine the sample average distances corresponding to the respective edge lines of this second sample image; use the sample average distances corresponding to the respective edge lines of the second sample image to construct training data, and perform cropping parameter annotation on the second sample image to obtain corresponding annotated cropping parameters; based on a second loss function, input the training data into the model to be trained for iterative training to obtain the cropping parameter prediction model.

[0080] Among them, in each round of iteration, the function value of the second loss function is determined based on the difference between the predicted cropping parameters and the annotated cropping parameters of the second sample image output by the model to be trained in this round. The second loss function can adopt existing conventional loss functions, for example, L1 loss function, L2 loss function, cross-entropy loss function, mean square error loss function, etc.

[0081] Referring to Figure 5 , Figure 5 is a schematic structural diagram of a photographing device in an embodiment of the present invention. The photographing device may include:

[0082] A preview scene image acquisition module 51, configured to, in the preview mode of the photographing device, acquire multiple first preview scene images collected by the photographing device at multiple shooting positions, where each first preview scene image contains a target shooting object;

[0083] A brightness difference analysis module 52, configured to respectively perform brightness difference analysis on the multiple first preview scene images and a first image template selected by the user, and determine the first preview scene image with the smallest brightness difference from the first image template, denoted as the target preview image, and the shooting position corresponding to the target preview image is denoted as the reference position;

[0084] A first composition analysis module 53, configured to perform a first composition analysis based on the target preview image and the target shooting object therein to determine the target position of the photographing device relative to the reference position;

[0085] The shooting prompt module 54 is configured to prompt the user to move the photographing device based on the difference between the actual position and the target position of the photographing device until it is confirmed that the distance between the actual position of the photographing device and the target position is less than a preset distance, and to determine the final photographed image of the photographing device at the target position.

[0086] In a specific implementation, the above-mentioned photographing device may correspond to a chip for photographing functions; or a chip module with photographing functions in a terminal, or a terminal.

[0087] For the principle, specific implementation and beneficial effects of this photographing device, please refer to the previous text and Figures 1 to 4 the relevant descriptions of the photographing method shown in any of the embodiments, which will not be elaborated here.

[0088] An embodiment of the present invention also provides a storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the photographing method shown in any of the above Figures 1 to 4 embodiments. The computer-readable storage medium may include non-volatile memory or non-transitory memory, and may also include optical discs, mechanical hard disks, solid-state drives, etc.

[0089] Specifically, in an embodiment of the present invention, the processor may be a central processing unit (CPU for short). This processor may also be other general-purpose processors, digital signal processors (DSP for short), application specific integrated circuits (ASIC for short), field programmable gate arrays (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or this processor may also be any conventional processor, etc.

[0090] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchlink dynamic random access memory (SLDRAM), and direct rambus random access memory (DR RAM).

[0091] An embodiment of the present invention further provides a terminal, including a memory and a processor. A computer program capable of running on the processor is stored on the memory. When the processor runs the computer program, it executes the steps of the photographing method shown in any of the above Figures 1 to 4 embodiments.

[0092] An embodiment of the present invention further provides a computer program product, including a computer program. When the computer program is run by a processor, it executes the steps of the photographing method shown in any of the above Figures 1 to 4 embodiments.

[0093] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer program can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer program can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired or wireless manner.

[0094] In several embodiments provided in the present application, it should be understood that the disclosed methods, devices, and systems can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for example, the division of the units is only a logical function division, and there can be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0095] In addition, in each embodiment of the present invention, each functional unit may be integrated into a processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware, or in the form of a combination of hardware and software functional units. For example, for each device or product applied to or integrated into a chip, each module / unit included therein may be implemented in the form of hardware such as a circuit. Alternatively, at least some of the modules / units may be implemented in the form of a software program that runs on a processor integrated inside the chip, and the remaining (if any) part of the modules / units may be implemented in the form of hardware such as a circuit. For each device or product applied to or integrated into a chip module, each module / unit included therein may be implemented in the form of hardware such as a circuit. Different modules / units may be located in the same component (such as a chip, a circuit module, etc.) or different components of the chip module. Alternatively, at least some of the modules / units may be implemented in the form of a software program that runs on a processor integrated inside the chip module, and the remaining (if any) part of the modules / units may be implemented in the form of hardware such as a circuit. For each device or product applied to or integrated into a terminal, each module / unit included therein may be implemented in the form of hardware such as a circuit. Different modules / units may be located in the same component (such as a chip, a circuit module, etc.) or different components inside the terminal. Alternatively, at least some of the modules / units may be implemented in the form of a software program that runs on a processor integrated inside the terminal, and the remaining (if any) part of the modules / units may be implemented in the form of hardware such as a circuit.

[0096] It should be understood that the term "and / or" in this document is merely a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this document indicates that the associated objects before and after are in an "or" relationship.

[0097] In the embodiments of the present application, "a plurality of" refers to two or more.

[0098] In the embodiments of the present application, the descriptions such as first and second are only for schematic and distinguishing the described objects, without an order, and do not represent a special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application.

[0099] It should be noted that the sequence numbers of the steps in this embodiment do not represent the limitation of the execution sequence of each step.

[0100] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.

Claims

1. A photographing method, characterized in that, Including: In the preview mode of the photographing device, obtaining a plurality of first preview scene images collected by the photographing device at multiple photographing positions, where each first preview scene image includes a target photographing object; Respectively performing brightness difference analysis on the plurality of first preview scene images and a first image template selected by a user to determine a first preview scene image with the smallest brightness difference from the first image template, which is denoted as a target preview image, and denoting the photographing position corresponding to the target preview image as a reference position; Performing first composition analysis based on the target preview image and the target photographing object therein to determine a target position of the photographing device relative to the reference position; Based on the difference between the actual position and the target position of the photographing device, prompting the user to move the photographing device until it is confirmed that the distance between the actual position and the target position of the photographing device is less than a preset distance, and determining a final photograph image of the photographing device at the target position.

2. The method according to claim 1, wherein Respectively performing brightness difference analysis on the plurality of first preview scene images and a first image template selected by a user to determine a first preview scene image with the smallest brightness difference from the first image template, including: Respectively performing histogram statistics on the brightness values of each pixel of the plurality of first preview scene images to obtain a first brightness histogram corresponding to each first preview scene image; Performing histogram statistics on the brightness values of each pixel of the first image template to obtain a corresponding second brightness histogram, where the first brightness histogram and the second brightness histogram include a preset plurality of brightness value intervals; For the first brightness histogram corresponding to each first preview scene image, calculating the absolute value of the difference between the number of pixels of the first brightness histogram in each brightness value interval and the number of pixels of the second brightness histogram in the same brightness value interval, which is denoted as the quantity difference corresponding to this brightness value interval; Performing weighted operation on the plurality of quantity differences corresponding to each brightness value interval of the first brightness histogram to obtain a weighted quantity difference corresponding to this first preview scene image, where the larger the weighted quantity difference, the greater the brightness difference between the first preview scene image to which the first brightness histogram belongs and the first image template; Taking the first preview scene image with the smallest weighted quantity difference among the plurality of first preview scene images as the first preview scene image with the smallest brightness difference from the first image template.

3. The method according to claim 1, wherein Performing first composition analysis based on the target preview image and the target photographing object therein to determine a target position of the photographing device relative to the reference position, including: Performing contour extraction on the target photographing object in the target preview image to obtain a plurality of first boundary points; Performing boundary point prediction based on the positions of the plurality of first boundary points in the target preview image to obtain corresponding plurality of predicted boundary points; Based on the positions of the plurality of predicted boundary points in the target preview image and the positions of the plurality of first boundary points in the target preview image, determining the target position of the photographing device relative to the reference position.

4. The method according to any one of claims 1 to 3, characterized in that Determining the final photograph image of the photographing device at the target position, including: In response to receiving a photographing instruction, obtain an initial photographed image captured by the photographing device at the target position, where the initial photographed image includes the target photographed object; Based on the initial photographed image and the target photographed object therein, perform a second composition analysis to determine cropping parameters; Crop the initial photographed image using the cropping parameters to obtain the final photographed image; Among them, the method of the second composition analysis is different from the method of the first composition analysis.

5. The method according to claim 4, characterized in that, Based on the initial photographed image and the target photographed object therein, perform a second composition analysis to determine cropping parameters, including: Extract the contour of the target photographed object in the initial photographed image to obtain a plurality of second boundary points; For each edge line of the initial photographed image, determine several second boundary points with a smaller distance from the edge line among the plurality of second boundary points to obtain a boundary point set corresponding to the edge line; For each boundary point set corresponding to an edge line, calculate the average value of the distances between each second boundary point in the boundary point set and the edge line, and denote it as the average distance corresponding to the edge line; Based on the average distances corresponding to the respective edge lines of the initial photographed image, determine the cropping parameters.

6. The method according to claim 4, characterized in that, The photographing instruction is triggered after receiving a start photographing prompt; After confirming that the actual position of the photographing device is consistent with the target position, the method further includes: In the preview mode of the photographing device, obtain a second preview scene image captured by the photographing device at the target position; Determine the average brightness value of the second preview scene image, and calculate the difference between the average brightness value and the average brightness value of the first image template, and denote it as the average brightness difference; Based on the average brightness difference, adjust the exposure parameters of the photographing device, then re-obtain the second preview scene image captured by the photographing device at the target position based on the adjusted exposure parameters and re-determine the average brightness difference until the re-determined average brightness difference is less than a preset brightness difference, and issue the start photographing prompt.

7. A photographing device, characterized in that, Including: A preview scene image acquisition module, configured to, in the preview mode of the photographing device, acquire a plurality of first preview scene images captured by the photographing device at multiple shooting positions, where each first preview scene image includes a target photographed object; A brightness difference analysis module, configured to perform brightness difference analysis on the plurality of first preview scene images and a first image template selected by a user respectively, and determine a first preview scene image with the smallest brightness difference from the first image template, denoted as the target preview image, and the shooting position corresponding to the target preview image is denoted as the reference position; A first composition analysis module, configured to perform a first composition analysis based on the target preview image and the target photographed object therein to determine the target position of the photographing device relative to the reference position; A shooting prompt module, which is used to prompt the user to move the photographing device based on the difference between the actual position and the target position of the photographing device until it is confirmed that the distance between the actual position of the photographing device and the target position is less than a preset distance, and to determine the final photographed image of the photographing device at the target position.

8. A storage medium having a computer program stored thereon, characterized in that, When the computer program is run by a processor, it executes the steps of the photographing method according to any one of claims 1 to 6.

9. A terminal, comprising a memory and a processor, wherein a computer program capable of running on the processor is stored on the memory, characterized in that When the processor runs the computer program, it executes the steps of the photographing method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is run by a processor, it executes the steps of the photographing method according to any one of claims 1 to 6.