Patent Description:
Currently, during shooting, when an electronic device moves, a camera of the electronic device also moves accordingly. As a result, an image shot by the electronic device may be blurred. Generally, the electronic device can first determine a shift of the camera according to the displacement of the electronic device, and then drive the camera to move in a reverse direction according to the shift, to avoid blurring of a shot image caused by the movement of the electronic device.

However, in the above method, after the electronic device stops moving, the electronic device needs to drive the camera to reset (that is, drive the camera to return to an initial position of the camera). As a result, the image shot by the camera also shifts, which causes ghosting in the shot image and leads to a poor shooting effect of the electronic device.

<CIT> discloses an image processing method and device, an electronic device and a computer readable storage medium. The image processing method comprises the steps of: controlling a first camera to collect a first image, and synchronously controlling a second camera to collect a second image, wherein the second image is configured to show depth information corresponding to the first image, wherein the first camera comprises an optical image stable system; when the electronic device shakes, obtaining the shaking amount when the first camera collects the first image; according to a preset calibration function and the shaking amount to perform correction of the first image to obtain a first target image; and performing processing of the first target image and the second image to improve the imaging quality.

<CIT> discloses an image correction method, comprising: acquiring at least one lens offset of an electronic device, wherein the electronic device comprises a first camera and a second camera, and the first camera or the second camera has an optical image stabilization (OIS) mode; synchronously acquiring images collected by the electronic device by means of the first camera and the second camera in the OIS mode, and calculating, according to a preset OIS calibration function and the synchronously acquired lens offset, image offset corresponding to the at least one lens offset; and performing row-by-row correction on the collected images by using the image offset.

The present invention is defined in accompanying claims, and solves the problem of a poor shooting effect of an electronic device.

In the embodiments of the present invention, when the electronic device is in the first movement state, the electronic device can capture the first image through the first camera that moves in a reverse direction of a movement direction of the electronic device, and when the electronic device changes from the first movement state to the stationary state, the electronic device processes the second image (that is, the image captured by the second camera that is stationary relative to the body in a case that the electronic device is in the stationary state), to display the processed second image on the shooting preview interface. When the electronic device changes from the first movement state to the stationary state, instead of capturing an image by the first camera that moves relative to the body, the electronic device can process the second image captured by the second camera that is stationary relative to the body, and display the processed second image on the shooting preview interface. Therefore, ghosting in the captured image can be avoided, to improve the capturing effect of the electronic device.

The following clearly and completely describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some rather than all of the embodiments of the present invention.

In the specification and claims of the embodiments of the present invention, the terms such as "first" and "second" are used to distinguish between different objects, but are not used to describe a particular sequence of the objects. For example, a first image, a second image, and the like are used to distinguish between different images, but are not used to describe a particular sequence of the images.

In the description of the embodiments of the present invention, unless otherwise specified, the meaning of "a plurality of" means two or more. For example, a plurality of elements refer to two elements or more than two elements.

The term "and/or" in this specification describes an association relationship of associated objects, indicating that three relationships may exist. For example, a display panel and/or a backlight may indicate three cases: only the display panel exists, both the display panel and the backlight exist, and only the backlight exists. A character "/" in this specification indicates an "or" relationship between associated objects. For example, input/output indicates input or output.

In the embodiments of the present invention, the term such as "exemplary" or "for example" is used to represent an example, an instance, or a description. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present invention should not be construed as being more preferred or advantageous than other embodiments or design solutions. To be precise, the use of the term such as "exemplary" or "for example" is intended to present a related concept in a specific manner.

Embodiments of the present invention provide an image processing method and an electronic device. When the electronic device changes from the first movement state to the stationary state, instead of capturing an image by the first camera that moves relative to the body, the electronic device can process the second image captured by the second camera that is stationary relative to the body, and display the processed second image on the shooting preview interface. Therefore, ghosting in the captured image can be avoided, to improve the capturing effect of the electronic device.

The image processing method and the electronic device provided by the embodiments of the present invention can be applied to a process of image processing performed by the electronic device. Specifically, the image processing method and the electronic device can be applied to a process of processing an image when the electronic device changes from a movement state to a stationary state.

The electronic device in the embodiments of the present invention may be an electronic device with an operating system. The operating system may be an Android (Android) operating system, or may be an iOS operating system or other possible operating systems, which is not specifically limited in the embodiments of the present invention.

The Android operating system is used as an example below, to describe an applicable software environment of the image processing method provided in the embodiments of the present invention.

