Image processing method, device, storage medium and electronic device

By acquiring and correcting the focus parameters in real time, focusing processing is performed for each frame of the image, which solves the problem of low focus efficiency in the prior art and achieves a more accurate and efficient focus effect.

CN114466129BActive Publication Date: 2024-11-22伟光有限公司(CN)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011241243.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-09
Publication Date
2024-11-22
Estimated Expiration
2040-11-09

AI Technical Summary

Technical Problem

Existing cameras cannot achieve real-time focus operations for each frame in preview or video recording scenes, resulting in low focus efficiency and inaccurate focus information at the latest moments.

Method used

By obtaining the focus area and position change information of the target object in the initial image data, as well as the motion parameter change information of the electronic device, the initial focus parameters are corrected in real time, and the current scene is re-shooted to obtain the target image data.

Benefits of technology

This greatly improves the accuracy and efficiency of focus, so that each frame of image can be corrected for focusing parameters, achieving more accurate and efficient focus processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114466129B_ABST
    Figure CN114466129B_ABST
Patent Text Reader

Abstract

The present application discloses an image processing method, device, storage medium and electronic device, the method comprising: photographing the current scene according to initial focus parameters to obtain initial image data, obtaining a focus area in the initial image data, and determining a target object in the focus area, obtaining position change information of the target object in the current scene in real time, and motion parameter change information of the electronic device, correcting the initial focus parameters according to the position change information and the motion parameter change information, and re-photographing the current scene according to the corrected focus parameters to obtain target image data. The embodiment of the present application can correct the focus parameters for each frame of the image, thereby improving the accuracy and efficiency of focusing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image processing technology, and in particular relates to an image processing method, device, storage medium and electronic device. Background Art

[0002] In current mobile phone preview or video recording scenarios, the camera focus function can be realized by manual focus and auto focus. In camera preview, the auto focus mode is generally used automatically unless the user manually intervenes. This requires that if the user wants to obtain a better preview or focus effect, the camera needs more accurate focus parameters and real-time focus processing. Accurate focus parameters can be obtained by improving the algorithm, but real-time focus processing is limited by the performance of the system and is difficult to meet. At present, the focus parameters are basically calculated every few frames.

[0003] The current focusing solution still needs to calculate the focusing parameters based on the entire image (such as phase focusing processing), which requires a lot of computing time. Therefore, it is impossible to implement focusing operations for each frame (generally, a real focusing parameter calculation will be triggered only when the position change reaches a certain degree). Therefore, when previewing or shooting videos, the focusing parameters can only be calculated once every certain number of frames, which cannot accurately reflect the focus information at the latest moment, and the focusing efficiency is low. Summary of the invention

[0004] The present application provides an image processing method, device, storage medium and electronic device, which can correct focus parameters according to each frame of image, thereby greatly improving focus efficiency.

[0005] In a first aspect, an embodiment of the present application provides an image processing method, comprising:

[0006] Shooting the current scene according to the initial focus parameters to obtain initial image data;

[0007] Acquire a focus area in the initial image data, and determine a target object in the focus area;

[0008] Acquire the position change information of the target object in the current scene and the motion parameter change information of the electronic device in real time;

[0009] The initial focus parameter is corrected according to the position change information and the motion parameter change information, and the current scene is re-photographed according to the corrected focus parameter to obtain target image data.

[0010] In a second aspect, an embodiment of the present application provides an image processing device, including:

[0011] A shooting module, used to shoot the current scene according to the initial focus parameters to obtain initial image data;

[0012] A determination module, configured to obtain a focus area in the initial image data and determine a target object in the focus area;

[0013] An acquisition module, used to acquire in real time the position change information of the target object in the current scene and the motion parameter change information of the electronic device;

[0014] The correction module is used to correct the initial focus parameter according to the position change information and the motion parameter change information, and re-shoot the current scene according to the corrected focus parameter to obtain target image data.

[0015] In a third aspect, an embodiment of the present application provides a storage medium on which a computer program is stored. When the computer program is run on a computer, the computer executes the above-mentioned image processing method.

[0016] In a fourth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions in the memory to perform the following steps:

[0017] Shooting the current scene according to the initial focus parameters to obtain initial image data;

[0018] Acquire a focus area in the initial image data, and determine a target object in the focus area;

[0019] Acquire the position change information of the target object in the current scene and the motion parameter change information of the electronic device in real time;

[0020] The initial focus parameter is corrected according to the position change information and the motion parameter change information, and the current scene is re-photographed according to the corrected focus parameter to obtain target image data.

[0021] The image processing method provided in the embodiment of the present application can shoot the current scene according to the initial focus parameters to obtain initial image data, obtain the focus area in the initial image data, and determine the target object in the focus area, obtain the position change information of the target object in the current scene in real time, and the motion parameter change information of the electronic device, correct the initial focus parameters according to the position change information and the motion parameter change information, and re-shoot the current scene according to the corrected focus parameters to obtain the target image data. The embodiment of the present application can correct the focus parameters for each frame of the image, thereby improving the accuracy and efficiency of focusing. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 A flowchart of an image processing method provided in an embodiment of the present application.

[0024] Figure 2 Another flowchart of the image processing method provided in an embodiment of the present application.

[0025] Figure 3 A schematic diagram of a scenario of the image processing method provided in an embodiment of the present application.

[0026] Figure 4 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application.

[0027] Figure 5 Another structural schematic diagram of the image processing device provided in an embodiment of the present application.

[0028] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0029] Figure 7 Another schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] Please refer to the drawings, where the same component symbols represent the same components, and the principles of the present application are illustrated by implementing them in an appropriate computing environment. The following description is based on the illustrated specific embodiments of the present application, which should not be considered as limiting other specific embodiments of the present application that are not described in detail herein.

[0031] In the following description, the specific embodiments of the present application will be described with reference to the steps and symbols performed by one or more computers, unless otherwise stated. Therefore, these steps and operations will be mentioned several times as being performed by a computer, and the computer execution referred to herein includes the operation of a computer processing unit by an electronic signal representing data in a structured form. This operation converts the data or maintains it at a location in the memory system of the computer, which can be reconfigured or otherwise change the operation of the computer in a manner familiar to testers in the field. The data structure maintained by the data is a physical location in the memory, which has specific characteristics defined by the data format. However, the principles of the present application are described in the above text, which does not represent a limitation, and testers in the field will understand that the various steps and operations described below can also be implemented in hardware.

[0032] The terms "first", "second", and "third" in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules that are not listed, or some embodiments also include other steps or modules inherent to these processes, methods, products, or devices.

[0033] See also Figure 1 , Figure 1 A schematic diagram of a process flow of an image processing method provided in an embodiment of the present application. The image processing method provided in an embodiment of the present application is applied to an electronic device, and the specific process may be as follows:

[0034] Step 101 : photographing the current scene according to initial focus parameters to obtain initial image data.

[0035] In one embodiment, the initial image data may be an image of the current scene captured by an imaging device of an electronic device when shooting. The imaging device may be a front camera, a rear camera, etc. The imaging device of the electronic device is started to enter a photo preview mode, and the scene being photographed is displayed in a display window of the electronic device, and the picture displayed in the display window at this time is defined as a preview image. Among them, the hardware of the imaging device generally includes five parts: a housing (motor), a lens, an infrared filter, an image sensor (such as a CCD or COMS), and a flexible printed circuit board (FPCB), etc. In the photo preview mode, during the display of the preview image, the lens moves under the drive of the motor, and the photographed object passes through the lens to form an image on the image sensor. The image sensor converts the optical signal into an electrical signal through optical-electrical conversion and transmits it to the image processing circuit for subsequent processing. Among them, the image processing circuit can be implemented using hardware and / or software components, and may include various processing units that define an ISP (Image Signal Processing) pipeline.

[0036] In one embodiment, the above-mentioned initial focus parameters may be focus parameters determined by the autofocus function when the electronic device just turns on the camera function. Specifically, the above-mentioned autofocus may include contrast focus (Contrast Detection Auto Focus, CDAF), phase focus (Phase Detection Auto Focus, PDAF) or laser focus (Laser Detection Auto Focus, LADF), etc. The principle of contrast focus is to find the lens position when the contrast is maximum, that is, the accurate focus position, according to the contrast change of the picture at the focus. The principle of phase focus is to reserve some masked pixels on the photosensitive element, which are specifically used for phase detection, and determine the focus offset value by the distance between pixels and its changes, so as to achieve accurate focus. The principle of laser focus is to calculate the distance from the target to the test instrument by recording the time difference between the infrared laser being emitted from the device, reflected by the target surface, and finally received by the rangefinder.

[0037] In one embodiment, after the initial image data is acquired, it can be displayed as a preview image on the screen of the electronic device.

[0038] Step 102: Acquire a focus area in the initial image data and determine a target object in the focus area.

[0039] In one embodiment, the focus area in the initial image data can be determined by the initial focus parameters. For example, when the electronic device shoots the current scene, the focus parameters are determined by automatic focus or manual focus, and the focus parameters may include focus duration, focal length, focus position and other parameters. Specifically, the focus area can be calculated according to the focus position in the initial image data and the preset range.

[0040] It should be noted that if the electronic device obtains the initial image data by shooting with manual focus, that is, when the user uses the electronic device to shoot the current scene, manually clicks a certain position in the viewfinder of the electronic device screen, the device will focus on the scene area corresponding to the position and complete the shooting after focusing. In this case, the position manually clicked by the user is the focus position, so there is no need to determine the focus area based on the focus parameters, and the focus area can be determined directly based on the position manually clicked by the user and the preset range.

[0041] Furthermore, after determining the focus area, the target object in the area can be further identified, that is, the object that the user mainly focuses on when shooting. For example, identification is performed in the focus area, wherein the target object can be a pre-configured identifiable object. The object can be a person, an object, an animal, etc. Objects can include flowers, mountains, trees, etc. Animals can include cats, dogs, cows, sheep, tigers, etc. The target object can also be an irregular graphic outline, or a regular graphic outline, etc.

[0042] In one embodiment, the number of objects in the above-mentioned focus area can be determined first. If there is only one object in the area, it can be directly determined as the target object. If there are multiple objects in the area, they can be further selected according to the focus position, such as selecting the object that coincides with the focus position as the target object. When there are multiple objects in the focus area, the user can also select them.

[0043] It should be noted that if the electronic device obtains the initial image data by shooting in a manual focus mode, the user often directly clicks on the target object to be focused in the screen viewfinder when clicking on the focus point. Therefore, when determining the target object in the focus area, the target object can be directly determined according to the position manually clicked by the user when manually focusing. For example, when the user shoots the current scene by manual focus, he directly clicks on a puppy in the viewfinder to focus. Then, after the shooting is completed, the puppy in the image can be determined as the target object in the focus area.

[0044] Step 103, obtaining in real time the position change information of the target object in the current scene and the motion parameter change information of the electronic device.

[0045] If the target object is in motion, such as running, walking or jumping, its position will change in real time. Therefore, in one embodiment, the electronic device can continuously acquire image frames, and after acquiring a new image frame, it can calculate the position change information of the target object in the current scene based on the position information of the target object in the image frame and the initial image data.

[0046] Among them, the first position information of the target object in the initial image data can be obtained first, and then the second position information of the target object in the new image frame can be obtained, and then the position change information can be calculated. It should be noted that the above-mentioned first position information and second position information are the position information of the target object in the image, and can also be the position information in the real scene obtained according to the position in the image. Furthermore, the first position information and the second position information can be represented in the form of coordinates.

[0047] Specifically, since the image is acquired through an image acquisition device such as a camera or a mobile phone, the coordinates of each point in the image are represented by the camera coordinate system. Since the image acquisition device can be placed at any position in the environment, a reference coordinate system is selected in the environment to describe the position of the image acquisition device. Generally, the position of the image acquisition device is used as the origin to establish a corresponding world coordinate system, and it is used to describe the actual position of any object in the environment. The relationship between the camera coordinate system and the world coordinate system can be described by a rotation matrix and a translation vector, which will not be described in detail here.

[0048] Generally, relative to the initial image data, the new image frame may be acquired later than the time when the initial image data was captured. For example, the initial image data and the new image frame may be two frames of images corresponding to different moments in the video. Specifically, based on the examples given in the aforementioned steps, when the first position information and the second position information are both represented by coordinate information, the position change information may be a vector or a straight line calculated based on the coordinate information.

[0049] It should be noted that only when the target object moves, that is, is in motion, can the position change information of the target object in the current scene be calculated after acquiring a new image frame. If the target object is stationary during this period, the target object has not changed in the current scene, that is, there is no position change information.

[0050] Furthermore, if the target object moves, the focus parameters need to be corrected in real time so that the electronic device always takes the target object as the focus. In the embodiment of the present application, in addition to considering the impact caused by the movement of the target object, the present application also takes into account the impact of the movement state of the lens. Therefore, after obtaining the position change information of the target object in the current scene, the motion parameter change information of the electronic device can also be obtained. Specifically, the motion parameter change information of the electronic device can be calculated based on the motion parameters of the electronic device when the initial image data is captured and the motion parameters of the electronic device when a new image frame is obtained.

[0051] Step 104 , correcting the initial focus parameters according to the position change information and the motion parameter change information, and reshooting the current scene according to the corrected focus parameters to obtain target image data.

