CN112738398B - Image anti-shake method and device and electronic equipment - Google Patents

Image anti-shake method and device and electronic equipment Download PDF

Info

Publication number
CN112738398B
CN112738398B CN202011594597.9A CN202011594597A CN112738398B CN 112738398 B CN112738398 B CN 112738398B CN 202011594597 A CN202011594597 A CN 202011594597A CN 112738398 B CN112738398 B CN 112738398B
Authority
CN
China
Prior art keywords
image
shake
human body
background
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011594597.9A
Other languages
Chinese (zh)
Other versions
CN112738398A (en
Inventor
顾瀚之
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Hangzhou Co Ltd
Original Assignee
Vivo Mobile Communication Hangzhou Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Hangzhou Co Ltd filed Critical Vivo Mobile Communication Hangzhou Co Ltd
Priority to CN202011594597.9A priority Critical patent/CN112738398B/en
Publication of CN112738398A publication Critical patent/CN112738398A/en
Application granted granted Critical
Publication of CN112738398B publication Critical patent/CN112738398B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/68Control of cameras or camera modules for stable pick-up of the scene, e.g. compensating for camera body vibrations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Studio Devices (AREA)

Abstract

The application discloses an image anti-shake method, an image anti-shake device and electronic equipment, and relates to the technical field of communication. The image anti-shake method comprises the following steps: in the video recording process, a first target image is obtained through a camera; performing segmentation processing on the first target image to obtain at least one human body image and a background image; performing anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; performing anti-shake processing on the background image to obtain a corresponding background anti-shake image; and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image, and obtaining a target video according to the fused image. The scheme of the application is used for solving the problems that in the existing image anti-shake method, anti-shake processing is only carried out on one of a human body image or a background image with the same depth of field in a video image, so that shake in the video image cannot be completely eliminated and the image is distorted.

Description

Image anti-shake method and device and electronic equipment
Technical Field
The application belongs to the technical field of communication, and particularly relates to an image anti-shake method and device and electronic equipment.
Background
At present, more and more electronic devices have an image or video shooting function, and in the process of shooting images or videos, especially in the process of shooting by handheld electronic devices, the electronic devices may shake to some extent, which causes the shot images or videos to be blurred, so that anti-shake processing needs to be performed on the shot images or videos of the electronic devices, and the quality of the images or videos is improved.
In the process of implementing the present application, the inventor finds that at least the following problems exist in the prior art:
in the existing image or video anti-shake method, anti-shake processing can be performed only on one of a human body image or a background image with the same depth of field in an image, and anti-shake processing of the human body image and the background image with different depths of field cannot be performed simultaneously.
Disclosure of Invention
An object of the embodiments of the present application is to provide an image anti-shake method, an image anti-shake device, and an electronic apparatus, which can solve the problems that in an existing image anti-shake method, only one of a human body image and a background image with the same depth of field in an image is subjected to anti-shake processing, so that shake in the image cannot be completely eliminated, and the image is distorted.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides an image anti-shake method, including:
in the video recording process, a first target image is obtained through a camera;
performing segmentation processing on the first target image to obtain at least one human body image and a background image;
carrying out anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image;
performing anti-shake processing on the background image to obtain a corresponding background anti-shake image;
fusing the human body anti-shake image and the background anti-shake image to obtain a fused image;
and obtaining a target video according to the fusion image.
In a second aspect, an embodiment of the present application provides an image anti-shake apparatus, including:
the acquisition module is used for acquiring a first target image through a camera in the video recording process;
the first segmentation module is used for carrying out segmentation processing on the first target image to obtain at least one human body image and a background image;
the first anti-shake module is used for carrying out anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image;
the second anti-shake module is used for carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image;
the fusion module is used for fusing the human body anti-shake image and the background anti-shake image to obtain a fused image;
and the video generation module is used for obtaining a target video according to the fusion image.
In a third aspect, an embodiment of the present application further provides an electronic device, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the method according to the first aspect.
In a fourth aspect, the present embodiments also provide a readable storage medium, on which a program or instructions are stored, where the program or instructions, when executed by a processor, implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method according to the first aspect.
In this way, in the embodiment of the application, at least one human body image and a background image are obtained by segmenting the first target image acquired by the camera; performing anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image; and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image, generating a target video according to the fused image, and performing anti-shake treatment on the human body image and the background image in the video image respectively to eliminate all problems of instability and image distortion caused by shake in the video image.
Drawings
Fig. 1 is a flowchart of an image anti-shake method according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of an anti-shake process performed on a human body image according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of performing anti-shake processing on a background image according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram illustrating fusion of a human anti-shake image and a background anti-shake image according to an embodiment of the present application;
fig. 5 is a block diagram of an image anti-shake apparatus provided in an embodiment of the present application;
fig. 6 is a block diagram of an electronic device provided by an embodiment of the present application;
fig. 7 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
The image anti-shake method provided by the embodiment of the present application is described in detail below with reference to the accompanying drawings by using specific embodiments and application scenarios thereof.
The method of the embodiment of the present application is applied to a User Equipment (UE), which may refer to an access terminal, a subscriber unit, a subscriber station, a mobile station, a remote terminal, a mobile device, a user terminal, a wireless communication device, a user agent, or a user equipment. The terminal device may also be a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA), a handheld device with wireless communication capability, a computing device or other processing device connected to a wireless modem, a vehicle mounted device, a wearable device.
Optionally, the method provided in this embodiment of the present application is applied to an electronic device, where the electronic device may be a mobile terminal having a photographing function or a video photographing function and an image processing function, such as a mobile phone, a tablet computer, a wearable smart device, and the like, and is not limited in this embodiment of the present application.
As shown in fig. 1, an embodiment of the present application provides an image anti-shake method, including:
step 101: in the video recording process, a first target image is acquired through a camera.
In this embodiment of the application, the first target image may be one or one frame of image in a current video captured by the electronic device starting a video recording function, or may be one frame of image in a segment of video captured by the electronic device through the video recording function.
Step 102: and carrying out segmentation processing on the first target image to obtain at least one human body image and a background image.
In the embodiment of the application, the first target image is subjected to segmentation processing of a human body image and a background image, a part of the human body image and a part of the background image in the first target image are identified, and tracking of the human body image is performed to obtain at least one human body image and one background image.
Step 103: and performing anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image.
In the embodiment of the application, a portrait anti-shake algorithm is executed on the at least one human body image, anti-shake processing is performed, and a corresponding human body anti-shake image is obtained.
Step 104: and performing anti-shake processing on the background image to obtain a corresponding background anti-shake image.
In the embodiment of the application, a background anti-shake algorithm is executed on the background image, and anti-shake processing is performed to obtain a corresponding background anti-shake image.
The image anti-shake method provided by the embodiment of the present application can eliminate all the instability problems and image distortion problems caused by shake in the image by performing anti-shake processing on the human body image and the background image respectively.
Step 105: and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image.
In the embodiment of the application, the human body anti-shake image and the background anti-shake image after anti-shake processing are fused to obtain a fused image, and the fused image is output.
Step 106: and obtaining a target video according to the fusion image.
In the embodiment of the application, the segmentation of the human body image and the background image is respectively performed on each frame of image or each image in the target video, the anti-shake processing is respectively performed on the human body image and the background image, the human body image and the background image after the anti-shake processing are fused to obtain a fused image of each frame or a fused image of each frame, and the fused image of each frame or the fused image of each frame is combined to obtain the anti-shake processed target video.
According to the method, at least one human body image and a background image are obtained by segmenting a first target image acquired by a camera; carrying out anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; performing anti-shake processing on the background image to obtain a corresponding background anti-shake image; and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image, generating a target video according to the fused image, and performing anti-shake treatment on the human body image and the background image in the video image respectively to eliminate all problems of instability and image distortion caused by shake in the video image.
Optionally, the performing anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image includes:
and performing anti-shake treatment on each human body image respectively to obtain the human body anti-shake images corresponding to the human body images respectively.
In this embodiment of the application, when the first target image includes two or more human body images, each human body image may be divided, and after image tracking is performed, each image is subjected to anti-shake processing, so as to obtain a corresponding human body anti-shake image, and an anti-shake processing result of each human body image may be clearer.
Optionally, if the images include two human body images and the two human body images are located at the same depth of field, the two images may be selected to be subjected to uniform anti-shake processing, and the processing efficiency may be improved by uniformly performing anti-shake processing on each image.
If the image comprises two human body images and the two human body images are in different depths of field, anti-shake processing can be respectively carried out on each image, and the problem of unstable images caused by image shake in the image can be solved.
Optionally, the anti-shake processing is performed on each human body image respectively to obtain the human body anti-shake images corresponding to each human body image respectively, and the method specifically includes:
establishing a first anti-shake coordinate system according to the face position of the human body image;
and carrying out anti-shaking processing on the human body image by utilizing the first anti-shaking matrix of the human body image and the first anti-shaking coordinate system to obtain the corresponding human body anti-shaking image.
In the embodiment of the application, the portrait anti-shake algorithm is to perform a first anti-shake matrix calculation according to gyroscope data, establish a first anti-shake coordinate system in the depth of field where a human face is located, perform anti-shake processing on an entire human body image according to the first anti-shake matrix and the first anti-shake coordinate system, and keep the human body image stable. Referring to fig. 2, a first human body image in a first target image is first segmented, and then an anti-shake processing is performed to calculate a movement amount according to a human image anti-shake algorithm, so as to obtain a human body anti-shake image. The position of the dotted line image in fig. 2 is the position of the actual human body image, and the position of the real line image is the position of the human body image after the anti-shake processing is performed according to the first anti-shake matrix and the first anti-shake coordinate system.
It should be noted that, the method for calculating the anti-shake matrix according to the gyroscope data is the prior art, and is not described herein again.
Optionally, the electronic device comprises a plurality of cameras;
the anti-shake processing is respectively carried out on each human body image to obtain the human body anti-shake image respectively corresponding to each human body image, and the method specifically comprises the following steps:
tracking the human body image through a target camera aiming at each human body image in each human body image; the target cameras corresponding to the human body images are different from one another;
and carrying out anti-shaking processing on the human body image according to the data of the gyroscope corresponding to the target camera to obtain a human body anti-shaking image corresponding to the human body image.
In this embodiment of the application, if the electronic device includes a plurality of cameras, and the number of the cameras is greater than or equal to the number of the human body images included in the first target image, each human body image corresponds to a different target camera, each target camera tracks one human body image, a first anti-shake matrix is calculated according to data of a gyroscope corresponding to the target camera, and the human body images are subjected to anti-shake processing by using the first anti-shake matrix, so as to obtain human body anti-shake images corresponding to the human body images. Optionally, the performing anti-shake processing on the background image to obtain a corresponding background anti-shake image includes:
establishing a second anti-shake coordinate system according to the background depth of field of the background image;
and carrying out anti-shake processing on the background image by utilizing a second anti-shake matrix corresponding to the background image and the second anti-shake coordinate system to obtain the corresponding background anti-shake image.
In the embodiment of the application, the background anti-shake algorithm is to perform second anti-shake matrix calculation according to gyroscope data, establish a second anti-shake coordinate system in the depth of field where the background is located, perform anti-shake processing on the background image according to the second anti-shake matrix and the second anti-shake coordinate system, and keep the background image stable. Referring to fig. 3, first, a first background image in a first target image is segmented, and then, a movement amount is calculated according to a background anti-shake algorithm, so as to perform anti-shake processing, thereby obtaining a background anti-shake image, where a position of a dotted image in fig. 3 is a position of an actual background image, and a position of a real line image is a position of the background image after the anti-shake processing.
Optionally, in a case that the electronic device starts the main camera and the wide-angle camera at the same time, the first target image is an image acquired by the main camera of the electronic device;
the anti-shake processing is performed on the background image to obtain a corresponding background anti-shake image, and the method comprises the following steps:
and taking a second target image collected by the wide-angle camera as a reference, and carrying out anti-shake processing on the background image of the first target image to obtain a corresponding background anti-shake image.
In another embodiment of the application, when the electronic device includes the main camera and the wide-angle camera and the main camera and the wide-angle camera are used to capture images at the same time, the first target image is an image captured by the main camera of the electronic device, the first target image captured by the main camera is segmented, and the human body image of the first target image is subjected to anti-shake processing according to the method provided by the above embodiment, so as to obtain a human body anti-shake image. In the anti-shake processing process of the background image of the first target image, the anti-shake processing is carried out on the background image of the first target image collected by the main camera by taking the second target image collected by the wide-angle camera as a reference, and due to the time difference relation between the collected images of the wide-angle camera and the main camera, the second target image collected by the wide-angle camera can collect blind spots behind the human body image in the collected first target image of the main camera, cover the blind zones generated by the segmentation of the human body image and the background image, is beneficial to the completion of the difference value of the background image of the collected first target image of the main camera, and optimizes the quality of the fused image.
In the embodiment of the present application, please refer to fig. 4, when the human anti-shake image and the background anti-shake image are fused, the absolute position of the human anti-shake image and the absolute position of the background anti-shake image are kept unchanged, that is, the human anti-shake image and the background anti-shake image are both kept at the original position of the video image, so as to obtain the fused image.
It should be noted that, in the image anti-shake method provided in the embodiment of the present application, the execution subject may be an image anti-shake apparatus, or a control module for executing the image anti-shake method in the image anti-shake apparatus. In the embodiment of the present application, an image anti-shake method executed by an image anti-shake apparatus is taken as an example to describe the image anti-shake apparatus provided in the embodiment of the present application.
Fig. 5 is a block diagram of an image anti-shake apparatus according to an embodiment of the present application. The image anti-shake apparatus 500 shown in fig. 5 includes an acquisition module 501, a first division module 502, a first anti-shake module 503, a second anti-shake module 504, a fusion module 505, and a video generation module 506.
An obtaining module 501, configured to obtain a first target image through a camera in a video recording process;
a first segmentation module 502, configured to perform segmentation processing on the first target image to obtain at least one human body image and a background image;
the first anti-shake module 503 is configured to perform anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image;
a second anti-shake module 504, configured to perform anti-shake processing on the background image to obtain a corresponding background anti-shake image;
a fusion module 505, configured to fuse the human anti-shake image and the background anti-shake image to obtain a fused image;
and a video generating module 506, configured to obtain a target video according to the fused image.
The image anti-shake apparatus 500 provided in the embodiment of the present application obtains at least one human body image and a background image by performing segmentation processing on a first target image acquired by a camera; performing anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; performing anti-shake processing on the background image to obtain a corresponding background anti-shake image; and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image, generating a target video according to the fused image, and performing anti-shake treatment on the human body image and the background image in the video image respectively to eliminate all problems of instability and image distortion caused by shake in the video image.
Optionally, the first anti-shake module 503 includes:
and the first sub anti-shake module is used for respectively carrying out anti-shake treatment on the at least one human body image to obtain the corresponding human body anti-shake image.
Optionally, the first sub-anti-shake module includes:
the first coordinate system establishing unit is used for establishing a first anti-shake coordinate system according to the face position of the human body image;
and the first anti-shaking unit is used for carrying out anti-shaking processing on the human body image by utilizing the first anti-shaking matrix of the human body image and the first anti-shaking coordinate system to obtain the corresponding human body anti-shaking image.
Optionally, the electronic device comprises a plurality of cameras;
the first sub anti-shake module 503 includes:
the tracking unit is used for tracking each human body image in each human body image through the target camera; the target cameras corresponding to the human body images are different from one another;
and the second anti-shake unit is used for carrying out anti-shake processing on the human body image according to the data of the gyroscope corresponding to the target camera to obtain a human body anti-shake image corresponding to the human body image.
Optionally, the second anti-shake module 504 includes:
the second coordinate system establishing unit is used for establishing a second anti-shake coordinate system according to the background depth of field of the background image;
and the third anti-shake unit is used for carrying out anti-shake processing on the background image by utilizing a second anti-shake matrix corresponding to the background image and the second anti-shake coordinate system to obtain the corresponding background anti-shake image.
Optionally, in a case that the electronic device starts the main camera and the wide-angle camera at the same time, the first target image is an image acquired by the main camera of the electronic device;
the second anti-shake module 504 further includes:
and the fourth anti-shake unit is used for carrying out anti-shake processing on the background image of the first target image by taking the second target image acquired by the wide-angle camera as a reference to obtain a corresponding background anti-shake image.
The device 500 in the embodiment of the present application obtains at least one human body image and a background image by performing segmentation processing on a first target image acquired by a camera; performing anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image; and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image, generating a target video according to the fused image, and performing anti-shake treatment on the human body image and the background image in the video image respectively to eliminate all problems of instability and image distortion caused by shake in the video image.
The image anti-shake apparatus in the embodiment of the present application may be an apparatus, or may be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiment of the present application is not particularly limited.
The image anti-shake apparatus in the embodiment of the present application may be an apparatus having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The image anti-shake apparatus provided in the embodiment of the present application can implement each process implemented in the method embodiments of fig. 1 to fig. 4, and is not described here again to avoid repetition.
According to the device, at least one human body image and a background image are obtained by segmenting a first target image acquired by a camera; carrying out anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image; and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image, generating a target video according to the fused image, and performing anti-shake treatment on the human body image and the background image in the video image respectively to eliminate all problems of instability and image distortion caused by shake in the video image.
It should be noted that the image anti-shake apparatus provided in the embodiments of the present application is an apparatus capable of executing the image anti-shake method, and all embodiments of the image anti-shake method are applicable to the apparatus and can achieve the same or similar beneficial effects.
Optionally, as shown in fig. 6, an electronic device 600 is further provided in this embodiment of the present application, and includes a processor 601, a memory 602, and a program or an instruction stored in the memory 602 and executable on the processor 601, where the program or the instruction is executed by the processor 601 to implement each process of the image anti-shake method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and the non-mobile electronic devices described above.
The electronic device provided by the embodiment of the application is an electronic device capable of executing the image anti-shake method, and all embodiments of the image anti-shake method are suitable for the electronic device and can achieve the same or similar beneficial effects.
Fig. 7 is a schematic diagram of a hardware structure of an electronic device implementing various embodiments of the present application.
The electronic device 700 includes, but is not limited to: a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, and a processor 710.
Those skilled in the art will appreciate that the electronic device 700 may also include a power supply (e.g., a battery) for powering the various components, and the power supply may be logically coupled to the processor 710 via a power management system, such that the functions of managing charging, discharging, and power consumption may be performed via the power management system. The electronic device structure shown in fig. 7 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
The processor 710 is configured to obtain a first target image through a camera in a video recording process; performing segmentation processing on the first target image to obtain at least one human body image and a background image; carrying out anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image; fusing the human body anti-shake image and the background anti-shake image to obtain a fused image; and obtaining a target video according to the fusion image.
As can be seen, the electronic device 700 performs segmentation processing on the first target image acquired by the camera to obtain at least one human body image and a background image; performing anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image; and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image, generating a target video according to the fused image, and performing anti-shake treatment on the human body image and the background image in the video image respectively to eliminate all problems of instability and image distortion caused by shake in the video image.
Optionally, the processor 710 is further configured to perform anti-shake processing on each human body image, respectively, to obtain the human body anti-shake images corresponding to each human body image.
Optionally, the processor 710 is further configured to establish a first anti-shake coordinate system according to the face position of the human body image; and performing anti-shake processing on the human body image by using the first anti-shake matrix and the first anti-shake coordinate system of the human body image to obtain the corresponding human body anti-shake image.
Optionally, the electronic device comprises a plurality of cameras;
the processor 710 is further configured to track, for each of the individual human body images, the human body image through a target camera; the target cameras corresponding to the human body images are different from one another; and performing anti-shaking processing on the human body image according to the data of the gyroscope corresponding to the target camera to obtain a human body anti-shaking image corresponding to the human body image.
Optionally, the processor 710 is further configured to establish a second anti-shake coordinate system according to a background depth of field of the background image; and carrying out anti-shake processing on the background image by utilizing a second anti-shake matrix corresponding to the background image and the second anti-shake coordinate system to obtain the corresponding background anti-shake image.
Optionally, the processor 710 is further configured to perform anti-shake processing on a background image of the first target image by using a second target image acquired by the wide-angle camera as a reference, so as to obtain the corresponding background anti-shake image.
The electronic device 700 provided by the embodiment of the application obtains at least one human body image and a background image by segmenting a first target image acquired by a camera; carrying out anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image; carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image; and fusing the human body anti-shake image and the background anti-shake image to obtain a fused image, generating a target video according to the fused image, and performing anti-shake treatment on the human body image and the background image in the video image respectively to eliminate all problems of instability and image distortion caused by shake in the video image.
It should be noted that the electronic device provided in the embodiments of the present application is an electronic device capable of executing the image anti-shake method, and all embodiments of the image anti-shake method are applicable to the electronic device and can achieve the same or similar beneficial effects.
It should be understood that, in the embodiment of the present application, the input Unit 704 may include a Graphics Processing Unit (GPU) 7041 and a microphone 7042, and the Graphics processor 7041 processes image data of a still picture or a video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 707 includes a touch panel 7071 and other input devices 7072. The touch panel 7071 is also referred to as a touch screen. The touch panel 7071 may include two parts of a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. Memory 709 may be used to store software programs as well as various data, including but not limited to applications and operating systems. Processor 710 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 710.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the image anti-shake method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement each process of the image anti-shake method embodiment, and can achieve the same technical effect, and is not described here again to avoid repetition.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (12)