<FIG> is a schematic architectural diagram of a possible Android operating system according to an embodiment of the present invention. In <FIG>, an architecture of the Android operating system includes four layers: an application program layer, an application program framework layer, a system runtime library layer, and a kernel layer (which may be specifically a Linux kernel layer).

The application program layer includes various application programs (including a system application program and a third-party application program) in the Android operating system.

The application program framework layer is an application program framework, and a developer may develop some application programs based on the application program framework layer while conforming to a rule of developing the application program framework.

The system runtime library layer includes a library (also referred to as a system library) and a runtime environment of the Android operating system. The library mainly provides various resources required for the Android operating system. The runtime environment of the Android operating system is used to provide the Android operating system with a software environment.

The kernel layer is an operating system layer of the Android operating system, and is the lowest layer of software levels of the Android operating system. The kernel layer provides the Android operating system with a core system service and a hardware-related driver based on the Linux kernel.

The Android operating system is used as an example. In the embodiments of the present invention, based on the system architecture of the Android operating system shown in <FIG>, developers may develop a software program that implements the image processing method provided in the embodiments of the present invention, so that the image processing method may be performed based on the Android operating system shown in <FIG>. That is, a processor or the electronic device may run the software program in the Android operating system to implement the image processing method provided in the embodiments of the present invention.

The electronic device in the embodiments of the present invention may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, an in-vehicle terminal, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook, or a personal digital assistant (personal digital assistant, PDA). The non-mobile electronic device may be a personal computer (personal computer, PC), a television (television, TV), an automated teller machine or a self-service machine. This is not specifically limited in the embodiments of the present invention.

The image processing method and the electronic device provided in the embodiments of the present invention are described in detail below through specific embodiments and application scenarios thereof with reference to the accompanying drawings.

It should be noted that the electronic device in the embodiments of the present invention may include at least two cameras. In the following embodiments, for example, the electronic device includes only two cameras (for example, a first camera and a second camera), to illustrate the image processing method provided in the embodiments of the present invention. Specific implementations of the embodiments of the present invention are only illustrative, rather than restrictive, and the present invention is not limited to the following specific implementations. Those of ordinary skill in the art may make many variations under the inspiration of the present invention without departing from the purpose of the present application and the protection scope of claims. These all fall within the protection of the present application.

In the embodiments of the present invention, when a user uses an electronic device to shoot, the electronic device can capture images through a motion camera of the electronic device. If the electronic device is in a movement state (for example, the user moves while holding the electronic device), the electronic device can perform image compensation processing on the captured images, that is, the electronic device can determine a shift of the motion camera according to a displacement of the movement of the electronic device, and then drive the motion camera to move in a reverse direction according to the shift, to compensate for the shift of the motion camera. In this way, image compensation processing is performed on the captured images, so that the images obtained after the image compensation processing are less likely to be blurred. If the electronic device changes from the movement state to a stationary state (for example, the user stops movement while holding the electronic device), the electronic device may capture images through a fixed camera (pixels in the image captured by the fixed camera and pixels in the image captured by the motion camera have a shift), and process the images captured by the fixed camera, so that content of the processed images captured by the fixed camera is the same as that of the image captured by the motion camera (that is, the pixels in the processed image captured by the fixed camera and the pixels in the image captured by the motion camera do not have a shift).

The embodiments of the present invention provide an image processing method. <FIG> is a flowchart of an image processing method according to an embodiment of the present invention. The method may be applied to an electronic device with the Android operating system shown in <FIG>. As shown in <FIG>, the image processing method provided in the embodiments of the present invention may include the following step <NUM> to step <NUM>.

Step <NUM>: In a case that the electronic device is in a first movement state, the electronic device captures a first image through a first camera.

In the embodiments of the present invention, the electronic device includes a body, a first camera, and a second camera, and the first camera moves relative to the body.

In the embodiments of the present invention, when the electronic device displays a shooting preview interface (for example, an interface of an application program with a shooting function (for example, a camera application program)), the electronic device can turn on the first camera, and when the electronic device is in the first movement state (for example, a user moves while holding the electronic device), capture the first image through the first camera.

Optionally, in the embodiments of the present invention, the first movement state may be a state in which the electronic device moves at a first speed in a first direction.

Optionally, in the embodiments of the present invention, the electronic device may detect whether the electronic device is in the first movement state through a motion sensor of the electronic device.

Optionally, in the embodiments of the present invention, the motion sensor may specifically be a gyroscope; and the first camera may specifically be a motion camera.

