Focus method, device and storage medium of image
By dividing the region of interest in an image into multiple candidate window regions, determining the priority based on the status information of these regions, and adopting an adaptive focusing strategy, the target window region is determined for focusing. This solves the problem of inaccurate focusing on mobile terminals, reduces hardware costs, and improves focusing accuracy.
Patent Information
- Application Number
- CN202111122789.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-24
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-09-24
AI Technical Summary
In existing technologies, mobile terminals suffer from inaccurate focusing when focusing images, especially for images without a clear foreground. Furthermore, the current focusing methods increase hardware costs and may result in focusing failures in images without clear foreground or background.
By dividing the region of interest (ROI) of an image into multiple candidate window regions, priorities are determined based on the status information of the candidate window regions. Based on the technical status information of the candidate window regions, a priority is determined in relation to the status information and the window information. Based on the priority of the window information, a priority is determined again. Based on the status information of the window regions, a focus strategy corresponding to the priority is used to determine the target window region. Focusing is then performed on the target window region.
It improves focusing accuracy, reduces hardware costs, and minimizes focusing inaccuracies, especially in images with clear foreground and background, accurately identifying foreground objects and improving focusing accuracy.
Smart Images

Figure CN115866396B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of image processing, and particularly relates to a focusing method and device of an image and a storage medium. BACKGROUND
[0002] With the development of technology and the expansion of user demand, mobile terminals are usually configured with camera functions so that users can take pictures through the camera function of the mobile terminal. In order to meet the user's requirement for image quality and obtain clearer images, the mobile terminal needs to perform focusing processing before image acquisition.
[0003] With the development of focusing technology, the focusing mode has developed from manual focusing to automatic focusing. By configuring corresponding hardware devices (such as depth sensors) on the mobile terminal, the foreground and the background are perceived to assist the automatic focusing technology to determine the foreground object, so as to quickly and accurately focus on the foreground object of the image.
[0004] However, the above-mentioned method increases the hardware cost of the mobile terminal on the one hand, and on the other hand, for images without obvious foreground and background, the focusing may be inaccurate or even fail. SUMMARY
[0005] The present disclosure provides a focusing method and device of an image and a storage medium.
[0006] According to a first aspect of an embodiment of the present disclosure, a focusing method of an image is provided, comprising:
[0007] obtaining a region of interest of a first image, the region of interest comprising at least two candidate window regions; wherein the image regions corresponding to different candidate window regions are at least partially different;
[0008] determining a priority matching the condition information according to the condition information of the candidate window regions;
[0009] determining a target window region from the first image based on a focusing strategy corresponding to the priority;
[0010] focusing on the target window region.
[0011] Optionally, the determining a priority matching the condition information according to the condition information of the candidate window regions comprises:
[0012] determining a maximum defocus distance difference between the at least two candidate window regions based on the defocus distances of the at least two candidate window regions;
[0013] if the maximum defocus distance difference is greater than the first threshold, determining that the priority matching the condition information is a first priority;
[0014] If the maximum defocus distance difference is greater than the first threshold value, a priority level matched with the condition information is determined as a second priority level.
[0015] Optionally, the determining the target window region from the first image based on the focus strategy corresponding to the priority level comprises:
[0016] The candidate window region corresponding to the minimum defocus distance is determined as the target window region based on a defocus distance corresponding to the first priority level.
[0017] Optionally, the determining the target window region from the first image based on the focus strategy corresponding to the priority level comprises:
[0018] The image content of the first image is subjected to saliency detection to obtain a saliency region and an image subject of the saliency region based on an image content corresponding to the second priority level.
[0019] If the image subject of the saliency region is a preset subject, the saliency region is determined as the target window region.
[0020] Optionally, the preset subject comprises a target object in a preset state and / or a first preset body part.
[0021] Optionally, the determining the target window region from the first image based on the focus strategy corresponding to the priority level further comprises:
[0022] If the image subject of the saliency region is not the preset subject, a second preset part detection is performed on the image content of the first image.
[0023] A region in the first image where a second preset body part is located is determined as the target window region.
[0024] Optionally, the saliency detection on the image content of the first image to obtain a saliency region and an image subject of the saliency region comprises:
[0025] A visual feature of the first image is extracted based on the image content of the first image.
[0026] The saliency region of the first image is determined based on the visual feature of the first image.
[0027] A region feature of the saliency region is extracted, and an image subject of the saliency region is obtained based on the image subject classification of the saliency region.
[0028] Optionally, the focusing on the target window region comprises:
[0029] If the target window region is a first type window region, performing phase focusing processing on the first type window region to determine a focus point position in the first type window region; and focusing on the first type window region based on the focus point position; wherein the first type window region is a target window region determined according to image content.
[0030] and / or,
[0031] performing contrast focusing processing on the first type window region to determine a focus point position in the first type window region; and focusing on the first type window region based on the focus point position.
[0032] Optionally, focusing on the target window region comprises:
[0033] If the target window region is a second type window region, determining a focus point position of the second type window region based on a defocus distance of the second type window region; and focusing on the second type window region based on the focus point position; wherein the second type window region is a target window region determined according to the minimum defocus distance.
[0034] Optionally, determining the maximum defocus distance difference between the at least two candidate window regions based on the defocus distances of the at least two candidate window regions comprises:
[0035] obtaining the confidence levels of the at least two candidate window regions;
[0036] determining a candidate window region with a confidence level satisfying a confidence threshold from the at least two candidate window regions;
[0037] determining the maximum defocus distance difference based on the defocus distance of the candidate window region satisfying the confidence threshold.
[0038] Optionally, focusing on the target window region comprises:
[0039] determining a target field of view FOV and a target focal length corresponding to the focus point position based on the focus point position;
[0040] In the focusing process, the focal length of the lens is controlled to be adjusted to the target focal length, and the first image is cropped based on the target field of view FOV to obtain a second image; the second image is an image region corresponding to the target field of view FOV in the first image.
[0041] Optionally, the method further comprises:
[0042] The first image is a currently captured commodity recommendation video picture.
[0043] According to a second aspect of the embodiments of the present disclosure, there is provided a focusing device for an image, comprising:
[0044] an acquisition module configured to acquire a region of interest of a first image, the region of interest comprising at least two candidate window regions; wherein the image regions corresponding to different candidate window regions are at least partially different;
[0045] a determination module configured to determine a priority matching the condition information according to the condition information of the candidate window regions; and determine a target window region from the first image based on a focusing strategy corresponding to the priority;
[0046] a focusing module configured to focus the target window region.
[0047] Optionally, the determination module is configured to:
[0048] determine a maximum defocus distance difference between the at least two candidate window regions based on the defocus distances of the at least two candidate window regions;
[0049] if the maximum defocus distance difference is greater than the first threshold, determine that the priority matching the condition information is a first priority;
[0050] if the maximum defocus distance difference is greater than the first threshold, determine that the priority matching the condition information is a second priority.
[0051] Optionally, the determination module is further configured to:
[0052] determine the candidate window region corresponding to the minimum defocus distance as the target window region based on the defocus distance corresponding to the first priority.
[0053] Optionally, the determination module is further configured to:
[0054] perform saliency detection on the image content of the first image based on the image content corresponding to the second priority, to obtain a saliency region and an image subject of the saliency region;
[0055] if the image subject of the saliency region is a preset subject, determine the saliency region as the target window region.
[0056] Optionally, the preset subject comprises a target object in a preset state and / or a first preset body part.
[0057] Optionally, the determination module is further configured to:
[0058] if the image subject of the saliency region is not the preset subject, perform second preset part detection on the image content of the first image.
[0059] determining a region where a second preset body part in the first image is located as the target window region.
[0060] Optionally, the determining module is further configured to:
[0061] extract visual features of the first image based on image content of the first image;
[0062] determine a salient region of the first image according to the visual features of the first image;
[0063] extract region features of the salient region, perform image subject classification based on the region features of the salient region to obtain an image subject of the salient region.
[0064] Optionally, the focusing module is configured to:
[0065] if the target window region is a first type of window region, perform phase focusing processing on the first type of window region to determine a focus point position in the first type of window region, and perform focusing on the first type of window region based on the focus point position; the first type of window region is a target window region determined according to image content.
[0066] and / or,
[0067] perform contrast focusing processing on the first type of window region to determine a focus point position in the first type of window region, and perform focusing on the first type of window region based on the focus point position.
[0068] Optionally,
[0069] the focusing module is configured to:
[0070] if the target window region is a second type of window region, determine a focus point position of the second type of window region based on a defocus distance of the second type of window region, and perform focusing on the second type of window region based on the focus point position; the second type of window region is a target window region determined according to the minimum defocus distance.
[0071] Optionally, the determining module is further configured to:
[0072] obtain a confidence level of the at least two alternative window regions;
[0073] determine an alternative window region whose confidence level meets a confidence level threshold from the at least two alternative window regions;
[0074] determine the maximum defocus distance difference based on a defocus distance of the alternative window region that meets the confidence level threshold.
[0075] Optionally, the focusing module is further configured to:
[0076] determine a target field of view FOV and a target focal length corresponding to the focus point position based on the focus point position;
[0077] in the focusing process, control the lens focal length to be adjusted to the target focal length, and crop the first image based on the target field of view FOV to obtain a second image; the second image is an image region corresponding to the target field of view FOV in the first image.
[0078] Optionally, the first image is a currently captured commodity recommendation video screen.
[0079] According to a third aspect of the embodiments of the present disclosure, an image focusing device is provided, comprising:
[0080] a processor;
[0081] a memory for storing executable instructions;
[0082] The processor is configured to implement the steps in the image focusing method according to the first aspect of the embodiments of the present disclosure when executing the executable instructions stored in the memory.
[0083] According to a fourth aspect of the embodiments of the present disclosure, a non-transitory computer readable storage medium is provided, when the instructions in the storage medium are executed by a processor of an image focusing device, the image focusing device can perform the steps in the image focusing method according to the first aspect of the embodiments of the present disclosure.
[0084] The technical solutions provided by the embodiments of the present disclosure can include the following beneficial effects:
[0085] The embodiments of the present disclosure divide the region of interest in the first image into a plurality of alternative window regions, determine the priority adapted to the condition information of the plurality of alternative window regions according to the condition information, and determine the target window region in the first image based on the focusing strategy defined by the adapted priority, so that for an image with obvious foreground and background, the target window region where the foreground object is located can be determined according to the condition information of each alternative window region, without the need to additionally increase hardware devices to identify the foreground object, thereby reducing the hardware cost. In combination with the condition information priority, the object to be focused can be determined from the first image according to the condition information of the alternative window region and the focusing reference importance degree (corresponding to the priority) of different condition information; the region where the object to be focused is located is determined as the target window region to be focused, and the target window region is focused, so as to improve the accuracy of focusing.
[0086] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0087] The accompanying drawings, which are incorporated in and form a part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
[0088] Figure 1 is a flowchart of a focusing method of an image according to an exemplary embodiment Figure 1 .
[0089] Figure 2 is a flowchart of a focusing method of an image according to an exemplary embodiment Figure 2 .
[0090] Figure 3 is a diagram of field of view angle frame compensation according to an exemplary embodiment.
[0091] Figure 4 is an image processed based on a focusing method of an image in the related art.
[0092] Figure 5 is an image processed based on a focusing method of an image according to an embodiment of the present disclosure.
[0093] Figure 6 is a flowchart of a good object recommendation method according to an exemplary embodiment.
[0094] Figure 7 is a framework diagram of an image focusing algorithm according to an exemplary embodiment.
[0095] Figure 8 is a flowchart of a multi-window phase focusing method according to an exemplary embodiment.
[0096] Figure 9 is a flowchart of a target object focusing method according to an exemplary embodiment.
[0097] Figure 10 is a flowchart of a face focusing method according to an exemplary embodiment.
[0098] Figure 11 is a structural diagram of a focusing device of an image according to an exemplary embodiment.
[0099] Figure 12 is a block diagram of a focusing device of an image according to an exemplary embodiment. DETAILED DESCRIPTION
[0100] The exemplary embodiments will be described in detail below with reference to the drawings. The following description is presented in connection with the drawings, in which the same reference numerals are used to designate the same or similar elements throughout the different figures. The implementations described in the following exemplary embodiments are not meant to represent all implementations consistent with the present disclosure. Rather, they are merely examples that are consistent with some aspects of the present disclosure as detailed in the appended claims.
[0101] The embodiment of the present disclosure provides a focusing method of an image. Figure 1 Fig. 1 is a flowchart of a focusing method of an image according to an exemplary embodiment Figure 1 As shown in Fig. 1, the method comprises the following steps. Figure 1 As shown in Fig. 1, the method comprises the following steps.
[0102] In step S101, a region of interest of a first image is acquired, the region of interest comprising at least two alternative window regions; wherein the image regions corresponding to different alternative window regions are at least partially different;
[0103] In step S102, a priority matching the condition information of the alternative window regions is determined according to the condition information of the alternative window regions;
[0104] In step S103, a target window region is determined from the first image based on the focusing strategy corresponding to the priority;
[0105] In step S104, the target window region is focused.
[0106] In the embodiment of the present disclosure, the focusing method of the image can be executed by a focusing device of the image, which can be configured in a terminal device, and the terminal device has at least one camera.
[0107] Here, the form of the camera provided in the terminal device is not limited, for example, it can be a camera built-in the terminal device, or a camera external to the terminal device. It can be a front camera or a rear camera. The camera on the terminal device can be any type of camera, for example, the camera can be a color camera, a black and white camera, a depth camera, a long-focus camera or a wide-angle camera, etc. The terminal device can include a smartphone, a tablet computer or a notebook computer, etc.
[0108] In step S101, the first image can be a preview image collected by the terminal device, or a frame image in a video recorded by the terminal device. The region of interest refers to the region that needs to be processed in the image processing process, which is outlined in the form of a box, a circle, an ellipse or an irregular polygon from the image to be processed.
[0109] The region of interest can include a background and an object.
[0110] The image region of the first image with a preset size at the center can be obtained according to the center point of the first image.
[0111] In some embodiments, the region of interest selected by the user can be obtained according to the received trigger instruction for the first image, wherein the trigger instruction can be an instruction generated when the user clicks the first image.
[0112] After the region of interest in the first image is determined, the region of interest can be divided into a plurality of candidate window regions. Here, the size and shape of each candidate window region obtained by division can be the same or different. The specific division method is not limited.
[0113] In some embodiments, the region of interest can be divided into MxN candidate window regions, wherein M and N are positive integers.
[0114] It should be noted that, during the focusing process, the region of interest can include too much background information, which can easily affect the focusing result, causing the focus point to be on the background region in the region of interest rather than the foreground region intended by the user for focusing, resulting in inaccurate focusing. Therefore, after obtaining the region of interest from the first image, the region of interest needs to be further divided into a plurality of candidate window regions, and the image content of the plurality of candidate window regions is further processed to determine the target window region intended by the user for focusing.
[0115] In step S102, the priority can be the priority corresponding to different focusing strategies preset in advance. It can be understood that the focusing strategies corresponding to different priorities are different.
[0116] It should be noted that the priority of the different focusing strategies can be determined by the influence degree of the object to be focused determined by the different focusing strategies on image focusing. For example, there are foreground objects and background objects in the image. If the foreground objects in the image are not focused, the region corresponding to the foreground objects in the focused image can appear blurred, resulting in an unclear image. That is, the influence degree of the foreground objects in the image on image focusing is large, and the focusing strategy for focusing the foreground objects in the image can be determined as the first priority focusing strategy.
[0117] The embodiments of the present disclosure can determine the priority matched with the condition information of the plurality of candidate window regions by matching the condition information of the plurality of candidate window regions with the trigger conditions defined by different priorities.
[0118] Here, the condition information can be any information capable of describing the candidate window region, and exemplary, the condition information includes but is not limited to: information of a shooting state and / or shooting content of the candidate window region; for example, the condition information can include: defocus information and / or content of the candidate window region.
[0119] The trigger condition defined by the different priorities can be set according to actual needs; for example, if the object to be focused corresponding to the first priority is a foreground object, the trigger condition defined by the first priority can be: the condition information of the plurality of candidate window regions indicates that the image is a depth-of-field difference image.
[0120] Therefore, when determining the target window region, the condition information of the plurality of candidate window regions can be determined whether the condition information can adapt to the trigger condition defined by the first priority, if the condition information can adapt to the trigger condition defined by the first priority, the target window region can be determined from the plurality of candidate window regions by the method defined by the first priority; if the condition information cannot adapt to the trigger condition defined by the first priority, it can be determined whether the condition information can adapt to the trigger condition defined by the second priority; in succession, the target priority adapted to the condition information is determined, and the target window region is determined based on the method defined by the target priority, thereby improving the accuracy of focusing.
[0121] In step S103, after determining the priority matched with the condition information, the region where the object to be focused corresponding to the focusing strategy is located in the first image is determined according to the focusing strategy corresponding to the priority, and the region where the object to be focused is located is determined as the target window region.
[0122] In step S104, after determining the target window region, the image acquisition unit is controlled to focus on the target window region based on the position information of the target window region.
[0123] It should be noted that the purpose of focusing is to adjust the focus of the image acquisition unit (such as a camera) to the target window region that needs to be focused, so that the focused image is clearer.
[0124] The embodiment of the present disclosure divides the region of interest in the first image into a plurality of candidate window regions, determines a priority level that matches the condition information of the plurality of candidate window regions, and determines a target window region in the first image based on a focus strategy defined based on the matched priority level, so that for an image with obvious foreground and background, the target window region where the foreground object is located can be determined according to the condition information of each candidate window region, without the need to additionally increase hardware devices to identify the foreground object, thereby reducing the hardware cost. In combination with the condition information priority level, the object to be focused can be determined from the first image according to the condition information of the candidate window region and the focusing reference importance degree (corresponding to the priority level) of different condition information; the region where the object to be focused is located is determined as the target window region to be focused, and the target window region is focused, so as to improve the accuracy of focusing.
[0125] Optionally, the step S102 of determining the priority level that matches the condition information of the candidate window region comprises:
[0126] determining a maximum defocus distance difference between the at least two candidate window regions based on the defocus distances of the at least two candidate window regions.
[0127] if the maximum defocus distance difference is greater than the first threshold value, determining that the priority level that matches the condition information is a first priority level.
[0128] if the maximum defocus distance difference is greater than the first threshold value, determining that the priority level that matches the condition information is a second priority level.
[0129] In the embodiment of the present disclosure, the defocus distance difference between any two candidate window regions can be determined according to the defocus distances of the plurality of candidate window regions; the maximum defocus distance difference is determined according to the defocus distance difference between the any two candidate window regions.
[0130] In other embodiments, the maximum defocus distance and the minimum defocus distance can also be determined according to the defocus distances of the plurality of candidate window regions; the maximum defocus distance difference between the at least two candidate window regions is determined based on the maximum defocus distance and the minimum defocus distance.
[0131] It should be noted that the defocus distance can reflect the distance between the object in the candidate window region and the camera; the maximum defocus distance difference between the plurality of candidate window regions can reflect the distance difference between the foreground and the background in the first image.
[0132] The maximum defocus distance difference between the at least two candidate window regions is compared with a first threshold value to determine whether the maximum defocus distance difference between the at least two candidate window regions meets the triggering condition of the first priority level.
[0133] Here, the trigger condition of the first priority can be that a maximum defocus distance difference between the at least two alternative window regions is greater than the first threshold value;
[0134] If the maximum defocus distance difference is greater than the first threshold value, that is, the trigger condition of the first priority is met, at this time, the distance difference between the foreground and the background in the first image is large, and the foreground and the background are clearly distinguished, the first priority can be determined as the priority matched with the condition information, and the first image is focused based on the focusing strategy corresponding to the first priority.
[0135] It should be noted that the focusing strategy corresponding to the first priority can be to determine the foreground region of the image as the target window region; since when the foreground and the background in the image are clearly distinguished, the foreground region of the image needs to be focused first to reduce the blurring of the foreground region of the image.
[0136] If the maximum defocus distance difference is less than the first threshold value, that is, the trigger condition of the first priority is not met, at this time, the distance difference between the foreground and the background in the first image is small, and the foreground and the background are not clearly distinguished, the second priority can be determined as the priority matched with the condition information, and the first image is focused based on the focusing strategy corresponding to the second priority.
[0137] In the embodiments of the present disclosure, the maximum defocus distance difference between the plurality of alternative window regions is determined according to the defocus distances of the plurality of alternative window regions, whether the first image belongs to a depth-of-field difference image is determined according to the maximum defocus distance difference, and different priority focusing strategies are used for the case that the first image belongs to a depth-of-field difference image and the case that the first image does not belong to a depth-of-field difference image, so that the first image is focused according to different situations, and the accuracy of focusing is improved.
[0138] Optionally, the step S103 of determining the target window region from the first image based on the focusing strategy corresponding to the priority comprises:
[0139] The alternative window region corresponding to the minimum defocus distance is determined as the target window region based on the defocus distance corresponding to the first priority.
[0140] In the embodiments of the present disclosure, if the priority matched with the condition information is the first priority, that is, the foreground and the background in the first image are clearly distinguished, and the object to be focused in the first image is the foreground region.
[0141] The plurality of alternative window regions can be subjected to multi-window phase focusing detection, and the alternative window region (that is, the region where the foreground is located) corresponding to the minimum defocus distance is determined as the target window region based on the multi-window phase focusing detection result.
[0142] It should be noted that the defocus distance refers to a distance between a position where the candidate window region is imaged and a position where an intersection point is located in a state of focus; the greater the defocus distance, the farther the position where the candidate window region is imaged is from a focus point, and the smaller the defocus distance, the closer the position where the candidate window region is imaged is to the focus point. Here, the state of focus refers to a state of successful focusing.
[0143] In this way, for an image with obvious foreground and background, the candidate window region corresponding to the minimum defocus distance (i.e., the window region where the foreground object is located) can be determined as the target window region to be focused according to the defocus distances of the candidate window regions, so that the foreground object does not need to be identified by additionally increasing hardware devices, thereby reducing hardware costs.
[0144] Optionally, the step S103 of determining the target window region from the first image based on the focus strategy corresponding to the priority includes:
[0145] performing saliency detection on image content of the first image based on image content corresponding to a second priority, to obtain a saliency region and an image subject of the saliency region;
[0146] if the image subject of the saliency region is a preset subject, determining the saliency region as the target window region.
[0147] In the embodiments of the present disclosure, if the priority matching the condition information is the second priority, i.e., the foreground and background in the first image are not obviously distinguished, saliency detection can be performed on the first image based on image content of the first image, and the target window region is determined from the first image according to a saliency detection result.
[0148] Here, the preset subject is an object that the user wants to focus on, and the preset subject can be set according to actual needs.
[0149] It should be noted that for an image, the saliency region of the image is a region in the image that is most likely to attract the attention of the user, and the image subject in the image region best represents the image content and image information included in the image region.
[0150] The saliency region in the first image and the image subject of the saliency region can be determined by performing saliency detection on the first image; and the target window region to be focused is determined according to whether the image subject of the saliency region is a preset subject.
[0151] In the embodiments of the present disclosure, the first image can be subjected to saliency detection based on a saliency region algorithm. For example, the saliency region algorithm can be a histogram-based global contrast analysis method, which is used to make histogram statistics on the colors of the first image. According to the probabilities of various colors appearing in the first image and the color distances between the current color and other colors, the saliency values corresponding to the various colors are calculated. According to the color saliency values of each pixel point in the first image, normalization processing is performed to obtain the saliency region of the first image, and the position of the candidate window region corresponding to the saliency region is determined.
[0152] In the embodiments of the present disclosure, the saliency region of the first image is obtained through saliency detection, and whether the image subject of the saliency region is a preset subject that a user wants to focus on is determined based on the saliency region. On the one hand, the saliency region that is most likely to attract the attention of the user in the first image is determined through saliency detection of the first image, so as to reduce the search range of the target window and improve the focusing efficiency. On the other hand, the image subject that best represents the image content and image information in the saliency region is determined, and when the image subject is the preset subject that the user wants to focus on, the saliency region is determined as the target window region, thereby improving the accuracy of focusing.
[0153] Optionally, the preset subject includes a target object in a preset state and / or a first preset body part.
[0154] In the embodiments of the present disclosure, the target object and the first preset body part can be an object to be focused on which is pre-set by the user. For example, the target object is a mobile phone, and the first preset body part is a hand, so the preset subject, i.e., the object to be focused on, can be a hand region holding the mobile phone in the image. For another example, the target object is a shoe, and the first preset body part is a leg, so the preset subject, i.e., the object to be focused on, can be a leg region wearing the shoe in the image.
[0155] In some embodiments of the present disclosure, the target object can be multiple objects, and the mobile terminal stores object priorities of the multiple objects. If the image subject of the detected saliency region is a single object, the candidate window region in which the target object is located is determined as the target window region. If the image subject of the detected saliency region is multiple objects, the candidate window region in which the object with the highest priority in the saliency region is located can be determined as the target window region according to the preset object priorities.
[0156] In some other embodiments of the present disclosure, if the image subject of the detected saliency region is multiple objects, a focusing object selection interface is displayed for the user to select the object to be focused on based on the focusing object selection interface, and the candidate window region in which the object to be focused on is located is determined as the target window region.
[0157] Optionally, the step S103 of determining the target window region from the first image based on the focusing strategy corresponding to the priority further comprises:
[0158] If the image subject of the saliency region is not the preset subject, performing second preset part detection on the image content of the first image;
[0159] Determining a region in the first image where the second preset body part is located as the target window region.
[0160] In the embodiments of the present disclosure, the second preset body part can be a to-be-focused object pre-set by a user, and the second preset body part and the first preset identity part can be different body parts of the user.
[0161] If the image subject of the saliency region detected is not the preset subject, the second preset part detection can be performed on the first image, and if the second preset identity part is detected in the first image, a region in the first image where the second preset identity part is located can be determined as the target window region.
[0162] For example, if the second preset identity part is a face, a face detection algorithm can be used to perform face detection on the first image to detect a target face, and a region in the first image where the target face is located can be determined as the target window region.
[0163] For another example, if the second preset body part is an eye, a face detection algorithm can be used to determine a face region from the first image, feature information of the face region can be extracted, the feature information of the face region can be classified to determine an eye region in the face region.
[0164] Optionally, the step of performing saliency detection on the image content of the first image to obtain a saliency region and an image subject of the saliency region further comprises:
[0165] extracting visual features of the first image based on the image content of the first image;
[0166] determining a saliency region of the first image according to the visual features of the first image;
[0167] extracting region features of the saliency region, performing image subject classification based on the region features of the saliency region to obtain an image subject of the saliency region.
[0168] In the embodiments of the present disclosure, the visual features include, but are not limited to, at least one of color features, edge features, texture features, and visual saliency.
[0169] The visual features of the first image are extracted by performing visual feature extraction on the first image; and saliency recognition is performed on the first image based on the visual features of the first image to determine a saliency region in the first image.
[0170] The saliency region in the first image is determined; feature extraction is performed on the saliency region to obtain region features of the saliency region, so that the image subject of the saliency region is classified according to the region features of the saliency region to obtain a classification result; and the image subject of the saliency region in the first image is determined according to the classification result.
[0171] Here, the visual features of the saliency region can be reduced in dimension by a pooling process to obtain the region features of the saliency region. The pooling process can include maximum pooling, average pooling, or generalized mean pooling, etc. It should be understood that the pooling process of the embodiments of the present disclosure is not limited to the above-mentioned several types.
[0172] Optionally, the focusing on the target window region in the step S103 includes:
[0173] If the target window region is a first type window region, performing phase focusing processing on the first type window region to determine a focus point position in the first type window region; and focusing on the first type window region based on the focus point position; wherein the first type window region is a target window region determined according to image content.
[0174] and / or,
[0175] performing contrast focusing processing on the first type window region to determine a focus point position in the first type window region; and focusing on the first type window region based on the focus point position.
[0176] In the embodiments of the present disclosure, the target window region determined according to the region features of the alternative window region is determined as the first type window region; phase focusing processing and / or contrast focusing processing are performed on the first type window region, and the first type window region is focused according to the focus point position obtained by the phase focusing processing and / or the contrast focusing processing.
[0177] Here, the focus point position can include a moving direction and / or a moving distance. The moving direction indicates the direction in which the lens needs to move in order to obtain a clear image; and the moving distance indicates the distance in which the lens needs to move in the moving direction in order to obtain a clear image. In other words, the focus point position can indicate the position in which the lens needs to be in order to obtain a clear image.
[0178] It should be noted that the phase focusing principle is that some shielding pixel points are reserved on the photosensitive element, which are specially used for phase detection of images, a light beam is split into two light beams by a phase focusing detector, and the two light beams are projected on two photosensitive elements of the phase focusing detector respectively to obtain a set of light sensing signals, phase difference information is obtained by using the set of light sensing signals, the distance between pixels and the change thereof are determined according to the phase difference information, and the offset value of focusing is determined, so that accurate focusing is realized; the contrast focusing principle is that the lens position (i.e. the position of the focus point) when the contrast of the image generated at different focusing distances is maximum is determined according to the contrast change.
[0179] Optionally, the focusing on the target window region in the step S103 comprises:
[0180] If the target window region is a second type window region, a focus point position of the second type window region is determined based on a defocus distance of the second type window region, and the second type window region is focused based on the focus point position; wherein the target window region is determined as the second type window region according to the minimum defocus distance.
[0181] In the embodiment of the present disclosure, the target window region determined according to the minimum defocus distance is determined as the second type window region; since the defocus distance of the second type window region is used to indicate the distance difference between the current lens position and the focus point position, the focus point position of the second type window region can be determined according to the defocus distance of the second type window region, and the lens position is adjusted according to the focus point position to focus on the second type window region.
[0182] Optionally, the determining the maximum defocus distance difference between the at least two alternative window regions according to the defocus distances of the at least two alternative window regions comprises:
[0183] Obtaining the confidence of the at least two alternative window regions;
[0184] Determining the alternative window region whose confidence satisfies the confidence threshold from the at least two alternative window regions;
[0185] Determining the maximum defocus distance difference based on the defocus distance of the alternative window region satisfying the confidence threshold.
[0186] In the embodiments of the present disclosure, the confidence level is used to represent whether the defocus distance of the candidate window region is accurate; the higher the confidence level of the candidate window region is, the more accurate the defocus distance of the candidate window region is. For example, the phase focus sensor can perform phase focus detection on at least two candidate window regions of the first image, and obtain the numerical value of the phase focus confidence level (Phase Detection confidence level) of the at least two candidate window regions output by the phase focus sensor, that is, the confidence level.
[0187] By obtaining the confidence level of each candidate window region, the validity of each candidate window region can be determined according to the confidence level of each candidate window region. If the confidence level of the candidate window region is greater than the confidence threshold, it indicates that the candidate window region is a valid window region. According to the defocus distances of each valid window region in the region of interest, the maximum defocus distance difference between the at least two candidate window regions can be determined, thereby improving the accuracy of the maximum defocus distance difference and the focusing accuracy.
[0188] Optionally, the focusing on the target window region comprises:
[0189] Based on the focus point position, a target field of view FOV corresponding to the focus point position and a target focal length are determined.
[0190] In the focusing process, the focal length of the lens is controlled to be adjusted to the target focal length, and the first image is cropped based on the target field of view FOV to obtain a second image; the second image is an image region corresponding to the target field of view FOV in the first image.
[0191] In the embodiments of the present disclosure, after the focus point position is determined, a FOV corresponding to the focus point position and a target focal length are determined according to the focus point position. In the process of focusing on the target window region, the lens is controlled to move to the focus point position, and the focal length of the lens is gradually adjusted to the target focal length as the lens moves. According to the target field of view FOV, a cropping ratio of the first image is determined. The first image is cropped according to the cropping ratio to obtain a second image, and the second image is output.
[0192] It should be noted that the field of view angle is also called field of view. In optical instruments, the field of view angle is the angle between the two edges of the maximum range of the camera of the optical instrument, with the camera as the vertex, and the image of the measured target. The size of the field of view angle determines the field of view range of the optical instrument. The larger the field of view angle is, the larger the field of view is, and the smaller the optical magnification is. Generally, the relationship between the field of view angle and the focal length is that the larger the field of view angle is, the shorter the focal length is.
[0193] When the field of view angle is small, the shaking of the camera has a greater impact on the stability of the captured image because the field of view angle corresponds to a larger light sensing area; when the field of view angle is large, the shaking of the camera has a smaller impact on the stability of the captured image because the field of view angle corresponds to a smaller light sensing area; therefore, during the focusing process, the movement of the camera causes the focal length to change, thereby changing the field of view angle; the captured image is cropped according to the field of view angle, thereby reducing the change in the stability of the image caused by the change in the field of view angle.
[0194] Optionally, the first image is a currently captured image of a commodity recommendation video.
[0195] In the embodiments of the present disclosure, the commodity recommendation video can be a commodity recommendation video being recorded, such as an advertisement video being recorded; or can be a live commodity recommendation video, such as a live video of selling goods.
[0196] For example, from a commodity recommendation video being recorded, a current captured image of a camera is obtained, the current captured image is focused, and an image after focusing is obtained as a focused video frame image; based on a plurality of focused video frame images, a focused commodity recommendation video is generated according to the playing time order of the focused video frame images.
[0197] For another example, a current live image of a commodity recommendation video is obtained, the current live image is subjected to focusing processing, and the live image after focusing is pushed to a corresponding live room for display.
[0198] The present disclosure also provides the following embodiments:
[0199] Figure 2 is a flowchart of a focusing method of an image according to an exemplary embodiment Figure 2 , the method comprising:
[0200] In step S201, a region of interest of a first image is obtained, and the region of interest is divided into at least two alternative window regions, wherein the image regions corresponding to different alternative window regions are at least partially different.
[0201] In the present example, the first image is a currently captured image of a commodity recommendation video. The commodity recommendation video is a commodity recommendation video being recorded.
[0202] From a commodity recommendation video being recorded, a first image currently captured by a camera is obtained, a preset size of image at the image center of the first image is intercepted as a region of interest of the first image, and the intercepted region of interest is divided into MxN alternative window regions; here, M and N are both positive integers.
[0203] In step S202, a maximum defocus distance difference between the at least two candidate window regions is determined based on the defocus distances of the at least two candidate window regions according to a defocus distance corresponding to a first priority defined by the focusing strategy; and if the maximum defocus distance difference is greater than a first threshold, the candidate window region corresponding to the minimum defocus distance is determined as the second type of window region.
[0204] In the present example, the first priority defined by the focusing strategy is to determine the second type of window region in which the foreground of the first image is located from the at least two candidate window regions based on a multi-window focusing algorithm.
[0205] For example, the defocus distances of the at least two candidate window regions are determined based on a multi-window focusing algorithm; the maximum defocus distance and the minimum defocus distance are determined according to the defocus distances of the at least two candidate window regions; and the maximum defocus distance difference is determined based on the maximum defocus distance and the minimum defocus distance. If the maximum defocus distance difference is greater than a first threshold, it means that the shooting scene of the first image belongs to a depth-of-field difference scene, i.e., the foreground and the background in the first image are obviously different. Therefore, the window region in which the foreground is located can be determined according to the defocus distances of the at least two candidate window regions, so that the window region in which the foreground is located can be focused on later.
[0206] Here, the candidate window region corresponding to the minimum defocus distance can be determined as the window region in which the foreground is located (i.e., the second type of window region).
[0207] In some embodiments, the determination of the maximum defocus distance difference between the at least two candidate window regions based on the defocus distances of the at least two candidate window regions can include:
[0208] Obtaining the confidence of the at least two candidate window regions;
[0209] Determining the candidate window region whose confidence satisfies a confidence threshold from the at least two candidate window regions;
[0210] Determining the maximum defocus distance difference based on the defocus distance of the candidate window region whose confidence satisfies the confidence threshold.
[0211] In the present example, the confidence is used to represent whether the defocus distance is accurate. The higher the confidence of a certain candidate window region is, the more accurate the defocus distance of the candidate window region is.
[0212] The out-of-focus distances and the reliabilities of the at least two candidate window regions can be determined based on a multi-window focusing algorithm; a candidate window region having a reliability satisfying a reliability threshold can be determined from the at least two candidate window regions according to the reliabilities; and the maximum out-of-focus distance difference can be determined based on the out-of-focus distance of the candidate window region satisfying the reliability threshold.
[0213] In step S203, a focus point position of the second-type window region can be determined based on the out-of-focus distance of the second-type window region, and the second-type window region can be focused based on the focus point position.
[0214] In this example, after the out-of-focus distance of the second-type window region is determined, a focus point position of the second-type window region can be determined according to the out-of-focus distance of the second-type window region, and the focus point position can be sent to a driving module of a lens to control the lens to focus on the second-type window region based on the focus point position.
[0215] In some embodiments, the method further includes determining whether a picture in the second-type window region is stable, and re-determining the second-type window region if the picture is not stable.
[0216] In this example, whether the picture in the second-type window region is stable, i.e., whether the picture in the focus window changes, is determined. If the picture is stable, it indicates that the foreground of the first image does not change, and refocusing is not needed. If the picture is not stable, it indicates that the foreground in the first image changes, and the second-type window region in the first image needs to be re-determined, and refocusing is needed.
[0217] In step S204, if the maximum out-of-focus distance difference is less than the first threshold, saliency detection can be performed on image content of the candidate window region based on image content corresponding to a second priority defined by the focusing strategy, to obtain a saliency region in the first image and image subject matter of the saliency region.
[0218] In this example, the second priority defined by the focusing strategy is that whether image subject matter of the saliency region of the first image is a preset subject matter is determined based on a saliency detection algorithm.
[0219] When the maximum out-of-focus distance difference is less than the first threshold, i.e., the first image shooting scene does not belong to a depth-of-field difference scene, i.e., the foreground and the background in the first image do not differ significantly, saliency detection can be performed on image content of the first image based on image content corresponding to a second priority defined by the focusing strategy, to obtain a saliency region in the first image and image subject matter of the saliency region.
[0220] It should be noted that, considering that the multi-window focusing algorithm cannot accurately distinguish the foreground and the background in the image, and cannot accurately focus on the foreground, for the image in which the foreground and the background are not obviously different, the present example determines the salient region in the image by performing saliency detection on the image, and determines whether to focus on the region in which the salient region is located in the first image according to the image subject of the salient region.
[0221] The saliency detection on the image content of the first image obtains a salient region in the first image and an image subject of the salient region, and includes:
[0222] Based on the image content of the first image, a visual feature of the first image is extracted;
[0223] According to the visual feature of the first image, a salient region of the first image is determined;
[0224] The region feature of the salient region is extracted, and an image subject classification is performed based on the region feature of the salient region, to obtain the image subject of the salient region.
[0225] In the present example, the visual feature of the first image is obtained by performing visual feature extraction on the first image; the salient region in the first image is determined based on the visual feature of the first image; the region feature of the salient region is obtained by performing feature extraction on the salient region; and the image subject of the salient region is classified according to the region feature of the salient region, to obtain a classification result.
[0226] In step S205, if the image subject of the salient region is a preset subject, the salient region is determined as a target window region; wherein the preset subject includes a target object in a preset state and / or a first preset body part.
[0227] In the present example, the target object in the preset state can be a recommended commodity, and the first preset body part is a hand of a user.
[0228] According to the classification result, if the classification result indicates that the image subject of the salient region is a hand holding the recommended commodity, the salient region is a target window region that needs to be focused.
[0229] If the classification result indicates that the image subject of the salient region in the candidate window region is not a hand holding the recommended commodity, face detection on the first image can be continued based on the third priority corresponding to the focusing strategy.
[0230] In step S206, if the image subject of the saliency region is not the preset subject, a second preset part detection is performed on the image content of the first image; a region in which a second preset body part in the first image is located is determined as a target window region.
[0231] In this example, the second preset body part is a human face, and the second preset part detection can be face detection.
[0232] If the classification result indicates that the image subject of the candidate window region in which the saliency region is located is not a hand holding the recommended product, face detection is continued on the first image based on face information corresponding to a third priority defined by the focusing strategy, and after a face is detected, a region in which the face is located is determined as a target window region to be focused.
[0233] In step S207, phase focusing processing is performed on the first type of window region to determine a focus point position in the first type of window region; the first type of window region is focused based on the focus point position; and / or contrast focusing processing is performed on the first type of window region to determine a focus point position in the first type of window region; the first type of window region is focused based on the focus point position; wherein the first type of window region is a target window region determined according to image content.
[0234] In this example, the first type of window region is a target window region determined based on a focusing strategy defined by the second priority or a focusing strategy defined by the third priority.
[0235] After the first type of window region is determined, phase focusing and / or contrast focusing can be performed on the first type of window region, and the first type of window region is focused according to a focus point position obtained by phase focusing and / or contrast focusing.
[0236] In some embodiments, the method further comprises:
[0237] Based on the focus point position, a target field of view FOV and a target focal length corresponding to the focus point position are determined.
[0238] During focusing, the focal length of the lens is controlled to be adjusted to the target focal length, and the first image is cropped based on the target field of view FOV to obtain a second image; the second image is an image region corresponding to the target field of view FOV in the first image.
[0239] In the present example, considering that during focusing, the field of view angle changes due to the adjustment of the focal length of the lens, the shaking of the lens can affect the stability of the image; in order to reduce the influence of the focusing process on the image stability, the target field of view angle and the target focal length can be determined according to the focusing point position; during the focusing process, when the focal length adjustment of the lens is controlled to be the target focal length, the image area outside the photosensitive area corresponding to the target field of view angle in the first image is cropped along with the change of the lens position.
[0240] It should be noted that, as Figure 3 , Figure 3 is a schematic diagram of field of view angle picture compensation according to an example embodiment. When the field of view angle is large, the image distance is small, and the photosensitive area corresponding to the field of view angle is large, at this time the shaking of the lens has a greater impact on the stability of the picture; when the field of view angle is small, the image distance is large, and the photosensitive area corresponding to the field of view angle is small, at this time the shaking of the lens has a smaller impact on the stability of the picture. During the focusing process, the field of view angle gradually increases and the photosensitive area corresponding to the field of view angle gradually decreases when the lens moves from position A to position B. In order to reduce the impact of lens shaking on the stability of the picture, the image area outside the photosensitive area corresponding to the field of view angle can be cropped.
[0241] Exemplarily, as Figure 4 , Figure 5 is shown, Figure 4 is an image processed based on the image focusing method in the related art; Figure 5 is an image processed based on the image focusing method according to the embodiment of the present disclosure; it can be seen that for the case of a small target object, the image focusing method in the related art cannot accurately focus on the target object, while the image focusing method according to the embodiment of the present disclosure can effectively focus on the target object and obtain a clear image.
[0242] Exemplarily, as Figure 6 is shown, Figure 6 is a flowchart of a good recommendation method according to an example embodiment. The good recommendation method is suitable for application scenarios such as live goods or commodity recommendation. For example:
[0243] Step S301, open the "goods mode" of the APP;
[0244] A separate mode can be pre-set to perform item priority aggregation display.
[0245] Step S302, capture a preview picture through a camera;
[0246] Step S303, start the video recording function;
[0247] Step S304, recording a goods video;
[0248] Step S305, starting an image focusing algorithm to perform image focusing on the goods video.
[0249] Here, the image focusing algorithm can be the image focusing method provided in one or more of the above technical solutions.
[0250] Step S306, based on the image focusing algorithm, controlling the priority focusing on the priority object.
[0251] Here, the present example designs three levels of priority to control the focusing of objects; as shown in Figure 7 Figure 7 is a framework diagram of an image focusing algorithm according to an example embodiment, which includes:
[0252] Step S3061, the first priority controls the focusing on the foreground object of the center window of the image.
[0253] Here, the first priority is: in the key area of the picture, multiple windows are divided, and based on the multi-window phase focusing method, the parameter values of the multiple windows are determined; based on the parameter values, the foreground in the image is determined, and the image is focused on the foreground object.
[0254] Step S3062, the second priority controls the focusing on the anchor handheld object in the image.
[0255] It should be noted that considering the case that the multi-window phase focusing method defined by the first priority cannot accurately focus when the image foreground and background are not clearly distinguished, when it is determined that the image does not belong to the depth of field difference scene, the focusing method defined by the second priority can be used to identify the window area where the anchor handheld object in the image is located, and the window area is focused.
[0256] In this way, in the live streaming goods / commodity recommendation scene, if the foreground and background in the video picture cannot be accurately distinguished, the anchor handheld object area in the video picture can be directly determined, and the area is focused.
[0257] Step S3063, the third priority controls the focusing on the anchor face in the image.
[0258] It should be noted that considering the case that the multi-window phase focusing method defined by the first priority cannot accurately focus when the image foreground and background are not clearly distinguished, and there is no anchor handheld object in the image, the focusing method defined by the third priority can be used to identify the window area where the theme face in the image is located, and the window area is focused.
[0259] Thus, in the live goods / commodity recommendation scene, if the foreground and the background in the video picture cannot be accurately distinguished, and the scene where the anchor holds an object does not appear in the video picture, the region where the face of the anchor is located is determined, and the region is focused.
[0260] In the focusing process, field of view FOV compensation is started in step S307.
[0261] In step S308, it is determined whether the focused picture is stable.
[0262] It can be understood that if the focused picture is stable, the image focusing process is continued for the next frame of video picture, and if the focused picture is not stable, the focusing is restarted for the frame of picture.
[0263] In step S309, after the image focusing process for each frame of picture in the video is completed, the recording is ended, and the video recording is generated.
[0264] Exemplarily, as shown in Figure 8 , Figure 8 is a flowchart of a multi-window phase focusing method according to an exemplary embodiment. The first priority controls the foreground object of the center window of the image to focus, including:
[0265] In step S401, a multi-window phase focusing algorithm is started.
[0266] In step S402, defocus values of the windows are obtained.
[0267] In step S403, the windows are sorted based on the defocus values.
[0268] In step S404, the confidence of each window is obtained, and the window satisfying the confidence threshold is determined.
[0269] In step S405, the window corresponding to the maximum defocus value and the window corresponding to the minimum defocus value are determined from the window satisfying the confidence threshold, and the defocus difference value is determined.
[0270] In step S406, whether the video picture belongs to the depth difference scene is determined according to the defocus difference value.
[0271] In step S407, if the defocus difference value is greater than or equal to the preset difference threshold, it is determined that the video picture belongs to the depth difference scene, and the window where the close-range object is located is determined from the video picture.
[0272] In step S408, whether the trigger condition is satisfied is determined according to the defocus value of the window satisfying the confidence threshold.
[0273] Step S409: When the triggering condition is met, determine the position of the window containing the foreground scene;
[0274] Step S410: Send control information to the driver chip;
[0275] Step S411: The camera focuses on the foreground area of the video image;
[0276] Step S412: Determine if the video feed is stable;
[0277] Step S413: If the video image is stable, it is not necessary to refocus the video image.
[0278] In this example, if the video frame is unstable, it is necessary to re-process the video frame using multi-window phase focusing.
[0279] For example, such as Figure 9 As shown, Figure 9 This is a flowchart illustrating a target object focusing method according to an exemplary embodiment. The second priority control for focusing on the object held by the anchor in the image may include:
[0280] Step S501: When the multi-window phase focusing method fails to focus the video image, a saliency detection is initiated on the video image.
[0281] Step S502: Determine whether the main image subject of the salient region in the video frame is a salient image subject in the training set; if the main image subject of the salient region is not a salient image subject in the training set, proceed to step S503, that is, use the third priority limitation method to focus the image; otherwise, proceed to step S504.
[0282] Step S504: Determine the position of the window where the main image subject of the salient region is located;
[0283] Step S505: Send the position of the window containing the main image to the autofocus module;
[0284] Step S506: The autofocus module updates the phase focusing algorithm and the contrast focusing algorithm based on the position of the window where the main image is located.
[0285] Step S507: Focus on the window containing the main image subject based on the updated phase focusing algorithm and contrast focusing algorithm.
[0286] For example, such as Figure 10 As shown, Figure 10 This is a flowchart illustrating a face focusing method according to an exemplary embodiment. The third priority control for focusing on the anchor's face in the image may include:
[0287] Step S601: Use the face detection module to perform face recognition on the video frame;
[0288] Step S602: Send the position of the window containing the face to the autofocus module;
[0289] Step S603: The autofocus module updates the phase detection autofocus algorithm and the contrast detection autofocus algorithm based on the position of the window where the face is located.
[0290] Step S604: Focus on the window containing the face based on the updated phase focusing algorithm and contrast focusing algorithm.
[0291] Step S605: After successful focusing, enable multi-window detection and wait for the next multi-window focusing attempt.
[0292] This disclosure also provides an image focusing device. Figure 11 This is a schematic diagram illustrating the structure of an image focusing device according to an exemplary embodiment, such as... Figure 11 As shown, the image focusing device 100 includes:
[0293] The acquisition module 101 is used to acquire the region of interest of the first image, the region of interest including at least two candidate window regions; wherein the image regions corresponding to different candidate window regions are at least partially different;
[0294] The determining module 102 is used to determine the priority that matches the status information of the candidate window regions based on the status information of the candidate window regions; and to determine the target window region from the first image based on the focusing strategy corresponding to the priority.
[0295] The focusing module 103 is used to focus on the target window area.
[0296] Optionally, the determining module 102 is configured to:
[0297] Based on the defocus distance of at least two candidate window regions, determine the maximum defocus distance difference between the at least two candidate window regions;
[0298] If the maximum defocus distance difference is greater than the first threshold, the priority for matching the situation information is determined to be the first priority;
[0299] If the maximum defocus distance difference is greater than the first threshold, the priority for matching the situation information is determined to be the second priority.
[0300] Optionally, the determining module 102 is further configured to:
[0301] The candidate window region corresponding to the minimum defocus distance is determined as the target window region based on the defocus distance corresponding to the first priority.
[0302] Optionally, the determination module 102 is further configured to:
[0303] The saliency region and an image subject of the saliency region are obtained by performing saliency detection on the image content of the first image based on the image content corresponding to the second priority.
[0304] If the image subject of the saliency region is the preset subject, the saliency region is determined as the target window region.
[0305] Optionally, the preset subject includes a target object in a preset state and / or a first preset body part.
[0306] The determination module 102 is further configured to:
[0307] If the image subject of the saliency region is not the preset subject, a second preset part detection is performed on the image content of the first image.
[0308] A region in which a second preset body part is located in the first image is determined as the target window region.
[0309] Optionally, the determination module 102 is further configured to:
[0310] A visual feature of the first image is extracted based on the image content of the first image.
[0311] A saliency region of the first image is determined according to the visual feature of the first image.
[0312] A region feature of the saliency region is extracted, and an image subject of the saliency region is obtained by performing image subject classification based on the region feature of the saliency region.
[0313] Optionally,
[0314] The focusing module 103 is configured to:
[0315] If the target window region is a first type window region, a phase focusing process is performed on the first type window region to determine a focus point position in the first type window region, and focusing is performed on the first type window region based on the focus point position; the first type window region is a target window region determined according to image content.
[0316] And / or,
[0317] The first type of window region is subjected to a contrast focusing process to determine a focus point position in the first type of window region; and the first type of window region is focused based on the focus point position.
[0318] Optionally,
[0319] The focusing module 103 is configured to:
[0320] If the target window region is a second type of window region, a focus point position of the second type of window region is determined based on a defocus distance of the second type of window region; and the second type of window region is focused based on the focus point position, wherein the second type of window region is a target window region determined according to the minimum defocus distance.
[0321] Optionally, the determination module 102 is further configured to:
[0322] Obtain a confidence level of the at least two alternative window regions;
[0323] Determine an alternative window region from the at least two alternative window regions, which satisfies a confidence level threshold;
[0324] Determine the maximum defocus distance difference based on a defocus distance of the alternative window region satisfying the confidence level threshold.
[0325] Optionally, the focusing module 103 is further configured to:
[0326] Determine a target field of view FOV and a target focal length corresponding to the focus point position based on the focus point position;
[0327] In the focusing process, the focal length of the lens is adjusted to the target focal length, and the first image is cropped based on the target field of view FOV to obtain a second image; the second image is an image region corresponding to the target field of view FOV in the first image.
[0328] Optionally, the first image is a currently captured commodity recommendation video screen.
[0329] Figure 12 is a block diagram of an image focusing device according to an exemplary embodiment. For example, the device 800 can be a mobile phone, a mobile computer, etc.
[0330] Referring to Figure 12 , the device 800 can include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0331] The processing component 802 generally controls the overall operations of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 can include one or more processors 820 to execute instructions delivered from the memory 804 to complete all or part of the steps of the methods described above. In addition, the processing component 802 can include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0332] The memory 804 is configured to store various types of data to support operations of the device 800. Examples of these data include instructions for any application or method operating on the device 800, contact data, phonebook data, messages, pictures, videos, and so on. The memory 804 can be implemented by any type of volatile or non-volatile storage devices 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, magnetic disk, or optical disk.
[0333] The power component 806 provides power to the various components of the device 800. The power component 806 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.
[0334] The multimedia component 808 includes a screen providing an output interface between the device 800 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes the touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensors can not only sense a boundary of a touching or sliding action, but also detect duration and pressure related to the touching or sliding action. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. The front camera and / or the rear camera can receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0335] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC) that is configured to receive an external audio signal when the device 800 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0336] The I / O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which can include a keypad, a click wheel, buttons, and so on. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0337] The sensor component 814 includes one or more sensors for providing status assessments of various aspects of the device 800. For example, the sensor component 814 can detect an open / closed position of the device 800, relative positioning of components, such as a display and a keypad of the device 800, a change of position of the device 800 or a component of the device 800, presence or absence of user contact with the device 800, changes in orientation or acceleration / deceleration
[0338] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a corresponding communication standard, such as Wi-Fi, 2G, or 3G, or a combination thereof. In an example embodiment, the communication component 816 receives broadcast signals or broadcast-related information from external broadcast management systems via a broadcast channel. In an example embodiment, the communication component 816 also 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) techniques, infrared data association (IrDA) techniques, ultra-wideband (UWB) techniques, Bluetooth (BT) techniques, and other techniques.
[0339] In an exemplary embodiment, the apparatus 800 can be implemented using 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, micro-controllers, microprocessors or other electronic components, for performing the above methods.
[0340] In an exemplary embodiment, a non-transitory computer readable storage medium including instructions, such as the memory 804 including instructions, is also provided, which can be executed by the processor 820 of the apparatus 800 to complete the above methods. For example, the non-transitory computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.
[0341] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure following the general principles thereof and including such departures from the present disclosure that come within known
[0342] It will be understood that the present disclosure is not limited to the precise structures herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the claims that follow.
Claims
1. A method of focusing an image, characterized by, The method comprises: obtaining a region of interest of a first image, the region of interest comprising at least two alternative window regions; wherein different image regions corresponding to the alternative window regions are at least partially different; determining a maximum defocus distance difference between the at least two alternative window regions based on defocus distances of the at least two alternative window regions; if the maximum defocus distance difference is greater than a first threshold, determining that a priority matching the condition information of the at least two alternative windows is a first priority; determining the alternative window region corresponding to the minimum defocus distance as a target window region based on a defocus distance corresponding to the first priority; if the maximum defocus distance difference is less than the first threshold, determining that a priority matching the condition information is a second priority; determining the target window region from the first image based on a focusing strategy corresponding to the second priority; wherein the focusing strategies corresponding to different priorities are different; focusing on the target window region.
2. The method of claim 1, wherein, The method of determining the target window region from the first image based on the focusing strategy corresponding to the second priority comprises: performing saliency detection on image content of the first image based on image content corresponding to the second priority to obtain a saliency region and an image subject of the saliency region; if the image subject of the saliency region is a preset subject, determining the saliency region as the target window region.
3. The method of claim 2, wherein, The preset subject comprises: a target object in a preset state and / or a first preset body part.
4. The method of claim 3, wherein, The method of determining the target window region from the first image based on the focusing strategy corresponding to the second priority further comprises: if the image subject of the saliency region is not the preset subject, performing second preset part detection on the image content of the first image; determining a region where a second preset body part in the first image is located as the target window region.
5. The method of claim 2, wherein, The method of performing saliency detection on the image content of the first image to obtain a saliency region and an image subject of the saliency region comprises: extracting visual features of the first image based on the image content of the first image; determining a saliency region of the first image according to the visual features of the first image; extracting region features of the saliency region, and performing image subject classification based on the region features of the saliency region to obtain an image subject of the saliency region.
6. The method of claim 1, wherein, The method of focusing on the target window region comprises: if the target window region is a first type of window region, performing phase focusing processing on the first type of window region to determine a focus point position in the first type of window region; and focusing on the first type of window region based on the focus point position; wherein the first type of window region is a target window region determined according to image content; and / or, performing contrast focusing processing on the first type of window region to determine a focus point position in the first type of window region; and focusing on the first type of window region based on the focus point position.
7. The method of claim 1, wherein, The method of focusing on the target window region comprises: If the target window region is a second type window region, a focus point position of the second type window region is determined based on a defocus distance of the second type window region, and the second type window region is focused based on the focus point position, wherein the second type window region is the target window region determined according to the minimum defocus distance.
8. The method of claim 1, wherein, The determining the maximum defocus distance difference between the at least two candidate window regions based on the defocus distances of the at least two candidate window regions comprises: obtaining the confidence levels of the at least two candidate window regions; determining a candidate window region whose confidence level satisfies a confidence threshold from the at least two candidate window regions; determining the maximum defocus distance difference based on the defocus distance of the candidate window region whose confidence level satisfies the confidence threshold.
9. The method according to claim 6 or 7, characterized in that, The focusing the target window region comprises: determining a target field of view (FOV) and a target focal length corresponding to the focus point position based on the focus point position; in a focusing process, controlling a lens focal length to be adjusted to the target focal length, and cropping the first image based on the target FOV to obtain a second image, wherein the second image is an image region corresponding to the target FOV in the first image.
10. The method of claim 1, wherein, The method further comprises: the first image is a currently captured commodity recommendation video picture.
11. An image focusing device, characterized by comprise: an obtaining module, configured to obtain a region of interest of a first image, and include at least two candidate window regions in the region of interest, wherein image regions corresponding to different candidate window regions are at least partially different; a determining module, configured to determine a maximum defocus distance difference between the at least two candidate window regions based on defocus distances of the at least two candidate window regions, determine a first priority level matched with condition information of the at least two candidate window regions if the maximum defocus distance difference is greater than a first threshold, and determine a candidate window region corresponding to a minimum defocus distance as a target window region based on a defocus distance corresponding to the first priority level; the determining module is further configured to determine a second priority level matched with the condition information if the maximum defocus distance difference is less than the first threshold, and determine the target window region from the first image based on a focusing strategy corresponding to the second priority level, wherein focusing strategies corresponding to different priority levels are different; a focusing module, configured to focus the target window region.
12. An image focusing device, characterized by comprise: a processor; a memory for storing executable instructions; wherein the processor is configured to implement the image focusing method in any one of claims 1 to 10 when executing the executable instructions stored in the memory. 13.A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an image focusing apparatus, enabling the image focusing apparatus to perform the image focusing method in any one of claims 1 to 10.
Citation Information
Patent Citations
Focusing method and device, electronic device and computer readable storage medium
CN110149482A
Focusing method and device, electronic equipment and computer readable storage medium
CN112866547A