Image processing method and device, electronic equipment and storage medium
By performing image processing on the collected images in electronic equipment, a target image with a larger field of view is generated for focus tracking recognition, which solves the problem of losing the focus target when the camera zoom magnification is high, and improves the focus tracking effect.
Patent Information
- Application Number
- CN202310296854.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-23
- Publication Date
- 2024-09-24
AI Technical Summary
When the zoom ratio of the camera is high, the shake of the phone causes the focus tracking target to move out of the preview screen, and the focus tracking target cannot be automatically re-identified, affecting the focus tracking effect.
By acquiring the collected image in the electronic device and performing image processing when the zoom magnification of the camera is greater than the preset magnification, a target image is generated whose field of view is greater than that of the preview image for focus tracking recognition.
The range of focus tracking recognition is increased, and the loss of the focus tracking target is reduced, so that the target can still be recognized after the focus tracking target moves out of the preview screen, improving the focus tracking effect.
Smart Images

Figure CN118695084A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image technology, and in particular to an image processing method and device, an electronic device, and a storage medium. Background Art
[0002] With the rapid development of technology, the functions of cameras are becoming more and more abundant. For example, cameras have a focus tracking function, which can realize the recognition and focus tracking detection of more types such as birds, insects, vehicles, etc. However, as the zoom ratio of the camera becomes higher and higher, the shaking of the phone will cause the focus tracking target to move out of the preview screen. When the phone is moved so that the focus tracking target re-enters the preview screen, the focus tracking target cannot be automatically recognized again, affecting the focus tracking effect. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides an image processing method and device, an electronic device, and a storage medium, which can reduce the situation of losing the focus tracking target and improve the focus tracking effect.
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an image processing method, which is applied in an electronic device, and includes:
[0005] Acquire a captured image of the focus tracking target;
[0006] When the zoom ratio of the camera in the electronic device is greater than a preset ratio, performing image processing on the captured image to obtain a target image; wherein the field of view of the target image is greater than the field of view of the preview image displayed by the electronic device;
[0007] The focus target is identified based on the target image.
[0008] In some embodiments, the method further comprises:
[0009] The collected image is processed by the image processing front-end module of the camera to obtain an intermediate image; wherein the field of view of the intermediate image is smaller than the field of view of the collected image;
[0010] When the zoom ratio of the camera in the electronic device is greater than a preset ratio, performing image processing on the collected image to obtain a target image includes:
[0011] When the zoom ratio is greater than a preset ratio, the intermediate image is processed by a first image processing engine module of the camera to obtain the target image;
[0012] The field of view of the intermediate image is equal to the field of view of the target image.
[0013] In some embodiments, the method further comprises:
[0014] When the zoom ratio is less than or equal to the preset ratio, the intermediate image is processed by the second image processing engine module of the camera to obtain a recognition image, and the focus tracking target is identified based on the recognition image;
[0015] The field of view of the recognition image is smaller than the field of view of the intermediate image.
[0016] In some embodiments, the method further comprises:
[0017] Get the initial preview cropping frame;
[0018] When the focus target is outside the initial preview cropping frame, acquiring two adjacent frames of the target image when the position of the focus target changes;
[0019] The preview image is acquired based on the position information of the focus target in two adjacent frames of the target image.
[0020] In some embodiments, acquiring the preview image based on the position information of the focus target in two adjacent frames of the target image includes:
[0021] Based on the position information of the focus target in two adjacent frames of the target image, adjusting the position of the initial preview cropping frame to obtain a target preview cropping frame;
[0022] In the case where the target preview cropping frame is located within the target image of the next frame, the target image of the next frame is cropped based on the target preview cropping frame to obtain the preview image.
[0023] In some embodiments, adjusting the position of the initial preview cropping frame to obtain the target preview cropping frame based on the position information of the focus target in two adjacent frames of the target image includes:
[0024] Determining a focus offset of the focus target based on position information of the focus target in two adjacent frames of the target image;
[0025] Obtaining a preview offset based on the focus offset and a mapping relationship between a preset focus offset and a preview offset;
[0026] Based on the preview offset and the initial preview cropping frame, a target preview cropping frame is obtained.
[0027] In some embodiments, the method further comprises:
[0028] When the focus target is located within the initial preview cropping frame, the preview image is acquired based on the initial preview cropping frame.
[0029] According to a second aspect of an embodiment of the present disclosure, there is provided an image processing apparatus, comprising at least:
[0030] A first acquisition module is configured to acquire an image of a focus tracking target;
[0031] An image processing module, configured to perform image processing on the captured image to obtain a target image when the zoom magnification of the camera in the electronic device is greater than a preset magnification; wherein the field of view of the target image is greater than the field of view of the preview image displayed by the electronic device;
[0032] The first focus tracking recognition module is configured to perform focus tracking recognition on the focus tracking target based on the target image.
[0033] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising at least:
[0034] processor;
[0035] a memory for storing processor-executable instructions;
[0036] Wherein, the processor is configured to execute the image processing method as described in the first aspect above.
[0037] According to a fourth aspect of an embodiment of the present disclosure, there is provided a storage medium, including:
[0038] When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the image processing method in the first aspect described above.
[0039] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0040] In an embodiment of the present disclosure, an electronic device acquires a captured image of a focus target; when the zoom ratio of a camera in the electronic device is greater than a preset ratio, the captured image is processed to obtain a target image; wherein the field of view of the target image is greater than the field of view of a preview image displayed by the electronic device; and the focus target is identified based on the target image. That is, the embodiment of the present disclosure uses a target image with a larger field of view than the preview image for focus identification, which can increase the range of focus identification, and the focus target can still be identified after the focus target moves out of the preview screen, thereby reducing the possibility of loss of the focus target and improving the focus effect.
[0041] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0043] Figure 1 The figure is a schematic diagram of an image processing flow according to an exemplary embodiment.
[0044] Figure 2 The invention is a block diagram of an image processing method with a zoom ratio greater than a preset ratio according to an exemplary embodiment.
[0045] Figure 3 The invention is a block diagram of an image processing method when a zoom ratio is less than or equal to a preset ratio according to an exemplary embodiment.
[0046] Figure 4 The figure is a module architecture diagram of a hardware abstraction layer according to an exemplary embodiment.
[0047] Figure 5 The diagram is a schematic diagram showing how to obtain a preview image based on two adjacent frames of target images according to an exemplary embodiment.
[0048] Figure 6 The figure is a flowchart of focus tracking recognition and generating a preview image according to an exemplary embodiment.
[0049] Figure 7 is a block diagram of an image processing device according to an exemplary embodiment.
[0050] Figure 8 It is a structural block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0051] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0052] An embodiment of the present disclosure proposes an image processing method, which is applied in a scenario where an electronic device turns on a focus tracking function to track and identify a focus target, for example, in a scenario where the focus tracking function of an electronic device is used to track a sweeping robot indoors; or in another example, in a scenario where the focus tracking function of an electronic device is used to track a pet in an outdoor square.
[0053] Figure 1 is a schematic diagram of a process of an image processing method according to an exemplary embodiment Figure 1 .like Figure 1 As shown, the electronic device executing the image processing method may include the following steps:
[0054] S101, acquiring a captured image of a focus tracking target;
[0055] S102, when the zoom magnification of the camera in the electronic device is greater than a preset magnification, performing image processing on the captured image to obtain a target image; wherein the field of view of the target image is greater than the field of view of the preview image displayed by the electronic device;
[0056] S103: Perform focus identification on the focus target based on the target image.
[0057] In the embodiments of the present disclosure, the electronic device includes a terminal device and a wearable device. The terminal device includes a smart phone, a notebook or a tablet computer; the wearable device includes a smart watch or a smart bracelet, which is not limited in the embodiments of the present disclosure.
[0058] In step S101, after the focus tracking function of the electronic device is turned on, the electronic device will collect an image of the focus tracking target. The collected image can be obtained by the image sensor of the camera. The focus tracking target can be determined based on the user's touch operation (for example, clicking on the preview screen) or voice command.
[0059] It should be noted that the tracking function of an electronic device is a function that allows the electronic device to automatically identify the tracking target and perform tracking shooting. Even if the tracking target moves, such as turning or lowering its head, the electronic device can continue to lock the focus and track it in real time, so there is no need to worry about the out-of-focus problem caused by the inability to focus when the tracking target moves, which improves the shooting effect.
[0060] Exemplarily, the focus tracking function may include a human eye focus tracking function and a motion focus tracking function; in the human eye focus tracking function, the focus tracking target may include a human eye; in the motion focus tracking function, the focus tracking target may include a moving person, a moving animal, a moving machine, etc.
[0061] In step S102, the higher the zoom ratio of the camera, the greater the change in the preview screen caused by the corresponding electronic device shaking, and the field of view of the recognition image for focus tracking recognition is usually the same as the field of view of the generated preview screen. Therefore, during the focus tracking process, the camera shaking will cause the focus target that is not in the preview screen to be out of the recognition image for focus tracking recognition, which will cause the focus target to be lost and affect the focus tracking effect. Based on this, the electronic device of the embodiment of the present disclosure will detect the zoom ratio of the camera during the image processing process, and when the zoom ratio of the camera is greater than the preset ratio, it will perform image processing on the captured image to obtain a target image, and the field of view of the target image is greater than the field of view of the preview image.
[0062] That is to say, the embodiment of the present disclosure no longer uses an identification image with the same field of view as the preview image for focus tracking identification, but instead uses a target image with a larger field of view than the preview image for focus tracking identification, which can increase the range of focus tracking identification. The focus tracking target can still be identified after the focus tracking target moves out of the preview screen, allowing the user to recapture the focus tracking target without moving the electronic device.
[0063] In the disclosed embodiment, the preset magnification can be determined according to actual needs. For example, the preset magnification can be set between 50 times and 100 times. When it is detected that the zoom magnification of the camera is 120 times, the target image can be used to perform focus tracking and recognition on the focus target.
[0064] Here, the field of view of the target image is larger than the field of view of the preview image displayed by the electronic device. That is, the range of focus tracking and identification of the target image is larger than the range of focus tracking and identification of the preview image, and focus tracking and identification based on the target image can increase the range of focus tracking and identification. Among them, the preview image can be obtained based on the captured image and displayed on the preview interface of the electronic device, that is, the camera for capturing the image and the camera for the preview image can be the same camera.
[0065] It should be noted that performing image processing on the acquired image to obtain the target image may include: performing at least one of cropping, color processing, downsampling or noise reduction processing on the acquired image to obtain the target image. In some embodiments, the method further includes:
[0066] The collected image is processed by the image processing front-end module of the camera to obtain an intermediate image; wherein the field of view of the intermediate image is smaller than the field of view of the collected image;
[0067] When the zoom ratio of the camera in the electronic device is greater than a preset ratio, performing image processing on the collected image to obtain a target image includes:
[0068] When the zoom ratio is greater than the preset ratio, the intermediate image is processed by the first image processing engine module of the camera to obtain the target image;
[0069] The field of view of the intermediate image is equal to the field of view of the target image.
[0070] In the embodiment of the present disclosure, the acquisition image is processed by the image processing front-end module to obtain the intermediate image, which may include: performing at least a first cropping process on the acquisition image by the image processing front-end module to obtain the intermediate image. Of course, the image processing to obtain the intermediate image may also include: color correction processing; downsampling processing; processing of de-mosaicing statistical 3A data, etc., which are not limited in the embodiment of the present disclosure.
[0071] It should be noted that the field of view of the intermediate image is smaller than the field of view of the acquired image, and the corresponding content presented by the intermediate image is less than the content presented by the acquired image.
[0072] In the embodiment of the present disclosure, obtaining a target image by processing the intermediate image through the first image processing engine module may include: performing at least noise reduction processing, color processing or detail enhancement processing on the captured image through the first image processing engine module to obtain the target image.
[0073] It should be noted that the field of view of the intermediate image is equal to the field of view of the target image. It can be seen that in the process of the first image processing engine module processing the intermediate image, the first image processing engine module will not crop the intermediate image, and thus the field of view of the target image obtained after processing by the first image processing engine module will be larger than the field of view of the preview image.
[0074] That is to say, in the embodiment of the present disclosure, the first image processing engine module will not perform a second cropping process on the captured image after the image processing front-end module performs the first cropping process on the captured image, thereby enabling the field of view of the target image to be larger than the field of view of the preview image, thereby increasing the range of focus tracking recognition, reducing the possibility of losing the focus tracking target, and improving the focus tracking effect.
[0075] In step S103, after acquiring the target image, the focus target is identified based on the target image.
[0076] In the disclosed embodiment, focusing and identifying the focusing target based on the target image may include: transmitting the target image to the focusing model so that the focusing model performs focusing and identifying the focusing target in the target image to complete focusing on the focusing target.
[0077] It should be noted that the focus tracking model can be composed of at least a human body recognition sub-model, an object feature self-learning sub-model, and a lock-on focus target automatic judgment sub-model. Among them, the human body recognition sub-model can be used to distinguish the back of the human body, so as to continuously and accurately track the focus and reduce the situation of false focus; the object feature self-learning sub-model is used to continuously self-learn the focus target to ensure continuous focus tracking; the lock-on focus target automatic judgment sub-model is used to automatically identify the boundary range of the focus target to reduce the situation of false recognition.
[0078] For example, Figure 2 As shown, the hardware abstraction layer includes an image sensor 11, an image processing front-end module 12, and a first image processing engine module 13; the image sensor 11 collects the focus target to obtain a collection image 15, and outputs the collection image 15 to the image processing front-end module 12; the image processing front-end module 12 processes the collection image 15 to obtain an intermediate image 16, and outputs the intermediate image 16 to the first image processing engine module 13; the first image processing engine module 13 processes the intermediate image 16 to obtain a target image 17, and passes the target image 17 to the focus tracking model 14, so that the focus tracking model 14 performs focus tracking and recognition on the focus tracking target in the target image 17. Among them, the field of view of the target image 17 is larger than the field of view of the preview image 18.
[0079] Usually, if the phone shakes, the tracking target will move out of the preview screen, and the tracking target cannot be automatically identified. In this case, you need to move the phone to make the tracking target re-enter the preview screen. If you do not move the phone to make the tracking target re-enter the preview screen, the tracking target cannot be identified, affecting the tracking effect.
[0080] Based on this, in an embodiment of the present disclosure, an electronic device obtains a captured image of a focus target; when the zoom ratio of the camera in the electronic device is greater than a preset ratio, the captured image is processed to obtain a target image; wherein the field of view of the target image is greater than the field of view of the preview image displayed by the electronic device; and the focus target is identified based on the target image. In other words, the embodiment of the present disclosure uses a target image with a larger field of view than the preview image for focus identification, which can increase the range of focus identification, and the focus target can still be identified after the focus target moves out of the preview screen, thereby reducing the possibility of loss of the focus target and improving the focus effect.
[0081] In some embodiments, the method further comprises:
[0082] When the zoom ratio is less than or equal to the preset ratio, the intermediate image is processed by the second image processing engine module of the camera to obtain a recognition image, and the focus tracking target is identified based on the recognition image;
[0083] The field of view of the recognition image is smaller than the field of view of the intermediate image.
[0084] That is to say, the embodiment of the present disclosure uses the recognition image for focus tracking recognition when the zoom ratio is less than or equal to the preset ratio. It can be seen that the embodiment of the present disclosure not only takes into account the situation where the zoom ratio is greater than the preset ratio, but also takes into account the situation where the zoom ratio is less than or equal to the preset ratio, and then uses different images for focus tracking recognition based on different zoom ratios, which can not only improve the focus tracking effect, but also expand the applicable scenarios of the image processing method, making focus tracking recognition more flexible.
[0085] Exemplarily, the preset magnification is set between 50 times and 100 times. When it is detected that the zoom magnification of the camera is 20 times, the recognition image can be used to focus and identify the focus target; when it is detected that the zoom magnification of the camera is 110 times, the target image can be used to focus and identify the focus target.
[0086] In the embodiment of the present disclosure, the field of view of the recognition image obtained by the second image processing engine module is smaller than the field of view of the intermediate image; the field of view of the target image obtained by the first image processing engine module is equal to the field of view of the intermediate image. That is, the image processing based on the second image processing engine module includes cropping processing, and the image processing based on the first image processing engine module does not include cropping processing.
[0087] It should be noted that the image processing based on the image processing front-end module to obtain the intermediate image also includes cropping processing. Therefore, in the process of obtaining the recognition image, the captured image can be cropped for the first time to obtain the intermediate image, and then the intermediate image can be cropped for the second time to obtain the recognition image. That is, the embodiment of the present disclosure performs a second cropping on the captured image to obtain the recognition image.
[0088] For example, Figure 3 As shown, the hardware abstraction layer also includes a second image processing engine module 19; the image sensor 11 collects the focus target to obtain the collected image 15, and outputs the collected image 15 to the image processing front-end module 12; the image processing front-end module 12 processes the collected image 15 to obtain an intermediate image 16, and outputs the intermediate image 16 to the second image processing engine module 19; the second image processing engine module 19 processes the intermediate image 16 to obtain a recognition image 20, and passes the recognition image 20 to the focus tracking model 14, so that the focus tracking model 14 performs focus tracking and recognition on the focus target in the recognition image 20. Figure 3 It can be clearly seen that the field of view of the recognition image is smaller than that of the target image.
[0089] like Figure 4As shown, the image sensor 11 is connected to the image processing front-end module 12, and the image processing front-end module 12 is connected to the first image processing engine module 13 and the second image processing engine module 19. It can be seen that the embodiment of the present disclosure redesigns the pipeline in the hardware abstraction layer so that the electronic device can adopt different image processing methods according to different zoom ratios, that is, when the zoom ratio is greater than the preset ratio, the target image is obtained through the first image processing engine module to pass the target image to the focus tracking model for focus tracking recognition; when the zoom ratio is less than or equal to the preset ratio, the recognition image is obtained through the second image processing engine module to pass the recognition image to the focus tracking model for focus tracking recognition. In this way, the embodiment of the present disclosure can flexibly use different image processing engine modules according to the zoom ratio to process and obtain the image that is finally passed to the focus tracking model, so that the focus tracking function of the electronic device can adapt to different zoom ratio scenes and has universality.
[0090] In some embodiments, the method further comprises:
[0091] Get the initial preview cropping frame;
[0092] When the focus target is outside the initial preview cropping frame, acquiring two adjacent frames of the target image when the position of the focus target changes;
[0093] The preview image is acquired based on the position information of the focus target in two adjacent frames of the target image.
[0094] In an embodiment of the present disclosure, the electronic device may obtain an initial preview cropping frame after obtaining the captured image, and may also obtain an initial preview cropping frame after the electronic device obtains the target image. The order of obtaining the initial preview cropping frame is not limited in the embodiment of the present disclosure. Among them, the initial preview cropping frame is the original preview cropping frame generated before the electronic device moves (for example, the electronic device does not shake). If the initial preview cropping frame is used for cropping after the electronic device moves, there may be no focus target or only part of the focus target in the preview image. Therefore, it is necessary to re-acquire the preview image when the focus target is outside the initial preview cropping frame.
[0095] Here, the focus target is outside the initial preview cropping frame, indicating that the focus target has moved out of the preview image cropped based on the initial preview cropping frame. The focus target being outside the initial preview cropping frame may include that part of the focus target is outside the initial preview cropping frame, and may also include that the entire focus target is outside the initial preview cropping frame.
[0096] In some embodiments, the method further comprises:
[0097] When the focus target is located within the initial preview cropping frame, the preview image is acquired based on the initial preview cropping frame.
[0098] That is to say, when the focus target does not move out of the preview image cropped based on the initial preview cropping frame, the electronic device will not switch the preview image, and directly display the preview image cropped based on the initial preview cropping frame in the preview interface of the electronic device.
[0099] It should be noted that in the process of determining whether the focus target is located within the initial preview cropping frame, the electronic device can determine the pixel coordinates of the focus target and the pixel coordinates of the preview cropping frame, and then judge whether the focus target is located outside the initial preview cropping frame or within the initial preview cropping frame based on the pixel coordinates of the focus target and the pixel coordinates of the preview cropping frame.
[0100] In the embodiment of the present disclosure, the change in the position of the focus target may include: the camera shakes causing the position of the focus target to change or the focus target moves suddenly, which is not limited in the embodiment of the present disclosure.
[0101] It should be noted that in the process of obtaining a preview image based on the position information of the focus target in two adjacent frames of target images, the preview image is no longer directly obtained by cropping the image based on the initial preview cropping frame, but different preview images will be obtained according to the position change of the focus target to improve the preview effect.
[0102] In some embodiments, acquiring the preview image based on the position information of the focus target in two adjacent frames of the target image includes:
[0103] Based on the position information of the focus target in two adjacent frames of the target image, adjusting the position of the initial preview cropping frame to obtain a target preview cropping frame;
[0104] In the case where the target preview cropping frame is located within the target image of the next frame, the target image of the next frame is cropped based on the target preview cropping frame to obtain the preview image.
[0105] That is to say, the disclosed embodiment can obtain different preview images according to the different positions of the focus target, thereby improving the user's focus preview effect.
[0106] For example, the first target image of two adjacent target images may be an image acquired by the electronic device in the past, and the second target image may be an image acquired by the electronic device currently. The positions of the focus targets in the two adjacent target images are different.
[0107] In the disclosed embodiment, the position information of the focus target can be obtained based on the recognition result of the focus recognition performed on the focus model. The position information of the focus target may include the center pixel coordinate information of the focus target or the boundary coordinate information of the focus target. The position of the target preview cropping frame is different from the position of the initial preview cropping frame, and the size of the target preview cropping frame is the same as the size of the initial preview cropping frame.
[0108] It should be noted that in order to make the focus target located at the center of the preview image, after the position of the focus target changes, the position of the initial preview cropping frame also needs to change, and then the position of the initial preview cropping frame needs to be adjusted to obtain the target preview cropping frame.
[0109] In some embodiments, adjusting the position of the initial preview cropping frame to obtain the target preview cropping frame based on the position information of the focus target in two adjacent frames of the target image includes:
[0110] Based on the position information of the focus target in the target image of two adjacent frames, the focus offset of the focus target is determined; based on the mapping relationship between the focus offset and the preset focus offset and the preview offset, the preview offset is obtained; based on the preview offset and the initial preview cropping frame, the target preview cropping frame is obtained.
[0111] In the embodiment of the present disclosure, the focus offset may include the pixel distance of the focus offset and the direction of the focus offset. The focus offset of the focus target is determined based on the position information of the focus target in two adjacent frames of target images, including: obtaining the pixel distance of the offset and the direction of the offset based on the center coordinates of the previous frame of the target image and the center coordinates of the next frame of the target image.
[0112] Here, after determining the focus offset of the focus target, a preview offset corresponding to the focus offset can be obtained by comparing the mapping relationship. The preview offset includes a pixel distance of the preview offset and a direction of the preview offset.
[0113] The obtaining of the target preview cropping frame based on the preview offset and the initial preview cropping frame may include: moving the initial preview cropping frame in the direction of the preview offset by a pixel distance of the preview offset to obtain the target preview cropping frame.
[0114] It should be noted that the embodiment of the present disclosure takes into account the mapping relationship between the focus offset and the preview offset. Based on the preview offset, a target preview cropping frame that adapts to changes in the focus target position can be obtained, thereby improving the preview image cropping accuracy and achieving a better preview effect.
[0115] In the disclosed embodiment, after obtaining the target preview cropping frame, it is necessary to determine whether the target preview cropping frame is located within the target image of the next frame. If the target preview cropping frame is completely outside the target image of the next frame or the target preview cropped image is partially outside the target image of the next frame, the preview image cannot be obtained by cropping the target preview cropping frame. Therefore, in the disclosed embodiment, when the target preview cropping frame is located within the target image of the next frame, the next frame target image can be cropped based on the target preview cropping frame to obtain the preview image. Here, the target preview cropping frame can be determined to be within the target image of the next frame by comparing the pixel coordinates of the preview cropping frame and the target image of the next frame.
[0116] In the disclosed embodiment, when the position of the focus target changes, the electronic device no longer displays the preview image obtained based on the initial preview cropping frame, but instead displays the preview image obtained by cropping the target image of the next frame based on the target preview cropping frame, thereby enabling the focus target to actively reappear in the preview screen and be captured by the user again, without the user having to frequently move the electronic device to complete the continuous tracking of the focus target, thereby improving the focus effect and user experience.
[0117] For example, Figure 5 As shown, in the hardware abstraction layer 21, the focus target in the previous frame Frame0 target image obtained based on the first image processing engine module 13 is at the center position, and relative to the previous frame Frame0 target image, the focus target in the next frame Frame1 target image obtained based on the first image processing engine module 13 is no longer at the center position due to camera shaking. Therefore, it is necessary to move the initial preview cropping frame 22 to obtain the target preview cropping frame 23 so that the focus target can appear again and appear at the center position of the preview image.
[0118] like Figure 6 As shown, the electronic device obtains a captured image through an image sensor 11, processes the captured image based on an image processing front-end module 12 to obtain an intermediate image, processes the intermediate image based on a first image processing engine module 13 to obtain a target image, and identifies a focus target in the target image based on a focus model 14, and can still identify the focus target after the focus target moves out of the preview screen. Among them, the transformation module 24 is used to act on the target image based on the preview offset obtained based on the position information of the focus target, and then realizes the switching of the preview image obtained based on the target preview cropping frame through the anti-shake module 25 and the second image processing engine module 19.
[0119] The present disclosure also provides an image processing device, which is applied to an electronic device. Figure 7 As shown, the image processing device 1000 includes:
[0120] The first acquisition module 1001 is configured to acquire an image of a focus tracking target;
[0121] The image processing module 1002 is configured to perform image processing on the captured image to obtain a target image when the zoom magnification of the camera in the electronic device is greater than a preset magnification; wherein the field of view of the target image is greater than the field of view of the preview image displayed by the electronic device;
[0122] The first focus tracking recognition module 1003 is configured to perform focus tracking recognition on the focus tracking target based on the target image.
[0123] In some embodiments, the apparatus further comprises:
[0124] A front-end processing module is configured to process the collected image through the image processing front-end module of the camera to obtain an intermediate image; wherein the field of view of the intermediate image is smaller than the field of view of the collected image;
[0125] The image processing module is also configured to process the intermediate image through the first image processing engine module of the camera to obtain the target image when the zoom ratio is greater than a preset ratio; wherein the field of view of the intermediate image is equal to the field of view of the target image.
[0126] In some embodiments, the apparatus further comprises:
[0127] an image obtaining module, configured to process the intermediate image to obtain a recognition image when the zoom magnification is less than or equal to the preset magnification; wherein the field of view of the recognition image is smaller than the field of view of the intermediate image;
[0128] The second focus tracking recognition module is configured to perform focus tracking recognition on the focus tracking target based on the recognition image.
[0129] In some embodiments, the apparatus further comprises:
[0130] A second acquisition module is configured to acquire an initial preview cropping frame;
[0131] A third acquisition module is configured to acquire two adjacent frames of the target image when the position of the focus target changes when the focus target is outside the initial preview cropping frame;
[0132] The fourth acquisition module is configured to acquire the preview image based on the position information of the focus tracking target in two adjacent frames of the target image.
[0133] In some embodiments, the fourth acquisition module is configured to adjust the position of the initial preview cropping frame to obtain the target preview cropping frame based on the position information of the focus target in the target image in two adjacent frames; when the target preview cropping frame is located in the target image in the next frame, the target image in the next frame is cropped based on the target preview cropping frame to obtain the preview image.
[0134] In some embodiments, the fourth acquisition module is configured to determine the focus offset of the focus target based on the position information of the focus target in two adjacent frames of the target image; obtain the preview offset based on the mapping relationship between the focus offset and the preset focus offset and the preview offset; and obtain the target preview cropping frame based on the preview offset and the initial preview cropping frame.
[0135] In some embodiments, the apparatus further comprises:
[0136] The fifth acquisition module is configured to acquire the preview image based on the initial preview cropping frame when the focus tracking target is located in the initial preview cropping frame.
[0137] The specific manner in which each module in the device of the above embodiment performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0138] Figure 8 800 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0139] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power 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 .
[0140] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0141] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0142] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0143] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0144] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0145] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0146] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0147] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 3G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 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) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0148] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0149] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. 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 disk, an optical data storage device, etc.
[0150] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute an image processing method, the method comprising: acquiring a captured image of a focus target; when the zoom ratio of a camera in the electronic device is greater than a preset ratio, performing image processing on the captured image to obtain a target image; wherein the field of view of the target image is greater than the field of view of a preview image displayed by the electronic device; and performing focus identification on the focus target based on the target image.
[0151] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0152] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An image processing method, It is characterized in that Used in electronic equipment, including: Acquire a captured image of the focus tracking target; When the zoom ratio of the camera in the electronic device is greater than a preset ratio, performing image processing on the captured image to obtain a target image; wherein the field of view of the target image is greater than the field of view of the preview image displayed by the electronic device; The focus target is identified based on the target image.
2. The method according to claim 1, It is characterized in that The method further comprises: The captured image is processed by the image processing front-end module of the camera to obtain an intermediate image; wherein the field of view of the intermediate image is smaller than the field of view of the captured image; When the zoom ratio of the camera in the electronic device is greater than a preset ratio, performing image processing on the collected image to obtain a target image includes: When the zoom ratio is greater than the preset ratio, the intermediate image is processed by the first image processing engine module of the camera to obtain the target image; The field of view of the intermediate image is equal to the field of view of the target image.
3. The method according to claim 2, It is characterized in that The method further comprises: When the zoom ratio is less than or equal to the preset ratio, the intermediate image is processed by the second image processing engine module of the camera to obtain a recognition image, and the focus tracking target is identified based on the recognition image; The field of view of the recognition image is smaller than the field of view of the intermediate image.
4. The method according to any one of claims 1 to 3, It is characterized in that The method further comprises: Get the initial preview cropping frame; When the focus target is outside the initial preview cropping frame, acquiring two adjacent frames of the target image when the position of the focus target changes; The preview image is acquired based on the position information of the focus target in two adjacent frames of the target image.
5. The method according to claim 4, It is characterized in that The acquiring the preview image based on the position information of the focus target in two adjacent frames of the target image includes: Based on the position information of the focus target in two adjacent frames of the target image, adjusting the position of the initial preview cropping frame to obtain a target preview cropping frame; In the case where the target preview cropping frame is located within the target image of the next frame, the target image of the next frame is cropped based on the target preview cropping frame to obtain the preview image.
6. The method according to claim 5, It is characterized in that The adjusting the position of the initial preview cropping frame based on the position information of the focus target in the target image of two adjacent frames to obtain the target preview cropping frame includes: Determining a focus offset of the focus target based on position information of the focus target in two adjacent frames of the target image; Obtaining a preview offset based on the focus offset and a mapping relationship between a preset focus offset and a preview offset; Based on the preview offset and the initial preview cropping frame, a target preview cropping frame is obtained.
7. The method according to claim 4, It is characterized in that The method further comprises: When the focus target is located within the initial preview cropping frame, the preview image is acquired based on the initial preview cropping frame.
8. An image processing device, It is characterized in that Applied in electronic equipment, the device comprises: A first acquisition module is configured to acquire an image of a focus tracking target; An image processing module, configured to perform image processing on the captured image to obtain a target image when the zoom magnification of the camera in the electronic device is greater than a preset magnification; wherein the field of view of the target image is greater than the field of view of the preview image displayed by the electronic device; The first focus tracking recognition module is configured to perform focus tracking recognition on the focus tracking target based on the target image.
9. An electronic device, It is characterized in that include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the image processing method as described in any one of claims 1 to 7. 10 . A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the image processing method according to any one of claims 1 to 7.