It should be noted that the "motion camera" can be understood as a camera with an optical image stabilization function. It can be understood that when the electronic device moves, the electronic device can determine a shift of the camera according to a displacement of the movement of the electronic device, so that the electronic device can drive the camera to move by the shift in a reverse direction of a movement direction of the electronic device, to avoid blurring of a captured image caused by the shift of the camera.

Optionally, in the embodiments of the present invention, when the electronic device is in the first movement state, the first camera moves in the reverse direction of the movement direction of the electronic device, that is, the first camera moves relative to the body.

Optionally, in the embodiments of the present invention, with reference to <FIG>, as shown in <FIG>, before step <NUM>, the image processing method provided by the embodiments of the present invention may further include the following step <NUM> and step <NUM>. In addition, step <NUM> can be specifically implemented through the following step 201a.

Step <NUM>: The electronic device determines a target shift of the first camera according to a target displacement of the electronic device.

Optionally, in the embodiments of the present invention, the electronic device may obtain the target displacement of the electronic device through a motion sensor, and determine the target shift of the first camera according to the target displacement.

Optionally, in the embodiments of the present invention, the electronic device may determine the target displacement of the electronic device as the target shift of the first camera.

Step <NUM>: The electronic device controls the first camera to move according to the target shift.

Optionally, in the embodiments of the present invention, the electronic device may control the first camera to move by the target shift in a reverse direction of the movement direction of the electronic device.

It can be understood that the electronic device can control the first camera to move according to the target shift, to compensate for the target shift by which the first camera shifts because the electronic device moves, to avoid blurring of the captured images.

Step 201a: When the electronic device is in the first movement state, the electronic device captures the first image through the first camera that has moved.

In the embodiments of the present invention, the electronic device may capture the first image through the first camera that has moved, that is, the first image is an image obtained after image compensation processing.

In the embodiments of the present invention, the electronic device can control the first camera to move by the target shift according to the target displacement of the electronic device, to compensate for the target shift by which the first camera shifts because the electronic device moves. Therefore, this can avoid blurring of the captured images to improve the shooting effect of the electronic device.

Step <NUM>: The electronic device displays the first image on a shooting preview interface.

Optionally, in the embodiments of the present invention, when the electronic device is in the first movement state, the electronic device can capture the first image through the first camera, to display, on the shooting preview interface, the first image obtained after image compensation processing.

It can be understood that when the electronic device is in the first movement state, the electronic device can display, on the shooting preview interface, the first image obtained after image compensation processing, so that the user can perform shooting input on the shooting preview interface, to obtain a shot image that is less likely to be blurred.

Step <NUM>: In a case that the electronic device changes from the first movement state to a stationary state, the electronic device processes a second image and updates the first image on the shooting preview interface to the processed second image.

In the embodiments of the present invention, the second image is an image captured by the second camera in a case that the electronic device is in the stationary state, and the second camera is stationary relative to the body.

It should be noted that the "stationary state" can be understood as a state in which the moving speed of the electronic device is less than or equal to a preset threshold.

Optionally, in the embodiments of the present invention, the electronic device may detect whether the electronic device changes from the first movement state to the stationary state according to a motion sensor.

Optionally, in the embodiments of the present invention, the second camera may specifically be a fixed camera.

It should be noted that the "fixed camera" can be understood as a camera fixedly connected to the body.

Optionally, in the embodiments of the present invention, when the electronic device changes from the first movement state to the stationary state, the second camera may change from the first movement state to the stationary state along with the electronic device, that is, the second camera is stationary relative to the body.

Optionally, in the embodiments of the present invention, when the electronic device is in the first movement state, the electronic device can turn on the second camera while capturing the first image through the first camera, so that the second camera can be used to capture an image in real time. In this way, when the electronic device changes from the first movement state to the stationary state (that is, a moment at which the electronic device changes from the first movement state to the stationary state), the second image is captured by the second camera.

Optionally, in the embodiments of the present invention, when the electronic device changes from the first movement state to the stationary state, the electronic device may turn on the second camera to capture the second image through the second camera.

In the embodiments of the present invention, the pixels in the second image and the pixels in the first image have a shift. When the electronic device is in the first movement state, the electronic device can use the first camera to perform image compensation processing on the captured first image, so that the first image obtained after the image compensation processing is less likely to be blurred. When the electronic device changes from the first movement state to the stationary state, the second camera also changes from the first movement state to the stationary state, that is, the second image is not blurred. In this way, the electronic device can process the second image, so that the pixels in the second image and the pixels in the first image have no shift, that is, the shooting angle of the second image is the same as that of the first image.

Optionally, in the embodiments of the present invention, the angle of view of the second camera is greater than that of the first camera.

In the embodiments of the present invention, the second camera and the first camera are disposed at different positions on the body, so that shooting angles of the second image captured by the second camera and the first image captured by the first camera are different. The electronic device can process (perform pseudo image processing on) the second image, so that the shooting angle of the processed second image is the same as that of the first image (that is, the content of the processed second image is the same as that of the first image).

It should be noted that the "pseudo image processing" can be understood as: the second image is processed, so that the shooting angle of the processed second image is the same as that of the first image, that is, the processed second image can "pretend" to be the first image.

It can be understood that when the electronic device changes from the first movement state to the stationary state, the second camera is also in the stationary state. Therefore, the second image captured by the electronic device through the second camera has no ghosting, to avoid ghosting in the captured image.

It should be noted that processing of the second image by the electronic device is specifically described in the following embodiments, and is not described in detail herein.

The embodiments of the present invention provide an image processing method. The electronic device can capture the first image through the first camera that moves relative to the body, and when the electronic device changes from the first movement state to the stationary state, the electronic device may process the second image (that is, the image captured by the second camera that is stationary relative to the body in a case that the electronic device is in the stationary state), to display the processed second image on the shooting preview interface. When the electronic device changes from the first movement state to the stationary state, instead of capturing an image by the first camera that moves relative to the body, the electronic device can process the second image captured by the second camera that is stationary relative to the body, and display the processed second image on the shooting preview interface. Therefore, ghosting in the captured image can be avoided, to improve the capturing effect of the electronic device.

It can be understood that after the electronic device processes the second image, the shooting angle (the image angle) of the processed second image is the same as that of the first image. Therefore, the shooting angle of shooting observation of the user is not affected while the shooting effect of the electronic device can be improved.

Optionally, in the embodiments of the present invention, with reference to <FIG>, as shown in <FIG>, before step <NUM> "the electronic device processes the second image", the image processing method provided in the embodiments of the present invention may also include the following step <NUM> and step <NUM>. In addition, step <NUM> can be specifically implemented through the following step 203a.

Step <NUM>: Obtain a target parameter in a case that the electronic device changes from the first movement state to the stationary state.

In the embodiments of the present invention, the target parameter is used to indicate a position and posture relationship of the second camera relative to the first camera.

It should be noted that the "position and posture relationship" can be understood as a position relationship, such as a distance relationship and an angle relationship.

Optionally, in the embodiments of the present invention, when the electronic device changes from the first movement state to the stationary state, the electronic device may detect the first camera and the second camera respectively to obtain a parameter of the first camera and a parameter of the second camera. Therefore, the electronic device can obtain the target parameter according to the parameter of the first camera and the parameter of the second camera.

Optionally, in the embodiments of the present invention, step <NUM> may be specifically implemented through the following step 401a and step 401b.

Step 401a: The electronic device obtains a first parameter and a second parameter.

In the embodiments of the present invention, the first parameter is an internal parameter and an external parameter of the first camera, and the second parameter is an internal parameter and an external parameter of the second camera.

It should be noted that an "internal parameter of a camera" can be understood as: a parameter related to the characteristic of the camera, such as a focal length parameter of the camera or a pixel parameter of the camera. An "external parameter of a camera" can be understood as: a parameter of the camera in a geographic coordinate system, such as a position parameter (for example, coordinate information) of the camera in the geographic coordinate system or an angle parameter of the camera in the geographic coordinate system.

Optionally, in the embodiments of the present invention, the electronic device may use a camera calibration algorithm to detect the first camera and the second camera respectively, to obtain the first parameter and the second parameter.

It should be noted that, for specific description of the camera calibration algorithm, refer to the description in the related art. This is not described in detail in the embodiments of the present invention.

Step 401b: The electronic device determines the target parameter according to the first parameter and the second parameter.

Optionally, in the embodiments of the present invention, the electronic device may calculate a difference between the internal parameter of the first camera and the internal parameter of the second camera (hereinafter referred to as a first difference), and a difference between the external parameter of the first camera and the external parameter of the second camera (hereinafter referred to as a second difference), and determine the target parameter (that is, relative position and posture information) according to the first difference and the second difference.

It should be noted that the "relative position and posture information" can be understood as: position information of the second camera relative to the first camera (for example, distance information of the second camera relative to the first camera and angle information of the second camera relative to the first camera).

Step <NUM>: The electronic device determines a perspective transformation matrix according to the first image and the second image.

In the embodiments of the present invention, the perspective transformation matrix is used to indicate the shift relationship of the second image relative to the first image.

It should be noted that the "shift relationship" can be understood as: a position shift of the pixels in the second image relative to the pixels in the first image.

Optionally, in the embodiments of the present invention, the electronic device may first perform image detection on the first image to obtain position information of a plurality of first feature points in the first image, and perform image detection on the second image to obtain position information of a plurality of second feature points. Therefore, the electronic device can determine the perspective transformation matrix (a shift relationship (an image relationship) between the first image and the second image) according to the position information of the plurality of first feature points and the position information of the plurality of second feature points. A first feature point corresponds to a second feature point (that is, an ith pixel in the first image corresponds to an ith pixel in the second image, and i is a positive integer).

It should be noted that the plurality of first feature points can be understood as some pixels in the first image, and these pixels can reflect contour features of image content in the first image; the plurality of second feature points can be understood as some pixels in the second image, and these pixels can reflect contour features of image content in the first image.

Optionally, in the embodiments of the present invention, for each first feature point of the plurality of first feature points, the electronic device may determine a third difference according to position information of a first feature point and position information of a second feature point, to determine a plurality of third differences. The electronic device may determine the perspective transformation matrix according to the plurality of third differences.

It can be understood that the perspective transformation matrix is used to indicate position shifts of the plurality of second feature points in the second image relative to the plurality of first feature points in the first image.

Step 203a: When the electronic device changes from the first movement state to the stationary state, the electronic device processes the second image according to the target parameter and the perspective transformation matrix and updates the first image on the shooting preview interface to the processed second image.

Optionally, in the embodiments of the present invention, the electronic device may perform translation processing on all pixels in the second image according to the target parameter and the perspective transformation matrix through a perspective transformation algorithm.

It should be noted that, for specific description of the perspective transformation algorithm, refer to the description in the related art. This is not described in detail in the embodiments of the present invention.

It can be understood that the image content (for example, the shooting angle) of the processed second image is the same as (for example, completely consistent with) that (for example, the shooting angle) of the first image.

In the embodiments of the present invention, the electronic device may determine a position shift of the position of the second camera relative to the position of the first camera according to the target parameter, and determine a pixel shift of the pixel in the second image captured by the second camera relative to the pixel in the first image captured by the first camera according to the perspective transformation matrix. Therefore, the electronic device can perform translation processing on the pixels in the second image according to the position shift and the pixel shift, to obtain an image with the same shooting angle as that of the first image (that is, an image whose pixels have no shift from pixels of the first image).

In the embodiments of the present invention, the electronic device can quickly perform translation processing on all the pixels in the second image according to the target parameter, the first image, and the second image, to obtain the second image with the same shooting angle as that of the first image.

Optionally, in the embodiments of the present invention, with reference to <FIG>, as shown in <FIG>, after step <NUM>, the image processing method provided by the embodiments of the present invention may further include the following step <NUM>.

Step <NUM>: In a case that the electronic device changes from the stationary state to a second movement state, the electronic device updates the second image on the shooting preview interface to a third image.

In the embodiments of the present invention, the third image is an image captured by the first camera in the second movement state.

Optionally, in the embodiments of the present invention, the second movement state may be a state in which the electronic device moves at a second speed in a second direction.

Optionally, in the embodiments of the present invention, the second direction may be the same as or different from the first direction, and the second speed may be the same as or different from the first speed.

Optionally, in the embodiments of the present invention, the electronic device may detect whether the electronic device changes from the stationary state to the second movement state through a motion sensor.

It can be understood that when the electronic device changes from the stationary state to the second movement state, the electronic device can determine a shift of the first camera according to a displacement of the movement of the electronic device, so that the electronic device can drive the first camera to move by the shift in a reverse direction of a movement direction of the electronic device, to avoid blurring of the third image to improve the shooting effect of the electronic device.

In the embodiments of the present invention, when the electronic device changes from the stationary state to the second movement state, the electronic device can update the second image on the shooting preview interface to the third image (that is, the image captured by the first camera), to improve the shooting effect of the electronic device.

<FIG> is a possible schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device includes: a body, a first camera, and a second camera. As shown in <FIG>, the electronic device <NUM> may include: a capturing module <NUM>, a display module <NUM>, a processing module <NUM>, and an update module <NUM>.