1. An image anti-shake method, comprising:
in the video recording process, a first target image is obtained through a camera;
performing segmentation processing on the first target image to obtain at least one human body image and a background image;
carrying out anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image;
carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image;
fusing the human body anti-shake image and the background anti-shake image to obtain a fused image;
obtaining a target video according to the fusion image;
the anti-shake processing is performed on the at least one human body image to obtain a corresponding human body anti-shake image, and the method comprises the following steps: executing a portrait anti-shake algorithm on the at least one human body image, and performing anti-shake processing to obtain a corresponding human body anti-shake image;
the anti-shake processing is performed on the background image to obtain a corresponding background anti-shake image, and the method comprises the following steps: executing a background anti-shake algorithm on the background image, and performing anti-shake processing to obtain a corresponding background anti-shake image;
under the condition that the electronic equipment simultaneously starts a main camera and a wide-angle camera, the first target image is an image collected by the main camera of the electronic equipment;
the anti-shake processing is performed on the background image to obtain a corresponding background anti-shake image, and the method comprises the following steps:
and taking a second target image collected by the wide-angle camera as a reference, and carrying out anti-shake processing on the background image of the first target image to obtain a corresponding background anti-shake image.
2. The image anti-shake method according to claim 1, wherein the performing anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image comprises:
and performing anti-shake processing on each human body image respectively to obtain the human body anti-shake images corresponding to the human body images respectively.
3. The image anti-shake method according to claim 2, wherein the anti-shake processing is performed on each human body image respectively to obtain the human body anti-shake images corresponding to each human body image respectively, and specifically includes:
establishing a first anti-shake coordinate system according to the face position of the human body image;
and carrying out anti-shaking processing on the human body image by utilizing the first anti-shaking matrix of the human body image and the first anti-shaking coordinate system to obtain the corresponding human body anti-shaking image.
4. The image anti-shake method according to claim 2, wherein the electronic device comprises a plurality of cameras;
the anti-shake processing is respectively carried out on each human body image to obtain the human body anti-shake image respectively corresponding to each human body image, and the method specifically comprises the following steps:
tracking the human body image through a target camera aiming at each human body image in each human body image; the target cameras corresponding to the human body images are different from one another;
and performing anti-shake processing on the human body image according to the data of the gyroscope corresponding to the target camera to obtain a human body anti-shake image corresponding to the human body image.
5. The image anti-shake method according to claim 1, wherein the anti-shake processing is performed on the background image to obtain a corresponding background anti-shake image, and the method comprises:
establishing a second anti-shake coordinate system according to the background depth of field of the background image;
and performing anti-shake processing on the background image by using a second anti-shake matrix corresponding to the background image and the second anti-shake coordinate system to obtain the corresponding background anti-shake image.
6. An image anti-shake apparatus, comprising:
the acquisition module is used for acquiring a first target image through a camera in the video recording process;
the first segmentation module is used for carrying out segmentation processing on the first target image to obtain at least one human body image and a background image;
the first anti-shake module is used for carrying out anti-shake processing on the at least one human body image to obtain a corresponding human body anti-shake image;
the second anti-shake module is used for carrying out anti-shake processing on the background image to obtain a corresponding background anti-shake image;
the fusion module is used for fusing the human body anti-shake image and the background anti-shake image to obtain a fused image;
the video generation module is used for obtaining a target video according to the fusion image;
the first anti-shake module is specifically configured to: executing a portrait anti-shake algorithm on the at least one human body image, and performing anti-shake processing to obtain a corresponding human body anti-shake image;
the second anti-shake module is specifically configured to: executing a background anti-shake algorithm on the background image, and performing anti-shake processing to obtain a corresponding background anti-shake image;
under the condition that the electronic equipment simultaneously starts a main camera and a wide-angle camera, the first target image is an image collected by the main camera of the electronic equipment;
the second anti-shake module further comprises:
and the fourth anti-shake unit is used for carrying out anti-shake processing on the background image of the first target image by taking the second target image acquired by the wide-angle camera as a reference to obtain a corresponding background anti-shake image.
7. The image anti-shake apparatus according to claim 6, wherein the first anti-shake module comprises:
and the first sub anti-shake module is used for respectively carrying out anti-shake treatment on each human body image to obtain the human body anti-shake images respectively corresponding to each human body image.
8. The image anti-shake apparatus according to claim 7, wherein the first sub anti-shake module comprises:
the first coordinate system establishing unit is used for establishing a first anti-shake coordinate system according to the face position of the human body image;
and the first anti-shaking unit is used for carrying out anti-shaking processing on the human body image by utilizing the first anti-shaking matrix of the human body image and the first anti-shaking coordinate system to obtain the corresponding human body anti-shaking image.
9. The image anti-shake apparatus according to claim 7, wherein the electronic device includes a plurality of cameras;
the first sub anti-shake module includes:
the tracking unit is used for tracking each human body image in each human body image through the target camera; the target cameras corresponding to the human body images are different from one another;
and the second anti-shake unit is used for carrying out anti-shake processing on the human body image according to the data of the gyroscope corresponding to the target camera to obtain a human body anti-shake image corresponding to the human body image.
10. The image anti-shake apparatus according to claim 6, wherein the second anti-shake module comprises:
the second coordinate system establishing unit is used for establishing a second anti-shake coordinate system according to the background depth of field of the background image;
and the third anti-shaking unit is used for carrying out anti-shaking processing on the background image by utilizing a second anti-shaking matrix corresponding to the background image and the second anti-shaking coordinate system to obtain the corresponding background anti-shaking image.
11. An electronic device comprising a processor, a memory and a program or instructions stored on the memory and executable on the processor, which program or instructions, when executed by the processor, carry out the steps of the image anti-shake method according to any one of claims 1 to 5.
12. A readable storage medium, characterized in that the readable storage medium stores thereon a program or instructions which, when executed by a processor, implement the steps of the image anti-shake method according to any one of claims 1 to 5.
CN202011594597.9A 2020-12-29 2020-12-29 Image anti-shake method and device and electronic equipment Active CN112738398B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011594597.9A CN112738398B (en) 2020-12-29 2020-12-29 Image anti-shake method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011594597.9A CN112738398B (en) 2020-12-29 2020-12-29 Image anti-shake method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112738398A CN112738398A (en) 2021-04-30
CN112738398B true CN112738398B (en) 2023-02-17