[0052] In one embodiment, when performing focus parameter correction, the position change of the target object mainly reflects the active change of the target object (such as a moving car), and the motion parameter change information reflects a change in the camera's relative position to the original position. The superposition processing of the two change parameters can reflect the relative position change of the lens relative to the target object, and then the focus parameters can be accurately adjusted, so that the electronic device can perform subsequent focus processing according to the adjusted focus parameters, thereby re-shooting the current scene according to the corrected focus parameters to obtain target image data.

[0053] It should be noted that after the target image data is acquired, the target image data can be used as new initial image data so that the focus parameter correction and shooting can be continued in the subsequent process.

[0054] Furthermore, after acquiring the target image data, the target image data may be subjected to noise reduction processing, and then the electronic device may perform tone mapping processing (Tone Mapping) on ​​the noise-reduced image to obtain the final image. It is understandable that tone mapping processing on the noise-reduced image may improve the image contrast of the image, so that the target image has a higher dynamic range and better imaging effect. The electronic device may also display the tone-mapped image as a preview image of the current scene on the screen of the electronic device.

[0055] It is understandable that when the actual resolution of the preview image is greater than the resolution of the screen display, a better display effect will not be obtained compared to the case where the actual resolution of the preview image is equal to the screen display resolution. Therefore, before displaying the preview image on the screen of the electronic device, the current resolution of the screen is first obtained, and then the preview image is downsampled according to the current resolution of the screen so that the resolution of the preview image is consistent with the current resolution of the screen. In this way, the synthesis efficiency of multi-frame synthesis can be improved, and when the preview image is displayed, its display effect will not be reduced.

[0056] As can be seen from the above, the image processing method provided by the embodiment of the present application can shoot the current scene according to the initial focus parameters to obtain initial image data, obtain the focus area in the initial image data, and determine the target object in the focus area, obtain the position change information of the target object in the current scene in real time, and the motion parameter change information of the electronic device, correct the initial focus parameters according to the position change information and the motion parameter change information, and re-shoot the current scene according to the corrected focus parameters to obtain the target image data. The embodiment of the present application can correct the focus parameters for each frame of the image, thereby improving the accuracy and efficiency of focusing.

[0057] The following will further introduce the image processing method of the present application based on the method described in the above embodiment. Figure 2 , Figure 2 Another schematic diagram of a flow chart of an image processing method provided in an embodiment of the present application, the image processing method comprising:

[0058] Step 201 : photographing the current scene according to initial focus parameters to obtain initial image data.

[0059] In one embodiment, after determining the framing area, the electronic device may perform a focus process on the framing area, record initial focus parameters, and then shoot according to the initial focus parameters to obtain initial image data. The electronic device may be a mobile electronic device including a camera application, such as a mobile phone, a tablet computer, etc. The initial focus parameters may include focus parameters used by the camera application when performing a focus process on the framing area.

[0060] Furthermore, the initial focus parameter may be a focus parameter determined by an auto focus function when the camera function of the electronic device is just turned on, or may be a focus parameter determined by manual focus by the user.

[0061] Step 202 , performing region segmentation on the initial image data according to the initial focus parameters to determine the focus region.

[0062] In one embodiment, the focus area in the initial image data can be determined by the initial focus parameters. For example, when the electronic device shoots the current scene, the focus parameters are determined by automatic focus or manual focus, and the focus parameters may include focus duration, focal length, focus position and other parameters. Specifically, the focus area can be calculated according to the focus position in the initial image data and the preset range.

[0063] For example, see Figure 3 , Figure 3 A schematic diagram of a scene of the image processing method provided by an embodiment of the present application. In the initial image data, the focus position can be first determined according to the initial focus parameters, and then a rectangular area with a preset side length is segmented with the focus position as the center, and the rectangular area can be determined as the focus area, such as the rectangular area where the person in the picture is located.

[0064] In another embodiment, if the electronic device obtains the initial image data by shooting in a manual focus manner, that is, when the user uses the electronic device to shoot the current scene, manually clicks a certain position in the viewfinder of the electronic device screen, the device will focus on the scene area corresponding to the position, and complete the shooting after focusing. In this case, the position manually clicked by the user is the focus position, so there is no need to determine the focus area according to other focus parameters, and the region is directly segmented according to the above focus position to obtain the focus area.

[0065] It should be noted that, no matter it is automatic focus or manual focus, after determining the focus position, contour recognition can also be performed based on the focus position to obtain an edge contour image of the object at the focus position. Figure 3 When the focus position falls on a person, the entire person's outline is identified through the outline, so that the entire outline of the person can be determined as the focus area. The above outline recognition can use one or more of the morphological erosion algorithm, the Sobel edge detection algorithm, the Prewitt edge detection algorithm, etc. to perform outline recognition on the image, so as to obtain the edge outline image of the object at the focus position.

[0066] Step 203: determine the target object in the focus area, and determine feature points according to the target object.

[0067] After determining the focus area, the target object in the area can be further identified, that is, the object that the user mainly focuses on when shooting. In one embodiment, if the above-mentioned focus area is a rectangular area determined according to the focus position and the preset side length, image recognition can be performed in the area to identify the image subject in the area and determine the subject as the target object. For example, when an object is identified in the focus area, the object can be directly determined as the target object. When multiple objects are identified in the focus area, the target object can be selected from the multiple objects by the center point of the image or by user click.

[0068] In another embodiment, if the focus area is obtained by directly performing contour recognition based on the focus position, that is, the focus area is the edge contour of the object where the focus position is located, then the focus area also contains only one object, which is the target object.

[0069] After determining the target object, the embodiment of the present application further needs to select feature points. The feature points can be the image center of the target object, or can be determined by the user clicking on the image corresponding to the target object. The present application does not further limit this.

[0070] Step 204: Use the initial image data as an initial image frame.

[0071] In one embodiment, after the initial image data is acquired, the initial image data can be used as an initial image frame. Furthermore, the initial image data can be displayed on the screen of the electronic device as a preview image.

[0072] Step 205 , obtaining subsequent image frames, and calculating position change information according to the position information of the feature points in the subsequent image frames and the position information of the feature points in the initial image frame.

[0073] In one embodiment, the present application can continuously acquire subsequent image frames after obtaining the initial image frame, and compare the acquired subsequent image frames with the initial image frame to determine the motion state of the target object image, which can be specifically determined by the position change of the above-mentioned feature points.

[0074] Specifically, the first position information of the feature point in the initial image frame can be obtained first, and then the second position information of the feature point in the subsequent image frame can be obtained, and then the position change information can be calculated. It should be noted that the first position information and the second position information are the position information of the feature point in the image, and can also be the position information in the real scene obtained according to the position in the image. Furthermore, the first position information and the second position information can be represented in the form of coordinates.

[0075] Among them, since the image acquisition device can be placed at any position in the environment, a reference coordinate system is selected in the environment to describe the position of the image acquisition device. Generally, the position of the image acquisition device is used as the origin to establish a corresponding world coordinate system, and it is used to describe the actual position of any object in the environment.

[0076] Step 206: determine the time interval between the initial image frame and the subsequent image frames, and calculate the motion parameter change information of the electronic device within the time interval.

[0077] In the embodiment of the present application, in addition to considering the impact caused by the movement of the target object, the present application also considers the impact caused by the movement state of the lens. Therefore, after obtaining the position change information of the target object in the current scene, the motion parameter change information of the electronic device can also be obtained. Specifically, the motion parameter change information of the electronic device can be calculated based on the motion parameters of the electronic device when the initial image frame is captured and the motion parameters of the electronic device when the subsequent image frames are obtained.

[0078] Generally, relative to the initial image frame, the subsequent image frame may be acquired later than the time when the initial image frame is captured. For example, the initial image frame and the subsequent image frame may be two image frames corresponding to different moments in the video, or two image frames acquired by the camera after a certain interval. Therefore, the time interval between the initial image frame and the subsequent image frame may be determined first, and the motion parameter change information of the electronic device within the time interval may be calculated.

[0079] In one embodiment, the motion parameters of the above-mentioned electronic device can be detected by sensors on the device, such as a gyroscope and an acceleration sensor, and may also include an angular velocity sensor and a pressure sensor. The motion parameter collected by the acceleration sensor may be motion acceleration. The gyroscope is used to detect the steering angle of the electronic device. A single-axis gyroscope may be used to detect the angle change of the electronic device in a single direction for measurement, and sense one dimension of left and right; a three-axis gyroscope may also be used to measure the angle change of the X, Y, and Z axes at the same time, and sense the three dimensions of front and back, left and right, and up and down. Of course, the above-mentioned embodiments are only optional embodiments, and specific settings may also be made according to actual conditions. That is, the steps of obtaining the motion parameter change information of the electronic device may include:

[0080] Obtain parameter change information of the gyroscope and acceleration sensor of the electronic device;

[0081] The motion parameter change information of the electronic device is calculated according to the parameter change information of the gyroscope and the acceleration sensor.

[0082] Step 207: Calculate the relative position change information between the electronic device and the target object according to the position change information and the motion parameter change information.

[0083] In one embodiment, when performing focus parameter correction, the position change of the target object mainly reflects the active change of the target object (such as a moving car), while the motion parameter change information reflects a change in the camera's relative position to the original position. The superposition processing of the two change parameters can reflect the relative position change of the lens relative to the target object, thereby accurately adjusting the focus parameters.

[0084] Step 208: correct the initial focus parameters according to the relative position change information, and re-shoot the current scene according to the corrected focus parameters to obtain target image data.

[0085] After the focus parameters are corrected, the electronic device can perform subsequent focus processing according to the adjusted focus parameters, so as to re-shoot the current scene according to the corrected focus parameters to obtain target image data. After the target image data is obtained, the target image data can be used as new initial image data, so that the focus parameters can be corrected and the shooting can be continued in the subsequent process.

[0086] As can be seen from the above, the image processing method provided by the embodiment of the present application can shoot the current scene according to the initial focus parameters to obtain initial image data, segment the initial image data according to the initial focus parameters to determine the focus area, determine the target object in the focus area, and determine the feature points according to the target object, use the initial image data as the initial image frame, obtain subsequent image frames, and calculate the position change information according to the position information of the feature points in the subsequent image frames and the position information of the feature points in the initial image frame, determine the time interval between the initial image frame and the subsequent image frame, and calculate the motion parameter change information of the electronic device within the time interval, calculate the relative position change information between the electronic device and the target object according to the position change information and the motion parameter change information, correct the initial focus parameters according to the relative position change information, and re-shoot the current scene according to the corrected focus parameters to obtain the target image data. The embodiment of the present application can correct the focus parameters for each frame of the image, thereby improving the accuracy and efficiency of focusing.

[0087] See also Figure 4 , Figure 4 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application. The image processing device 30 includes:

[0088] The shooting module 301 is used to shoot the current scene according to the initial focus parameters to obtain initial image data;

[0089] A determination module 302 is used to obtain a focus area in the initial image data and determine a target object in the focus area;

[0090] An acquisition module 303 is used to acquire, in real time, position change information of the target object in the current scene and motion parameter change information of the electronic device;

[0091] The correction module 304 is used to correct the initial focus parameter according to the position change information and the motion parameter change information, and re-shoot the current scene according to the corrected focus parameter to obtain target image data.

[0092] In one embodiment, continue to refer to Figure 5 , wherein the determination module 302 may specifically include:

[0093] The segmentation submodule 3021 is used to perform region segmentation on the initial image data according to the initial focus parameter to determine a focus area;

[0094] The determination submodule 3022 is used to determine the target object in the focus area and determine feature points according to the target object.

[0095] In one embodiment, the acquisition module 303 may specifically include:

[0096] The processing submodule 3031 is used to use the initial image data as an initial image frame;

[0097] A first calculation submodule 3032 is used to obtain subsequent image frames, and calculate position change information according to the position information of the feature points in the subsequent image frames and the position information of the feature points in the initial image frame;

[0098] The second calculation submodule 3033 is used to determine the time interval between the initial image frame and the subsequent image frame, and calculate the motion parameter change information of the electronic device within the time interval.

[0099] As can be seen from the above, the image processing device 30 of the embodiment of the present application can shoot the current scene according to the initial focus parameters to obtain initial image data, obtain the focus area in the initial image data, and determine the target object in the focus area, obtain the position change information of the target object in the current scene in real time, and the motion parameter change information of the electronic device, correct the initial focus parameters according to the position change information and the motion parameter change information, and re-shoot the current scene according to the corrected focus parameters to obtain the target image data. The embodiment of the present application can correct the focus parameters for each frame of the image, thereby improving the accuracy and efficiency of focusing.

[0100] In the embodiment of the present application, the image processing device and the image processing method in the above embodiment belong to the same concept. Any method provided in the image processing method embodiment can be run on the image processing device. The specific implementation process is detailed in the embodiment of the image processing method and will not be repeated here.

[0101] The term "module" used herein can be regarded as a software object executed on the computing system. The different components, modules, engines and services described herein can be regarded as implementation objects on the computing system. The apparatus and method described herein can be implemented in software, and of course can also be implemented in hardware, all within the scope of protection of this application.

[0102] An embodiment of the present application further provides a storage medium on which a computer program is stored. When the computer program is executed on a computer, the computer is enabled to execute the above-mentioned image processing method.

[0103] The embodiment of the present application also provides an electronic device, such as a tablet computer, a mobile phone, etc. The processor in the electronic device will load instructions corresponding to the processes of one or more application programs into the memory according to the following steps, and the processor will run the application programs stored in the memory to implement various functions:

[0104] Shooting the current scene according to the initial focus parameters to obtain initial image data;

[0105] Acquire a focus area in the initial image data, and determine a target object in the focus area;

[0106] Acquire the position change information of the target object in the current scene and the motion parameter change information of the electronic device in real time;

[0107] The initial focus parameter is corrected according to the position change information and the motion parameter change information, and the current scene is re-photographed according to the corrected focus parameter to obtain target image data.

[0108] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0109] See also Figure 6 , the electronic device 400 includes a processor 401 and a memory 402. The processor 401 is electrically connected to the memory 402.

[0110] The processor 400 is the control center of the electronic device 400. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device 400 and processes data by running or loading computer programs stored in the memory 402 and calling data stored in the memory 402, thereby monitoring the electronic device 400 as a whole.

[0111] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the computer programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0112] In the embodiment of the present application, the processor 401 in the electronic device 400 will load instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 will run the computer program stored in the memory 402, thereby realizing various functions, as follows:

[0113] Shooting the current scene according to the initial focus parameters to obtain initial image data;

[0114] Acquire a focus area in the initial image data, and determine a target object in the focus area;

[0115] Acquire the position change information of the target object in the current scene and the motion parameter change information of the electronic device in real time;

[0116] The initial focus parameter is corrected according to the position change information and the motion parameter change information, and the current scene is re-photographed according to the corrected focus parameter to obtain target image data.

[0117] Please also read Figure 7 In some implementations, the electronic device 400 may further include: a display 403, a radio frequency circuit 404, an audio circuit 405, and a power supply 406. The display 403, the radio frequency circuit 404, the audio circuit 405, and the power supply 406 are electrically connected to the processor 401, respectively.

[0118] The display 403 may be used to display information input by the user or information provided to the user and various graphical user interfaces, which may be composed of graphics, text, icons, videos, and any combination thereof. The display 403 may include a display panel, and in some embodiments, the display panel may be configured in the form of a liquid crystal display (LCD) or an organic light-emitting diode (OLED).

[0119] The radio frequency circuit 404 can be used to send and receive radio frequency signals to establish wireless communication with network devices or other electronic devices through wireless communication, and to send and receive signals between network devices or other electronic devices. Generally, the radio frequency circuit 501 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM) card, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc.

[0120] The audio circuit 405 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 506 can convert the received audio data into an electrical signal, transmit it to the speaker, and convert it into a sound signal for output by the speaker.

[0121] The power supply 406 can be used to supply power to various components of the electronic device 400. In some embodiments, the power supply 406 can be logically connected to the processor 401 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 406 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0122] although Figure 7 Not shown, the electronic device 400 may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0123] In the embodiment of the present application, the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0124] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0125] It should be noted that, for the image processing method of the embodiment of the present application, ordinary testers in the field can understand that all or part of the process of implementing the image processing method of the embodiment of the present application can be completed by controlling the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, such as a memory of an electronic device, and executed by at least one processor in the electronic device, and the execution process may include the process of the embodiment of the image processing method. Among them, the storage medium can be a disk, an optical disk, a read-only memory, a random access memory, etc.

[0126] For the image processing device of the embodiment of the present application, each functional module can be integrated into a processing chip, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium, such as a read-only memory, a disk or an optical disk.

[0127] The above is a detailed introduction to an image processing method, device, storage medium and electronic device provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An image processing method, characterized in that: The method comprises the following steps: Shooting the current scene according to the initial focus parameters to obtain initial image data; Acquire a focus area in the initial image data, and determine a target object in the focus area; According to the subsequent image frames obtained by shooting and the initial image data, real-time acquisition of position change information of the target object in the current scene and motion parameter change information of the electronic device, wherein the position change information is calculated based on the first position information and the second position information, and the first position information and the second position information are the positions of the target object in the initial image data and the subsequent image frames, respectively; Correcting the initial focus parameter according to the position change information and the motion parameter change information, and reshooting the current scene according to the corrected focus parameter to obtain target image data; Wherein, determining the target object in the focus area includes: When it is determined that the focus area includes an object, the object included in the focus area is regarded as a target object; When it is determined that the focus area includes a plurality of objects, determining a target object in the focus area from among the plurality of objects included according to a user selection; or, When it is determined that the focus area includes a plurality of objects, an object that coincides with the focus position is selected from the plurality of objects as the target object.

2. The image processing method according to claim 1, characterized in that: The step of acquiring a focus area in the initial image data and determining a target object in the focus area comprises: Performing region segmentation on the initial image data according to the initial focus parameter to determine a focus region; A target object in the focus area is determined, and a feature point is determined according to the target object.

3. The image processing method according to claim 2, characterized in that: The step of acquiring the position change information of the target object in the current scene and the motion parameter change information of the electronic device in real time includes: Using the initial image data as an initial image frame; Acquire subsequent image frames, and calculate position change information according to position information of the feature points in the subsequent image frames and position information of the feature points in the initial image frame; The time interval between the initial image frame and the subsequent image frame is determined, and the motion parameter change information of the electronic device within the time interval is calculated.

4. The image processing method according to claim 1, characterized in that: The step of correcting the initial focus parameter according to the position change information and the motion parameter change information comprises: Calculating relative position change information between the electronic device and the target object according to the position change information and the motion parameter change information; The initial focus parameter is corrected according to the relative position change information.

5. The image processing method according to claim 1, characterized in that: The step of obtaining the motion parameter change information of the electronic device includes: Acquiring parameter change information of a gyroscope and an acceleration sensor of the electronic device; The motion parameter change information of the electronic device is calculated according to the parameter change information of the gyroscope and the acceleration sensor.

6. An image processing device, characterized in that: The device comprises: A shooting module, used to shoot the current scene according to the initial focus parameters to obtain initial image data; A determination module is used to obtain a focus area in the initial image data and determine a target object in the focus area, wherein the determination of the target object in the focus area includes: When it is determined that the focus area includes an object, the object included in the focus area is regarded as a target object; When it is determined that the focus area includes a plurality of objects, determining a target object in the focus area from among the plurality of objects included according to a user selection; or, When it is determined that the focus area includes multiple objects, an object coinciding with the focus position is selected from the multiple objects as the target object; an acquisition module, configured to acquire, in real time, position change information of the target object in the current scene and motion parameter change information of the electronic device according to subsequent image frames obtained by shooting and the initial image data, wherein the position change information is calculated according to the first position information and the second position information, and the first position information and the second position information are the positions of the target object in the initial image data and the subsequent image frames, respectively; The correction module is used to correct the initial focus parameter according to the position change information and the motion parameter change information, and re-shoot the current scene according to the corrected focus parameter to obtain target image data.

7. The image processing device according to claim 6, characterized in that: The determination module comprises: A segmentation submodule, used for performing regional segmentation on the initial image data according to the initial focus parameter to determine a focus area; The determination submodule is used to determine the target object in the focus area and determine the feature points according to the target object.

8. The image processing device according to claim 7, characterized in that: The acquisition module comprises: A processing submodule, used for taking the initial image data as an initial image frame; A first calculation submodule, used for acquiring subsequent image frames, and calculating position change information according to position information of the feature points in the subsequent image frames and position information of the feature points in the initial image frame; The second calculation submodule is used to determine the time interval between the initial image frame and the subsequent image frame, and calculate the motion parameter change information of the electronic device within the time interval.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed on a computer, the computer is caused to execute the image processing method according to any one of claims 1 to 5.

10. An electronic device, comprising a processor and a memory, wherein the memory stores a plurality of instructions, characterized in that: The processor loads the instructions in the memory for executing the following steps: Shooting the current scene according to the initial focus parameters to obtain initial image data; Acquire a focus area in the initial image data, and determine a target object in the focus area; According to the subsequent image frames obtained by shooting and the initial image data, real-time acquisition of position change information of the target object in the current scene and motion parameter change information of the electronic device, wherein the position change information is calculated based on the first position information and the second position information, and the first position information and the second position information are the positions of the target object in the initial image data and the subsequent image frames, respectively; Correcting the initial focus parameter according to the position change information and the motion parameter change information, and reshooting the current scene according to the corrected focus parameter to obtain target image data; Wherein, determining the target object in the focus area includes: When it is determined that the focus area includes an object, the object included in the focus area is regarded as a target object; When it is determined that the focus area includes a plurality of objects, determining a target object in the focus area from among the plurality of objects included according to a user selection; or, When it is determined that the focus area includes a plurality of objects, an object that coincides with the focus position is selected from the plurality of objects as the target object.