The capturing module <NUM> is configured to: in a case that the electronic device is in a first movement state, capture a first image through the first camera, where the first camera moves relative to the body. The display module <NUM> is configured to display, on a shooting preview interface, the first image captured by the capturing module <NUM>. The processing module <NUM> is configured to: in a case that the electronic device changes from the first movement state to a stationary state, process a second image captured by the capturing module <NUM>, where the second image is an image captured by the second camera in a case that the electronic device is in the stationary state, and the second camera is stationary relative to the body. The update module <NUM> is configured to update the first image on the shooting preview interface captured by the capturing module <NUM> to the second image processed by the processing module <NUM>.

In a possible implementation, with reference to <FIG>, as shown in <FIG>, the electronic device <NUM> provided in the embodiments of the present invention may further include: an obtaining module <NUM> and a determining module <NUM>. The obtaining module <NUM> is configured to: before the processing module <NUM> processes the second image, obtain a target parameter, where the target parameter is used to indicate a position and posture relationship of the second camera relative to the first camera. The determining module <NUM> is configured to determine a perspective transformation matrix according to the first image and the second image, where the perspective transformation matrix is used to indicate a shift relationship of the second image relative to the first image. The processing module <NUM> is specifically configured to process the second image according to the target parameter and the perspective transformation matrix.

In a possible implementation, the obtaining module <NUM> is specifically configured to: obtain a first parameter and a second parameter, where the first parameter is an internal parameter and an external parameter of the first camera, and the second parameter is an internal parameter and an external parameter of the second camera; and determine the target parameter based on the first parameter and the second parameter.

In a possible implementation, with reference to <FIG>, as shown in <FIG>, the electronic device <NUM> provided in the embodiments of the present invention may further include: a determining module <NUM> and a control module <NUM>. The determining module <NUM> is configured to: before the capturing module <NUM> captures the first image through the first camera, determine a target shift of the first camera according to a target displacement of the electronic device. The control module <NUM> is configured to control the first camera to move according to the target shift determined by the determining module <NUM>. The capturing module <NUM> is specifically configured to capture the first image through the first camera that has moved.

In a possible implementation, the update module <NUM> is further configured to: after updating the first image on the shooting preview interface to the processed second image, in a case that the electronic device changes from the stationary state to a second movement state, update the second image on the shooting preview interface to a third image, where the third image is an image captured by the first camera in the second movement state.

The electronic device provided in the embodiments of the present invention can implement the processes that are implemented by the electronic device in the foregoing method embodiments. To avoid repetition, details are not described herein again.

Embodiments of the present invention provide an electronic device. When the electronic device changes from the first movement state to the stationary state, instead of capturing an image by the first camera that moves relative to the body, the electronic device can process the second image captured by the second camera that is stationary relative to the body, and display the processed second image on the shooting preview interface. Therefore, ghosting in the captured image can be avoided, to improve the capturing effect of the electronic device.

<FIG> is a schematic diagram of hardware of an electronic device implementing embodiments of the present invention. As shown in <FIG>, the electronic device <NUM> includes but is not limited to: a radio frequency unit <NUM>, a network module <NUM>, an audio output unit <NUM>, an input unit <NUM>, a sensor <NUM>, a display unit <NUM>, a user input unit <NUM>, an interface unit <NUM>, a memory <NUM>, a processor <NUM>, a power supply <NUM>, and other components.

It should be understood that a person skilled in the art may understand that the structure of the electronic device shown in <FIG> constitutes no limitation on the electronic device. The electronic device may include more or fewer components than those shown in <FIG>, or a combination of some components, or an arrangement of different components. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a notebook computer, a palmtop computer, an in-vehicle terminal, a wearable device, a pedometer, and the like.

The processor <NUM> is configured to: in a case that the electronic device is in a first movement state, capture a first image through the first camera, where the first camera moves relative to the body; control the display unit <NUM> to display the first image on a shooting preview interface; and in a case that the electronic device changes from the first movement state to a stationary state, process a second image and update the first image on the shooting preview interface to the processed second image, where the second image is an image captured by the second camera in a case that the electronic device is in the stationary state, and the second camera is stationary relative to the body.

It should be understood that in the embodiments of the present invention, the radio frequency unit <NUM> may be configured to receive and transmit information, or receive and transmit signals during a call. Specifically, the radio frequency unit receives downlink data from a base station, and transmits the downlink data to the processor <NUM> for processing; and transmits uplink data to the base station. Generally, the radio frequency unit <NUM> includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, and a duplexer. In addition, the radio frequency unit <NUM> may also communicate with a network and other devices through a wireless communication system.

The electronic device provides users with wireless broadband Internet access through the network module <NUM>, for example, helps users receive and send e-mails, browse web pages, and access streaming media.

The audio output unit <NUM> may convert audio data received by the radio frequency unit <NUM> or the network module <NUM> or stored in the memory <NUM> into an audio signal, and output the audio signal as sound. Moreover, the audio output unit <NUM> can further provide audio output related to a specific function performed the electronic device <NUM> (for example, call signal receiving sound and message receiving sound). The audio output unit <NUM> includes a speaker, a buzzer, a telephone receiver, and the like.

The input unit <NUM> is configured to receive audio or video signals. The input unit <NUM> may include a graphics processing unit (Graphics Processing Unit, GPU) <NUM> and a microphone <NUM>. The graphics processing unit <NUM> processes image data of a static image or a video obtained by an image capturing apparatus (for example, a camera) in a video capturing mode or an image capturing mode. A processed image frame may be displayed on the display unit <NUM>. The image frame processed by the graphics processing unit <NUM> may be stored in the memory <NUM> (or another storage medium) or sent by using the radio frequency unit <NUM> or the network module <NUM>. The microphone <NUM> may receive a sound and can process such a sound into audio data. The processed audio data may be converted, in a phone calling mode, into a format that may be transmitted to a mobile communication base station by using the radio frequency unit <NUM> for output.

The electronic device <NUM> further includes at least one sensor <NUM>, for example, a light sensor, a motion sensor, and another sensor. Specifically, the light sensor includes an ambient light sensor and a proximity sensor. The ambient light sensor may adjust brightness of a display panel <NUM> according to ambient light brightness. The proximity sensor may switch off the display panel <NUM> and/or backlight when the electronic device <NUM> moves close to an ear. As a motion sensor, an accelerometer sensor may detect magnitude of acceleration in various directions (usually three axes), may detect magnitude and the direction of gravity when stationary, may be configured to identify electronic device postures (such as switching between a landscape mode and a portrait mode, related games, and magnetometer posture calibration), may perform functions related to vibration identification (such as a pedometer and a knock), and the like. The sensor <NUM> may further include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, or the like.

The display unit <NUM> is configured to display information entered by the user or information provided for the user. The display unit <NUM> may include the display panel <NUM>, and the display panel <NUM> may be configured in a form of a liquid crystal display (Liquid Crystal Display, LCD), an organic light-emitting diode (Organic Light-Emitting Diode, OLED), or the like.

The user input unit <NUM> may be configured to receive entered number or character information, and generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit <NUM> includes a touch panel <NUM> and another input device <NUM>. The touch panel <NUM>, also called a touch screen, may collect touch operation on or near the touch panel by users (for example, operation on the touch panel <NUM> or near the touch panel <NUM> by fingers or any suitable objects or accessories such as a touch pen by the users). The touch panel <NUM> may include two parts: a touch detection apparatus and a touch controller. The touch detection apparatus detects a touch position of a user, detects a signal brought by a touch operation, and transmits the signal to the touch controller. The touch controller receives touch information from the touch detection apparatus, converts the touch information into contact coordinates, sends the contact coordinates to the processor <NUM>, and receives and executes a command from the processor <NUM>. In addition, the touch panel <NUM> may be implemented as a resistive type, a capacitive type, an infrared type, a surface acoustic wave type, or the like. In addition to the touch panel <NUM>, the user input unit <NUM> may further include another input device <NUM>. Specifically, another input device <NUM> may include but is not limited to: a physical keyboard, a function key (such as a volume control key, a switch key), a trackball, a mouse, and a joystick, which is no longer repeated here.

Further, the touch panel <NUM> may cover the display panel <NUM>. When detecting a touch operation on or near the touch panel <NUM>, the touch panel <NUM> transmits the touch operation to the processor <NUM> to determine a type of a touch event. Then, the processor <NUM> provides corresponding visual output on the display panel <NUM> based on the type of the touch event. Although in <FIG>, the touch panel <NUM> and the display panel <NUM> are configured as two independent components to implement input and output functions of the electronic device, in some embodiments, the touch panel <NUM> and the display panel <NUM> can be integrated to implement the input and output functions of the electronic device. Details are not limited herein.

The interface unit <NUM> is an interface for connecting an external apparatus and the electronic device <NUM>. For example, the external apparatus may include a wired or wireless headset jack, an external power supply (or a battery charger) port, a wired or wireless data port, a storage card port, a port for connecting an apparatus having an identification module, an audio input/output (I/O) port, a video I/O port, a headset jack, or the like. The interface unit <NUM> can be configured to receive input from an external apparatus (for example, data information and power) and transmit the received input to one or more elements in the electronic device <NUM>, or can be configured to transmit data between the electronic device <NUM> and the external apparatus.

The memory <NUM> may be configured to store a software program and various data. The memory <NUM> may mainly include a program storage area and a data storage area. The program storage area may store an operating system, an application program required by at least one function (such as a sound playback function and an image display function), and the like. The data storage area may store data (such as audio data and a phone book) created based on use of the mobile phone, and the like. In addition, the memory <NUM> may include a high-speed random access memory or a nonvolatile memory, for example, at least one disk storage device, a flash memory, or other volatile solid-state storage devices.

The processor <NUM> is a control center of the electronic device and connects all parts of the electronic device using various interfaces and circuits. By running or executing software programs and/or modules stored in the memory <NUM> and by calling data stored in the memory <NUM>, the processor <NUM> implements various functions of the electronic device and processes data, thus performing overall monitoring on the electronic device. The processor <NUM> may include one or more processing units. Optionally, an application processor and a modem processor may be integrated into the processor <NUM>. The application processor mainly processes an operating system, a user interface, an application, and the like. The modem processor mainly processes wireless communication. It may be understood that the above-mentioned modem processor may not be integrated in the processor <NUM>.

The electronic device <NUM> may further include the power supply <NUM> (such as a battery) supplying power to each component. Preferably, the power supply <NUM> may be logically connected to the processor <NUM> by using a power management system, so as to implement functions such as charging management, discharging management and power consumption management by using the power management system.

In addition, the electronic device <NUM> includes some functional modules not shown.

Optionally, the embodiments of the present disclosure further provide an electronic device, including a processor <NUM> shown in <FIG>, a memory <NUM>, and a computer program stored in the memory <NUM> and executable on the processor <NUM>. When the computer program is executed by the processor <NUM>, the processes of the foregoing method embodiment are implemented, and a same technical effect can be achieved. To avoid repetition, details are not described herein again.

Embodiments of the present invention further provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. The computer program implements, when executed by a processor, each process of the foregoing method embodiments, and a same technical effect can be achieved. To avoid repetition, details are not described herein again. The computer-readable storage medium is a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, an optical disc, or the like.

It should be noted that in this specification, the terms "comprise", "include" and any other variants thereof are intended to cover non-exclusive inclusion, so that a process, a method, an article, or a device that includes a series of elements not only includes these very elements, but may also include other elements not expressly listed, or also include elements inherent to this process, method, article, or device. Without more restrictions, an element defined by the statement "including a. " does not exclude another same element in this process, method, article, or apparatus that includes the element.

Based on the foregoing descriptions of the embodiments, a person skilled in the art may clearly understand that the method in the foregoing embodiment may be implemented by software in addition to a necessary universal hardware platform or by hardware only. In most circumstances, the former is a preferred implementation manner. Based on such an understanding, the technical solutions of the present invention essentially or the part contributing to the prior art may be implemented in a form of a software product. The computer software product is stored in a storage medium (such as a ROM/RAM, a magnetic disk, or an optical disc), and includes several instructions for instructing an electronic device (which may be a mobile phone, a computer, a server, an air conditioner, a network device, or the like) to perform the methods described in the embodiments of the present invention.

Claim 1:
An image processing method, performed by an electronic device, wherein the electronic device comprises a body, a first camera, and a second camera, and the method comprises:
in a case that the electronic device is in a first movement state, capturing (<NUM>) a first image through the first camera after the first camera has moved by a target shift in a reverse direction of a movement direction of the electronic device, the target shift being determined according to the displacement of the electronic device;
displaying (<NUM>) the first image on a shooting preview interface; and
the method being characterized in that;
in a case that the electronic device changes from the first movement state to a stationary state, processing (<NUM>) a second image and updating the first image on the shooting preview interface to the processed second image, wherein the second image is an image captured by the second camera in a case that the electronic device is in the stationary state, and the second camera is stationary relative to the body and wherein the second image is processed so that the shooting angle of the second image is the same as that of the first image.