Family

ID=75609842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011594597.9A Active CN112738398B (en) 2020-12-29 2020-12-29 Image anti-shake method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112738398B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114079725B (en) * 2020-08-13 2023-02-07 华为技术有限公司 Video anti-shake method, terminal device, and computer-readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104093014A (en) * 2014-07-21 2014-10-08 宇龙计算机通信科技(深圳)有限公司 Image processing method and image processing device
CN107241544A (en) * 2016-03-28 2017-10-10 展讯通信(天津)有限公司 Video image stabilization method, device and camera shooting terminal
CN110769147A (en) * 2018-07-25 2020-02-07 北京小米移动软件有限公司 Shooting method and electronic equipment
CN111147741A (en) * 2019-12-27 2020-05-12 Oppo广东移动通信有限公司 Focusing processing-based anti-shake method and device, electronic equipment and storage medium
CN111263069A (en) * 2020-02-24 2020-06-09 Oppo广东移动通信有限公司 Anti-shake parameter processing method and device, electronic equipment and readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108234873A (en) * 2018-01-10 2018-06-29 北京小米移动软件有限公司 A kind of method and apparatus for obtaining image
CN111526285B (en) * 2020-04-15 2021-07-13 浙江大华技术股份有限公司 Image anti-shake method, electronic equipment and computer-readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104093014A (en) * 2014-07-21 2014-10-08 宇龙计算机通信科技(深圳)有限公司 Image processing method and image processing device
CN107241544A (en) * 2016-03-28 2017-10-10 展讯通信(天津)有限公司 Video image stabilization method, device and camera shooting terminal
CN110769147A (en) * 2018-07-25 2020-02-07 北京小米移动软件有限公司 Shooting method and electronic equipment
CN111147741A (en) * 2019-12-27 2020-05-12 Oppo广东移动通信有限公司 Focusing processing-based anti-shake method and device, electronic equipment and storage medium
CN111263069A (en) * 2020-02-24 2020-06-09 Oppo广东移动通信有限公司 Anti-shake parameter processing method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN112738398A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
CN112637500B (en) Image processing method and device
CN113596294A (en) Shooting method and device and electronic equipment
CN112422798A (en) Photographing method and device, electronic equipment and storage medium
CN113709368A (en) Image display method, device and equipment
CN112954212B (en) Video generation method, device and equipment
CN112738398B (en) Image anti-shake method and device and electronic equipment
CN112511743B (en) Video shooting method and device
CN112367486B (en) Video processing method and device
CN112367465B (en) Image output method and device and electronic equipment
CN113489909A (en) Shooting parameter determination method and device and electronic equipment
CN114125297B (en) Video shooting method, device, electronic equipment and storage medium
CN113014799B (en) Image display method and device and electronic equipment
CN112261262B (en) Image calibration method and device, electronic equipment and readable storage medium
CN114339051A (en) Shooting method, shooting device, electronic equipment and readable storage medium
CN112383708B (en) Shooting method and device, electronic equipment and readable storage medium
CN114390206A (en) Shooting method and device and electronic equipment
CN114093005A (en) Image processing method and device, electronic equipment and readable storage medium
CN114745505A (en) Shooting method, shooting device, electronic equipment and readable storage medium
CN113347356A (en) Shooting method, shooting device, electronic equipment and storage medium
CN112291474A (en) Image acquisition method and device and electronic equipment
CN112399092A (en) Shooting method and device and electronic equipment
CN112367464A (en) Image output method and device and electronic equipment
CN112561809A (en) Image processing method, device and equipment
CN112367470B (en) Image processing method and device and electronic equipment
CN112333388B (en) Image display method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant