Snapshot method based on physical sensor, device and storage medium
The jitter status is determined by the gyroscope data and exposure time of the terminal device, which solves the problem of unclear images during capture and achieves higher image clarity and user experience.
Patent Information
- Application Number
- PCT/CN2023/132370
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-24
- Filing Date
- 2023-11-17
- Publication Date
- 2024-08-29
AI Technical Summary
The image captured by the terminal device during capture may not be clear, resulting in failure to meet user needs.
By collecting the gyroscope data and exposure time of the terminal device, the status flag is updated to determine the jitter status during image collection. If it is still, it will be captured, and if it is moving, it will be delayed to ensure image clarity.
It effectively improves the clarity of images when capturing, reduces the acquisition of unclear images, and improves user experience.
Smart Images

Figure CN2023132370_29082024_PF_FP_ABST
Abstract
Description
Capture method, device and storage medium based on physical sensor
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on February 24, 2023, with application number 202310208358.2 and application name “Capture method, device and storage medium based on physical sensor”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of terminal technology, and in particular to a capture method, device, and storage medium based on a physical sensor. Background Art
[0003] With the advancement of technology and lifestyle, mobile devices have become essential electronic tools in people's lives. Mobile devices can take photos and implement snapshot functions, such as automatic snapshot and manual snapshot. Automatic snapshot means that after the mobile device triggers the camera app to enter preview mode, the mobile device can automatically capture multiple images. Manual snapshot means that after the mobile device triggers the camera app to enter preview mode, the user presses the capture button, and the mobile device then captures multiple images based on the user's trigger.
[0004] However, when the terminal device is taking snapshots, the image obtained by the terminal device may not be clear, resulting in the image not meeting the user's needs. Therefore, there is an urgent need for a method for making the image obtained clear when the terminal device is taking snapshots.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a physical sensor-based capture method, device, and storage medium, which are applied to the field of terminal technology and solve the problem of unclear images obtained when a terminal device captures images.
[0007] In a first aspect, embodiments of the present application provide a method for capturing images based on a physical sensor. The method includes:
[0008] When the terminal device captures an image, the status identification bit at the first moment is the first identification bit; wherein, the first moment is the moment of capturing the previous frame image of the current frame image; the status identification bit represents the degree of jitter of the terminal device when capturing the image, and the first identification bit is a motion state identification bit or a static state identification bit; the terminal device obtains first gyroscope data and a first exposure time; wherein, the first gyroscope data is the data captured by the gyroscope of the terminal device when capturing the current frame image, and the first exposure time is the exposure time when capturing the current frame image; the first gyroscope data and the first exposure time are used to update the status identification bit; when the status identification bit at the second moment is the second identification bit, and the second identification bit is the static state identification bit, the terminal device performs a snapshot process on the current frame image; wherein, the second moment is the moment of capturing the current frame image.
[0009] In this way, since the shaking of the terminal device is an important factor leading to the generation of blurred images, the state flag is updated based on the gyroscope data and exposure time of the terminal device when the terminal device collects the current frame image, and it is determined whether the state flag when collecting the current frame image is a static state flag or a motion state flag. The state flag is used as a new clarity parameter; before generating an image, if the state flag when collecting the current frame image is a static state flag, it is determined that the image is clear to a certain extent, and then the current frame image is captured; before generating an image, if the state flag when collecting the current frame image is a motion state flag, it is determined in advance that the current frame image collected is unclear, and the next frame image is directly analyzed.
[0010] In one possible implementation, the method further includes: when the first gyroscope data is greater than or equal to the dynamic threshold of the current frame image, the terminal device determines a motion counter plus a preset value; wherein the motion counter represents the consecutive number of images whose gyroscope data is greater than or equal to the dynamic threshold of the image; the dynamic threshold is a threshold for distinguishing gyroscope data; the first exposure time is used to determine the dynamic threshold of the previous frame image; wherein, the state identification bit at the first moment and the motion counter are used to determine the state identification bit at the second moment.
[0011] Thus, if it is determined that the first gyroscope data is greater than or equal to the dynamic threshold of the current frame image, the motion counter is updated, thereby determining that the terminal device is in a shaking state and the captured image may be unclear, but the clarity of the current frame image needs to be further determined.
[0012] In a possible implementation, the method further includes:
[0013] When the first identifier is a stationary state identifier and the motion counter is greater than or equal to a first preset counting threshold, the terminal device determines that the second identifier is a motion state identifier and clears the motion counter;
[0014] When the first identifier is a stationary state identifier and the movement counter is less than the first preset counting threshold, the terminal device determines that the second identifier is a stationary state identifier.
[0015] In this way, if the first flag is a static state flag, it is determined that the jitter of the terminal device when capturing the last frame of image is small, and the value of the motion counter needs to be judged.
[0016] In one possible implementation, the first exposure time corresponds to a first time range, which corresponds to a first threshold range. The first time range is a value range of the exposure time, and the first threshold range is a value range of a gyroscope threshold for determining gyroscope data. The exposure time in the first time range is positively correlated with the gyroscope threshold in the first threshold range.
[0017] The method further includes: the terminal device performing a mapping calculation on the first exposure time, the first time range segment, and the first threshold range segment to obtain a dynamic threshold of the current frame image.
[0018] In this way, the terminal device determines the dynamic threshold value of the current frame image in real time according to the first exposure time of the current frame image; wherein the dynamic threshold value is a threshold value used to determine the gyroscope data.
[0019] In a possible implementation, the method further includes:
[0020] When the first gyroscope data is less than the dynamic threshold of the current frame image, the terminal device determines that the still counter is added with a preset value; wherein, the still counter represents the continuous number of images in which the gyroscope data is less than the dynamic threshold of the image; wherein, the state identification bit at the first moment and the still counter are used to determine the state identification bit at the second moment.
[0021] In this way, if it is determined that the first gyroscope data is less than the dynamic threshold of the current frame image, the static counter is updated, thereby determining that the terminal device is in a state of less jitter and the captured image is clear to a certain extent, and then further determining the clarity of the current frame image.
[0022] In a possible implementation, the method further includes:
[0023] When the first identifier is a motion state identifier and the static counter is greater than or equal to a second preset counting threshold, the terminal device determines that the second identifier is a static state identifier and clears the static counter;
[0024] When the first identifier is a motion state identifier and the stationary counter is less than the second preset counting threshold, the terminal device determines that the second identifier is a motion state identifier.
[0025] In this way, if the first identifier is a motion state identifier, it is determined that the terminal device has a large jitter when capturing the last frame of image, and the value of the still counter needs to be determined.
[0026] In one possible implementation, the first exposure time corresponds to a second time range, the first time range corresponds to a second threshold range, the second time range is a value range of the exposure time, and the second threshold range is a value range for determining a count threshold of a stillness counter; the exposure time in the second time range and the gyroscope threshold in the second threshold range are positively correlated;
[0027] The method further comprises:
[0028] The terminal device performs a mapping calculation on the first exposure time, the second time range segment, and the second threshold range segment to obtain the second preset counting threshold.
[0029] Thus, the lower the ambient light brightness (i.e., a dark environment), the longer the exposure time when capturing an image, and the larger the count threshold corresponding to the stillness counter needs to be. This makes it difficult for the process of steps S416-S417 to reach a stable state (i.e., stillness), thus preventing the terminal device from capturing unclear images. Therefore, it is necessary to determine the second preset count threshold for the current frame image in real time based on the first exposure time of the current frame image.
[0030] In a possible implementation, the method further includes:
[0031] When the state flag at the second moment is the second flag, and the second flag is a motion state flag, the terminal device captures the next frame of image.
[0032] In this way, if it is determined that the state flag when the current frame image is collected is a motion state flag, there is no need to capture the current frame image, and the next frame image can be directly processed.
[0033] In a possible implementation, when the state flag at the second moment is the second flag, and the second flag is the static state flag, before the terminal device performs snapshot processing on the current frame image, the method further includes:
[0034] When the first gyroscope data is greater than or equal to a preset limit value, the terminal device determines that the state identification bit at the second moment is a second identification, and the second identification is the same as the first identification;
[0035] When the first gyroscope data is less than the preset limit value, the terminal device determines that when the state identification bit at the second moment is the second identification and the second identification is the static state identification, the terminal device performs a snapshot process on the current frame image.
[0036] In this way, if the terminal device determines that the acceleration value represented by the first gyroscope data of the current frame image is greater than or equal to the preset limit value, it can be determined that the gyroscope is abnormal when the terminal device collects the current frame image, or the data collected by the gyroscope is abnormal.
[0037] In a possible implementation, the terminal device performs a snapshot process on the current frame image, including:
[0038] The terminal device determines the image parameters of the current frame image;
[0039] When the image parameter is greater than or equal to a preset parameter threshold, the terminal device performs a snapshot process on the current frame image.
[0040] In this way, when it is determined that the state flag when the current frame image is captured is the motion state flag, other definition parameters are determined to complete the capture process of the current frame image.
[0041] In one possible implementation, the image parameters include one or more of the following: parameters obtained by an image processing method based on a spatial domain, parameters obtained by an image processing method based on a frequency domain, and parameters obtained by an image processing method based on a deep learning model.
[0042] In a second aspect, embodiments of the present application provide a terminal device, which may also be referred to as a terminal, user equipment (UE), mobile station (MS), or mobile terminal (MT). The terminal device may be a mobile phone, a smart TV, a wearable device, a tablet computer, a computer with wireless transceiver capabilities, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, or a wireless terminal in a smart home. The terminal device may also be a drone.
[0043] The terminal device includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method of the first aspect.
[0044] In a third aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method of the first aspect.
[0045] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is run, it enables the computer to execute the method of the first aspect.
[0046] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute the method described in the first aspect.
[0047] It should be understood that the second to fifth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] FIG1 shows a schematic structural diagram of a terminal device 100;
[0049] FIG2 is a software structure block diagram of the terminal device 100 according to an embodiment of the present application;
[0050] FIG3 is a flow chart of a method for capturing a photo based on a physical sensor according to an embodiment of the present application;
[0051] FIG4 is a second flow chart of a physical sensor-based snapshot method provided in an embodiment of the present application;
[0052] FIG5 is a block diagram of a software layer of a terminal device provided in an embodiment of the present application;
[0053] FIG6 is a schematic diagram showing the structure of a chip provided in an embodiment of the present application;
[0054] FIG7 is a schematic structural diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] To facilitate a clear description of the technical solutions of the embodiments of this application, the words "exemplary" or "for example" are used in the embodiments of this application to indicate examples, illustrations, or explanations. Any embodiment or design described in this application as "exemplary" or "for example" should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0056] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0057] It should be noted that the "at..." in the embodiments of the present application can be the instant when a certain situation occurs, or it can be a period of time after the situation occurs, and the embodiments of the present application do not specifically limit this. In addition, the display interface provided in the embodiments of the present application is only an example, and the display interface can also include more or less content.
[0058] With the advancement of technology and lifestyle, terminal devices have become essential electronic tools in people's lives. Terminal devices can take photos. These devices offer an artificial intelligence (AI) snapshot function. Based on AI recognition algorithms, the terminal device outputs recognition results in a preview stream (preview image stream), such as identifying a person's smile or natural beauty. Based on these recognition results, the terminal device automatically selects the most compelling frame for the user and captures it.
[0059] Among them, the AI capture function includes automatic capture and manual capture.
[0060] Automatic capture means that when the user opens the terminal device camera preview, the terminal device triggers the camera application to enter the preview mode, and then the terminal device can automatically capture multiple images.
[0061] Manual capture means that when the user opens the terminal device camera preview, the terminal device triggers the camera application to enter the preview mode; then the user is required to press the photo button, so that the terminal device takes multiple images according to the user's trigger.
[0062] When a terminal device is taking a snapshot, the image obtained by the terminal device may not be clear, resulting in the image not meeting the user's needs. Therefore, a method is urgently needed to make the image obtained clear when the terminal device is taking a snapshot.
[0063] Electronic devices include terminal devices, which can also be called terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. Terminal devices can be mobile phones, smart TVs, wearable devices, tablet computers (Pads), computers with wireless transceiver functions, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of the present application do not limit the specific technology and specific device form adopted by the terminal devices.
[0064] In order to better understand the embodiments of the present application, the structure of the terminal device in the embodiments of the present application is introduced below:
[0065] 1 shows a schematic structural diagram of a terminal device 100. The terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0066] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0067] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0068] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0069] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the instruction or data again, it can retrieve it from the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0070] The wireless communication function of the terminal device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0071] The terminal device 100 implements display functions through a GPU, display screen 194, and an application processor. The GPU is a microprocessor for image processing that connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0072] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, terminal device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0073] The terminal device 100 can realize the shooting function through the ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0074] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and transformed into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.
[0075] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the terminal device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0076] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the terminal device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0077] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in the terminal device 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0078] The terminal device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0079] The pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a device comprising at least two parallel plates with conductive material. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The terminal device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is applied to the display screen 194, the terminal device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The terminal device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.
[0080] The gyroscope sensor 180B can be used to determine the motion posture of the terminal device 100. In some embodiments, the angular velocity of the terminal device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for shooting anti-shake. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the terminal device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the terminal device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.
[0081] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
[0082] The magnetic sensor 180D includes a Hall effect sensor. The terminal device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip case. In some embodiments, when the terminal device 100 is a flip phone, the terminal device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. Furthermore, based on the detected opening and closing status of the case or flip cover, features such as automatic unlocking of the flip cover can be configured.
[0083] The accelerometer 180E can detect the magnitude of acceleration of the terminal device 100 in all directions (generally three axes). When the terminal device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the terminal device's posture, enabling applications such as landscape and portrait screen switching and pedometers.
[0084] The distance sensor 180F is used to measure distance. The terminal device 100 can measure distance using infrared or laser. In some embodiments, when shooting a scene, the terminal device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.
[0085] The touch sensor 180K is also called a "touch control device." The touch sensor 180K can be provided on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be provided on the surface of the terminal device 100, at a location different from that of the display screen 194.
[0086] The buttons 190 include a power button, a volume button, etc. The buttons 190 may be mechanical buttons or touch buttons. The terminal device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the terminal device 100.
[0087] The software system of the terminal device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture, etc. In the embodiment of the present application, the Android system with a layered architecture is used as an example to exemplify the software structure of the terminal device 100.
[0088] FIG2 is a block diagram of the software structure of the terminal device 100 according to an embodiment of the present application.
[0089] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0090] The application layer can include a series of application packages.
[0091] As shown in FIG2 , the application package may include applications such as camera, calendar, phone, map, telephone, music, settings, mailbox, video, social, etc.
[0092] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0093] As shown in FIG2 , the application framework layer may include a window manager, a content provider, a resource manager, a view system, a notification manager, and the like.
[0094] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, touch the screen, drag the screen, take screenshots, etc.
[0095] Content providers are used to store and retrieve data and make it accessible to applications. Data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0096] The Android runtime includes the core library and the virtual machine. The Android runtime is responsible for scheduling and management of the Android system.
[0097] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0098] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0099] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0100] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
[0101] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0102] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0103] A 2D graphics engine is a drawing engine for 2D drawings.
[0104] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0105] The following describes the workflow of the software and hardware of the terminal device 100 by way of example, in conjunction with the scenario of application startup or interface switching in the application.
[0106] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into raw input events (including touch coordinates, touch force, touch operation timestamp and other information). The raw input events are stored in the kernel layer. The application framework layer obtains the raw input events from the kernel layer and identifies the control corresponding to the input event. For example, if the touch operation is a touch-click operation and the control corresponding to the click operation is the control of the mailbox application icon, the mailbox application calls the interface of the application framework layer to start the mailbox application, and then starts the display driver by calling the kernel layer to display the functional interface of the mailbox application.
[0107] The solution provided in the embodiments of the present application is described in detail below with reference to the accompanying drawings.
[0108] The terminal device of this application can be a mobile phone, or an intelligent imaging device such as a drone.
[0109] FIG3 is a flow chart of a method for capturing a photo based on a physical sensor according to an embodiment of the present application. As shown in FIG4 , the method may include:
[0110] S301. When the terminal device captures an image, the state identification bit at the first moment is the first identification bit; wherein the first moment is the moment of capturing the previous frame image of the current frame image; the state identification bit represents the degree of jitter of the terminal device when capturing the image, and the first identification bit is a motion state identification bit or a static state identification bit.
[0111] Exemplarily, after the terminal device enters the preview mode of the camera, the terminal device captures images, and at this time, each frame of the image is obtained based on the preview stream (i.e., the image stream). For each frame of the image, the terminal device must determine the status information of each frame of the image according to the solution of the present application; wherein the status information represents the degree of jitter of the terminal device when capturing the image, and the degree of jitter is a static state or a moving state. The status information is a static state, which represents that the terminal device is in a static state (for example, not jittering, not being moved) when capturing the image. The status information is a moving state, which represents that the terminal device is in a moving state (for example, jittering, being moved) when capturing the image.
[0112] In the present application, a status flag is set; for each frame of image, the status flag is updated to obtain the status information of each frame of image.
[0113] The state flag indicates the degree of vibration of the terminal device when capturing an image. The state flag may be a moving state flag (is_moving) or a stationary state flag (is_stable).
[0114] The "status flag" is used as a new definition parameter. Then, the terminal device decides whether to complete the capture process of the current frame image based on the "status flag".
[0115] When the terminal device captures an image, when the terminal device captures the last frame of image at the first moment, the state flag is assigned a first flag, for example, a moving state flag (is_moving) or a stationary state flag (is_stable).
[0116] S302. The terminal device obtains first gyroscope data and a first exposure time; wherein, the first gyroscope data is the data collected by the gyroscope of the terminal device when collecting the current frame image, and the first exposure time is the exposure time when collecting the current frame image; the first gyroscope data and the first exposure time are used to update the status identification bit.
[0117] Exemplarily, since a gyroscope is provided in the terminal device, the gyroscope can obtain gyroscope data (gyro data); the gyroscope data is a type of attitude data, and the gyroscope data represents the attitude acceleration of the terminal device.
[0118] The terminal device captures the current frame image at the second moment. The gyroscope in the terminal device synchronously captures the first gyroscope data, and the terminal device can determine the first exposure time when capturing the current frame image. It can be seen that the first gyroscope data is the data captured by the gyroscope of the terminal device when capturing the current frame image.
[0119] The first gyroscope data is the attitude acceleration collected by the gyroscope when the terminal device collects the current frame image.
[0120] The first exposure time refers to the time interval from the opening to the closing of the shutter when the terminal device captures the current frame image.
[0121] S303: When the state flag at the second moment is the second flag, and the second flag is the static state flag, the terminal device performs a snapshot process on the current frame image; wherein the second moment is the moment of capturing the current frame image.
[0122] Exemplarily, the terminal device updates the status flag according to the first gyroscope data and the first exposure time, and thereby obtains the status flag at the second moment.
[0123] The terminal device determines that the state flag at the second moment is the stationary state flag (is_stable); that is, the second flag is determined to be the stationary state flag (is_stable). The terminal device determines that the current frame image captured is likely to be clear. The state flag is thus used as a new clarity parameter.
[0124] The terminal device then determines the image parameters of the current frame based on a preset image processing method. If the terminal device determines that the image parameters meet preset conditions (for example, the image parameters are greater than or equal to a preset parameter threshold), it further determines that the current frame is clear. The terminal device then completes the capture processing of the current frame, for example, displaying or storing the current frame.
[0125] In this embodiment, since the shaking of the terminal device is an important factor leading to the generation of blurred images, the state flag is updated based on the gyroscope data and exposure time of the terminal device when the terminal device captures the current frame image, and it is determined whether the state flag when the current frame image was captured is a static state flag or a motion state flag. The state flag is used as a new clarity parameter; before generating an image, if the state flag when the current frame image was captured is a static state flag, it is determined that the image is clear to a certain extent, and then the current frame image is captured; before generating an image, if the state flag when the current frame image was captured is a motion state flag, it is determined in advance that the captured current frame image is unclear, and the next frame image is directly analyzed.
[0126] FIG4 is a second flow chart of a method for capturing a photo based on a physical sensor according to an embodiment of the present application. As shown in FIG4 , the method may include:
[0127] S401. When the terminal device captures an image, the state identification bit at the first moment is the first identification bit; wherein the first moment is the moment of capturing the previous frame image of the current frame image; the state identification bit represents the degree of jitter of the terminal device when capturing the image, and the first identification bit is a motion state identification bit or a static state identification bit.
[0128] Exemplarily, after the terminal device enters the preview mode of the camera, the terminal device captures images, and at this time, each frame of the image is obtained based on the preview stream (i.e., the image stream). For each frame of the image, the terminal device must determine the status information of each frame of the image according to the solution of the present application; wherein the status information represents the degree of jitter of the terminal device when capturing the image, and the degree of jitter is a static state or a moving state. The status information is a static state, which represents that the terminal device is in a static state (for example, not jittering, not being moved) when capturing the image. The status information is a moving state, which represents that the terminal device is in a moving state (for example, jittering, being moved) when capturing the image.
[0129] In the present application, a status flag is set; for each frame of image, the status flag is updated to obtain the status information of each frame of image.
[0130] The state flag indicates the degree of vibration of the terminal device when capturing an image. The state flag may be a moving state flag (is_moving) or a stationary state flag (is_stable).
[0131] The "status flag" is used as a new definition parameter. Then, the terminal device decides whether to complete the capture process of the current frame image based on the "status flag".
[0132] When the terminal device captures an image, when the terminal device captures the last frame of image at the first moment, the state flag is assigned a first flag, for example, a moving state flag (is_moving) or a stationary state flag (is_stable).
[0133] S402. The terminal device obtains first gyroscope data and a first exposure time; wherein, the first gyroscope data is the data collected by the gyroscope of the terminal device when collecting the current frame image, and the first exposure time is the exposure time when collecting the current frame image; the first gyroscope data and the first exposure time are used to update the status identification bit.
[0134] Exemplarily, since a gyroscope is provided in the terminal device, the gyroscope can obtain gyroscope data (gyro data); the gyroscope data is a type of attitude data, and the gyroscope data represents the attitude acceleration of the terminal device.
[0135] The terminal device captures the current frame image at the second moment. The gyroscope in the terminal device synchronously captures the first gyroscope data, and the terminal device can determine the first exposure time when capturing the current frame image. It can be seen that the first gyroscope data is the data captured by the gyroscope of the terminal device when capturing the current frame image.
[0136] The first gyroscope data is the attitude acceleration collected by the gyroscope when the terminal device collects the current frame image.
[0137] The first exposure time refers to the time interval from the opening to the closing of the shutter when the terminal device captures the current frame image.
[0138] S403: The terminal device determines whether the first gyroscope data is greater than or equal to a preset limit value.
[0139] Illustratively, after step S402, the terminal device first determines whether the acceleration value represented by the first gyroscope data of the current frame image exceeds a preset limit value.
[0140] The preset limit value is a gyroscope threshold value used to determine the acceleration value represented by the gyroscope data, and the preset limit value may be an empirical value.
[0141] S404: When the first gyroscope data is greater than or equal to the preset limit value, the terminal device determines that the state flag at the second moment is a second flag, and the second flag is the same as the first flag;
[0142] Exemplarily, after step S403, if the terminal device determines that the acceleration value represented by the first gyroscope data of the current frame image is greater than or equal to the preset limit value, it can be determined that the gyroscope is abnormal when the terminal device collects the current frame image, or the data collected by the gyroscope is abnormal.
[0143] At this time, the terminal device does not need to update the motion counter or the stationary counter, and can directly determine that the state flag at the second moment is the same as the state flag at the first moment, thereby keeping the state flag unchanged.
[0144] For example, if the terminal device determines that the acceleration value represented by the first gyroscope data of the current frame image is greater than or equal to the preset limit value, then if the state flag at the first moment is a motion state flag, then the state flag at the first moment is also a motion state flag. If the terminal device determines that the acceleration value represented by the first gyroscope data of the current frame image is greater than or equal to the preset limit value, then if the state flag at the first moment is a stationary state flag, then the state flag at the first moment is also a stationary state flag.
[0145] If the terminal device determines that the acceleration value represented by the first gyroscope data of the current frame image is greater than or equal to the preset limit value, the terminal device does not execute steps S405-S417; and directly executes step S418 or step S419.
[0146] S405: When the first gyroscope data is less than the preset limit value, execute step S407.
[0147] For example, after step S403, if the terminal device determines that the acceleration value represented by the first gyroscope data of the current frame image is less than the preset limit value, then the gyroscope was normal when the terminal device captured the current frame image, or the data collected by the gyroscope was normal. Then, step S407 is executed.
[0148] S406: The terminal device performs mapping calculation on the first exposure time, the first time range segment, and the first threshold range segment to obtain a dynamic threshold value of the current frame image.
[0149] Among them, the first exposure time corresponds to the first time range segment, the first time range segment corresponds to the first threshold range segment, the first time range segment is the value range segment of the exposure time, and the first threshold range segment is the value range segment of the gyroscope threshold used to determine gyroscope data; the exposure time in the first time range segment and the gyroscope threshold in the first threshold range segment are positively correlated.
[0150] For example, before step S407, step S406 needs to be performed first to determine the dynamic threshold of the current frame image in real time based on the first exposure time of acquiring the current frame image. The dynamic threshold is a threshold used to determine gyroscope data.
[0151] Furthermore, after step S402 , when the first exposure time is obtained, step S406 may be executed.
[0152] In this step, the terminal device needs to determine a dynamic threshold for the current frame image in real time based on the first exposure time of the current frame image. The dynamic threshold is a threshold used to determine gyroscope data. The terminal device determines the first gyroscope data of the current frame image based on the dynamic threshold of the current frame image to determine the degree of jitter when the terminal device captured the current frame image.
[0153] First, since the terminal device has obtained the first exposure time of the current frame image, the terminal device can determine the dynamic threshold that matches the current frame image in real time based on the first exposure time of the current frame image; the dynamic threshold that matches the current frame image is the threshold used to determine the first gyroscope data of the current frame image.
[0154] In one example, the exposure time value range of the terminal device is divided into multiple first time range segments. For each first time range segment, the first time range segment is the exposure time value range segment. The method of dividing the exposure time value range of the terminal device can be based on the shooting effect obtained by the experimental test method to determine the value range of each time range segment. Among them, the difference between the maximum value and the minimum value in each first time range segment is the same or different; there is no restriction on this and it is set according to needs.
[0155] In addition, the exposure time value range of the terminal device corresponds to the gyroscope threshold value range. The gyroscope threshold value range includes multiple gyroscope thresholds, and the gyroscope threshold value in the gyroscope threshold value range is an empirical value. The gyroscope threshold value range is divided to obtain multiple preset first threshold range segments, and each first time range segment corresponds to each first threshold range segment. Among them, the preset first threshold range segment is the gyroscope threshold value range segment used to distinguish gyroscope data. For each first time range segment, the maximum exposure time in the first time range segment and the maximum gyroscope threshold value in the first threshold range segment corresponding to the first time range segment are corresponding; that is, the gyroscope threshold value corresponding to the maximum exposure time in the first time range segment is the maximum gyroscope threshold value in the first threshold range segment corresponding to the first time range segment. For each first time range segment, the minimum exposure time in the first time range segment and the minimum gyroscope threshold in the first threshold range segment corresponding to the first time range segment are corresponding; that is, the gyroscope threshold corresponding to the minimum exposure time in the first time range segment is the minimum gyroscope threshold in the first threshold range segment corresponding to the first time range segment.
[0156] The division of the value range of the gyroscope threshold can be based on the shooting effect obtained by experimental testing to determine the value range of the first threshold range segment.
[0157] The first time range segment corresponds to the first threshold range segment in a one-to-one manner. The exposure time in the first time range segment and the gyroscope threshold in the first threshold range segment are positively correlated; the longer the exposure time, the greater the gyroscope threshold.
[0158] Through the above process, the exposure time value range is quantized into multiple first time range segments; the first time range segment is the exposure time value range segment. Each first time range segment has a maximum exposure time and a minimum exposure time corresponding to the first time range segment.
[0159] The value range of the gyroscope threshold is quantized into a plurality of first threshold range segments; the first threshold range segments are value range segments of the gyroscope threshold used to determine gyroscope data. Each first threshold range segment has a maximum gyroscope threshold and a minimum gyroscope threshold corresponding to the first threshold range segment.
[0160] In the process of quantizing the exposure time value range into a plurality of first time range segments, the number of the first time range segments can be adjusted in real time for each frame of image. In the process of quantizing the gyroscope threshold value range into a plurality of first threshold range segments, the number of the first threshold range segments can be adjusted in real time for each frame of image.
[0161] Then, due to the acquired first exposure time of the current frame image, the first time range segment to which the first exposure time of the current frame image belongs can be determined, that is, the first time range segment corresponding to the first exposure time of the current frame image is obtained.
[0162] Since there is a one-to-one correspondence between the first time range and the first threshold range, the first time range corresponding to the first exposure time of the current frame image and the corresponding first threshold range can also be determined. In other words, the first threshold range corresponding to the first exposure time of the current frame image is determined.
[0163] Then, a linear mapping process is performed on the first exposure time corresponding to the current frame image, the first time range corresponding to the first exposure time of the current frame image, and the first threshold range corresponding to the first time range to obtain a dynamic threshold matching the current frame image (i.e., the dynamic threshold corresponding to the current frame image). The dynamic threshold matching the current frame image is the threshold used to determine the first gyroscope data of the current frame image.
[0164] For example, a first-order linear mapping calculation is performed on the first exposure time corresponding to the current frame image, the first time range segment corresponding to the first exposure time of the current frame image, and the first threshold range segment corresponding to the first time range segment to obtain a dynamic threshold value for matching the current frame image.
[0165] For another example, a second-order linear mapping calculation is performed on the first exposure time corresponding to the current frame image, the first time range segment corresponding to the first exposure time of the current frame image, and the first threshold range segment corresponding to the first time range segment to obtain a dynamic threshold value for matching the current frame image.
[0166] For example, the exposure time value range is [100, 200]. The exposure time value range [100, 200] is quantized into multiple first time range segments, and the multiple first time range segments are respectively the first time range segment [100, 125], the first time range segment [125, 150], the first time range segment [150, 175], and the first time range segment [175, 200].
[0167] The gyroscope threshold value range is [0.1, 0.7]. Based on the exposure time value range [100, 200], the gyroscope threshold value range [0.1, 0.7] is quantized into multiple first threshold range segments, namely, the first threshold range segment [0.1, 0.2], the first threshold range segment [0.2, 0.3], the first threshold range segment [0.3, 0.6], and the first threshold range segment [0.6, 0.7].
[0168] The first exposure time for the current frame image has been obtained as x = 130. It can be determined that the first exposure time 130 for the current frame image corresponds to the first time range [125, 150]; the first time range [125, 150] corresponds to the first threshold range [0.2, 0.3]. However, at this point, the gyroscope threshold corresponding to the first exposure time for the current frame image cannot be directly determined.
[0169] It is necessary to calculate the first exposure time 130, the first time range segment [125, 150], and the first threshold range segment [0.2, 0.3] corresponding to the current frame image (for example, first-order linear mapping, or second-order linear mapping), and then obtain the dynamic threshold of the current frame image. The dynamic threshold of the current frame image is the threshold of the first gyroscope data used to determine the current frame image.
[0170] For example, the dynamic threshold y1 = (0.3-0.2) / (150-125)*(130-125)+0.2 = 0.22 corresponding to the current frame image can be calculated based on the first exposure time 130, the first time range segment [125, 150], and the first threshold range segment [0.2, 0.3] corresponding to the current frame image.
[0171] S407: The terminal device determines whether the first gyroscope data is greater than or equal to the dynamic threshold of the current frame image.
[0172] For example, after step S405, the terminal device determines whether the first gyroscope data when the current frame image is collected is greater than or equal to the dynamic threshold of the current frame image, wherein the dynamic threshold of the current frame image is determined by the above step S406.
[0173] S408: When the first gyroscope data is greater than or equal to the dynamic threshold of the current frame image, the terminal device determines that the motion counter is added with a preset value.
[0174] The motion counter indicates the number of consecutive images whose gyroscope data is greater than or equal to the image's dynamic threshold; the dynamic threshold is the threshold used to identify gyroscope data; and the first exposure time is used to determine the dynamic threshold of the previous frame. The state flag and the motion counter at the first moment are used to determine the state flag at the second moment.
[0175] Exemplarily, after step S407 , if the terminal device determines that the first gyroscope data is greater than or equal to the dynamic threshold of the current frame image, the terminal device adds a preset value to the motion counter, for example, adds 1 to the motion counter.
[0176] It can be seen that the value of the motion counter can indicate the number of consecutive images whose gyroscope data is greater than or equal to the dynamic threshold of the image.
[0177] S409: The terminal device determines whether the first flag is a static state flag. That is, the terminal device determines whether the state flag at the first moment is a static state flag.
[0178] Exemplarily, after step S408, the terminal device determines whether the state flag at the first moment is a stationary state flag (is_stable).
[0179] S410: When the first identifier is a stationary state identifier, the terminal device determines whether the motion counter is greater than or equal to a first preset counting threshold.
[0180] Exemplarily, after step S409, the terminal device determines that the state flag at the first moment is the stationary state flag (is_stable); that is, the terminal device determines the first flag to be the stationary state flag (is_stable). At this time, when the terminal device captures the previous frame of image, according to the solution of this embodiment, it determines that the state flag is set to the stationary state flag (is_stable) when capturing the previous frame of image.
[0181] At this point, the terminal device has already updated the value of the motion counter in step S408. The terminal device first determines whether the value of the motion counter is greater than or equal to a first preset counting threshold.
[0182] The first preset counting threshold for determining the value of the motion counter may be a preset fixed value, which is an empirical value. For example, the value of the first preset counting threshold is 5.
[0183] For the first frame image, the state flag at the moment of capturing the first frame image may be set to a motion state flag (is_moving).
[0184] S411: When the first identifier is a stationary state identifier and the motion counter is greater than or equal to a first preset counting threshold, the terminal device determines that the second identifier is a motion state identifier and clears the motion counter;
[0185] Exemplarily, after step S410, the terminal device determines that the state flag at the first moment is a stationary state flag (is_stable), that is, determines that the first flag is a stationary state flag; and the terminal determines that the motion counter is greater than or equal to a first preset counting threshold.
[0186] At this time, since the state flag at the first moment is a stationary state flag, it can be determined that the terminal device had little jitter when capturing the previous frame of image, and the previous frame of image can be considered clear. Then, if the value of the motion counter is greater than or equal to the first preset count threshold, it can be determined that the terminal device is continuously in a state of large jitter, and the currently captured frame of image can be considered unclear.
[0187] Therefore, the terminal device determines that the state flag at the second moment is the moving state flag (is_moving), that is, determines that the second flag is the moving state flag. In addition, the terminal device clears the movement counter.
[0188] S412: When the first identifier is a stationary state identifier and the motion counter is less than a first preset counting threshold, the terminal device determines that the second identifier is a stationary state identifier.
[0189] Exemplarily, after step S410, the terminal device determines that the state flag at the first moment is a stationary state flag (is_stable), that is, determines that the first flag is a stationary state flag; and the terminal determines that the motion counter is less than a first preset counting threshold.
[0190] At this time, since the state flag at the first moment is a stationary state flag, it can be determined that the terminal device had minimal jitter when capturing the previous image frame, and the previous image frame can be considered clear. Then, if the value of the motion counter is less than the first preset count threshold, the terminal device determines that it has reached a stable state. The terminal device determines that the jitter was minimal when capturing the current image frame, and the current image frame can be considered clear.
[0191] Therefore, the terminal device determines that the state flag at the second moment is the stationary state flag (is_stable), that is, determines that the second flag is the stationary state flag. At this time, the motion counter is not modified.
[0192] It can be seen that in step S412, the terminal device keeps the status flag unchanged.
[0193] In the two situations shown in step S411 and step S412, since the status flag was in a static state when the previous frame image was captured, it is necessary to judge the value of the motion counter to determine whether the terminal device was shaking when capturing the current frame image, and then determine whether the status flag was a static state flag when capturing the current frame image.
[0194] S413. When the first gyroscope data is smaller than the dynamic threshold of the current frame image, the terminal device determines a still counter plus a preset value; wherein the still counter represents the number of consecutive images whose gyroscope data is smaller than the dynamic threshold of the image.
[0195] The state flag at the first moment and the static counter are used to determine the state flag at the second moment.
[0196] Exemplarily, after step S407 , if the terminal device determines that the first gyroscope data is less than the dynamic threshold of the current frame image, the terminal device adds a preset value to the still counter, for example, adds 1 to the still counter.
[0197] It can be seen that the value of the still counter can indicate the number of consecutive images whose gyroscope data is less than the dynamic threshold of the image.
[0198] S414. The terminal device performs a mapping calculation on the first exposure time, the second time range, and the second threshold range to obtain a second preset counting threshold.
[0199] Among them, the first exposure time corresponds to the second time range segment, the first time range segment corresponds to the second threshold range segment, the second time range segment is the value range segment of the exposure time, and the second threshold range segment is the value range segment for determining the counting threshold of the still counter; the exposure time in the second time range segment and the gyroscope threshold in the second threshold range segment are positively correlated.
[0200] For example, before step S415, step S414 needs to be performed first to determine the second preset counting threshold corresponding to the current frame image in real time based on the first exposure time for acquiring the current frame image. The second preset counting threshold corresponding to the current frame image is a threshold for determining the value of the stillness counter.
[0201] Furthermore, after step S402 , when the first exposure time is obtained, step S414 may be executed.
[0202] In this step, the terminal device needs to determine the second preset counting threshold corresponding to the current frame image in real time based on the first exposure time of the current frame image; wherein the second preset counting threshold corresponding to the current frame image is the threshold used to determine the value of the still counter.
[0203] In one example, the exposure time value range of the terminal device is divided into multiple second time range segments. For each second time range segment, the second time range segment is a value range segment of the exposure time. The method of dividing the value range of the terminal device's exposure time can be based on the shooting effect obtained by the experimental test method to determine the value range of each second time range segment. The difference between the maximum value and the minimum value in each second time range segment is the same or different; there is no restriction on this and it is set according to needs.
[0204] The obtained first time range segment and the obtained second time range segment are different.
[0205] Furthermore, the range of exposure time values of the terminal device corresponds to the range of count threshold values. The range of count threshold values includes multiple count threshold values, and the count threshold values within the range of count threshold values are empirical values. The range of count threshold values is divided into multiple preset second threshold range segments, with each second time range segment corresponding to each second threshold range segment. The preset second threshold range segments are count threshold value range segments used to discriminate count data. For each second time range segment, the maximum exposure time within the second time range segment and the maximum count threshold value within the second threshold range segment corresponding to the second time range segment correspond to each other; that is, the count threshold value corresponding to the maximum exposure time within the second time range segment is the maximum count threshold value within the second threshold range segment corresponding to the second time range segment. For each second time range segment, the minimum exposure time within the second time range segment and the minimum count threshold value within the second threshold range segment corresponding to the second time range segment correspond to each other; that is, the count threshold value corresponding to the minimum exposure time within the second time range segment is the minimum count threshold value within the second threshold range segment corresponding to the second time range segment.
[0206] The value range of the counting threshold can be divided into two parts, and the value range of each second threshold range segment can be determined based on an experiment.
[0207] The second time range segment corresponds to the second threshold range segment in a one-to-one manner. The exposure time in the second time range segment and the counting threshold in the second threshold range segment are positively correlated; the longer the exposure time, the larger the counting threshold.
[0208] Through the above process, the exposure time value range is quantized into multiple second time range segments; the second time range segments are exposure time value range segments. Each second time range segment has a maximum exposure time and a minimum exposure time corresponding to the second time range segment.
[0209] The value range of the counting threshold is quantized into a plurality of second threshold range segments; the second threshold range segments are value range segments of the counting threshold used to distinguish counting data. Each second threshold range segment has a maximum counting threshold and a minimum counting threshold corresponding to the second threshold range segment.
[0210] In the process of quantizing the exposure time value range into multiple second time range segments, the number of second time range segments can be adjusted in real time for each frame of image. In the process of quantizing the counting threshold value range into multiple second threshold range segments, the number of second threshold range segments can be adjusted in real time for each frame of image.
[0211] Then, due to the acquired first exposure time of the current frame image, the second time range segment to which the first exposure time of the current frame image belongs can be determined, that is, the second time range segment corresponding to the first exposure time of the current frame image is obtained.
[0212] Since there is a one-to-one correspondence between the second time range and the second threshold range, the second time range corresponding to the first exposure time of the current frame image and the corresponding second threshold range can also be determined. That is, the second threshold range corresponding to the first exposure time of the current frame image is determined.
[0213] Then, a linear mapping process is performed on the first exposure time corresponding to the current frame image, the second time range corresponding to the first exposure time of the current frame image, and the second threshold range corresponding to the second time range to obtain a second preset count threshold for matching the current frame image (i.e., the second preset count threshold corresponding to the current frame image). The second preset count threshold for matching the current frame image is the threshold used to determine the value of the stillness counter.
[0214] For example, a first-order linear mapping calculation is performed on the first exposure time corresponding to the current frame image, the second time range segment corresponding to the first exposure time of the current frame image, and the second threshold range segment corresponding to the second time range segment to obtain a second preset counting threshold for matching the current frame image.
[0215] For another example, a second-order linear mapping calculation is performed on the first exposure time corresponding to the current frame image, the second time range segment corresponding to the first exposure time of the current frame image, and the second threshold range segment corresponding to the second time range segment to obtain a second preset counting threshold for matching the current frame image.
[0216] For example, the exposure time value range is [100, 200]. The exposure time value range [100, 200] is quantized into multiple second time range segments, namely, the second time range segment [100, 120], the second time range segment [120, 140], the second time range segment [140, 160], the second time range segment [160, 180], and the second time range segment [180, 200].
[0217] The counting threshold value range is [1, 16]. Based on the exposure time value range of [100, 200], the counting threshold value range [1, 16] is quantized into multiple second threshold range segments, namely, second threshold range segment [1, 2], second threshold range segment [2, 4], second threshold range segment [4, 7], second threshold range segment [7, 12], and second threshold range segment [12, 16]. The counting thresholds in the second threshold range segments are positive integers.
[0218] The first exposure time corresponding to the current frame image has been obtained as x = 130. It can be determined that the exposure time 130 corresponding to the current frame image corresponds to the second time range [120, 140], and the second time range [120, 140] corresponds to the second threshold range [2, 4]. However, at this point, the counting threshold corresponding to the first exposure time corresponding to the current frame image cannot be directly determined.
[0219] It is necessary to calculate the first exposure time 130, the second time range segment [120, 140], and the second threshold range segment [2, 4] corresponding to the current frame image (for example, first-order linear mapping or second-order linear mapping) to obtain the second preset counting threshold corresponding to the current frame image.
[0220] For example, based on the first exposure time 130 corresponding to the current frame image, the second time range [120, 140], and the second threshold range [2, 4], the second preset counting threshold y2 corresponding to the current frame image can be calculated as (4-2) / (140-120)*(130-120)+2=3. The second preset counting threshold needs to be an integer.
[0221] After step S413, the terminal device may execute the above step S409, where the terminal device determines whether the first flag is a stationary state flag. That is, the terminal device determines whether the state flag at the first moment is a stationary state flag.
[0222] S415: When the first identifier is a motion state identifier, the terminal device determines whether the static counter is greater than or equal to a second preset counting threshold.
[0223] Exemplarily, after step S413, the terminal device determines that the state flag at the first moment is the motion state flag (is_moving); that is, the terminal device determines the first flag to be the motion state flag (is_moving). At this time, when the terminal device captures the previous frame of image, according to the solution of this embodiment, it is determined that the state flag is set to the motion state flag (is_moving) when capturing the previous frame of image.
[0224] At this point, the terminal device has updated the value of the still counter in step S413. The terminal device determines whether the value of the still counter is greater than or equal to the second preset counting threshold corresponding to the current frame image.
[0225] The second preset counting threshold corresponding to the current frame image is the counting threshold determined based on step S414.
[0226] For the first frame image, the state flag at the moment of capturing the first frame image may be set to a motion state flag (is_moving).
[0227] S416: When the first identifier is a motion state identifier and the static counter is greater than or equal to a second preset counting threshold, the terminal device determines that the second identifier is a static state identifier and clears the static counter.
[0228] Exemplarily, after step S415, the terminal device determines that the state flag at the first moment is the motion state flag (is_moving), that is, determines that the first flag is the motion state flag; and the terminal determines that the still counter is greater than or equal to the second preset count threshold corresponding to the current frame image.
[0229] At this time, since the state flag at the first moment is a motion state flag, it can be determined that the terminal device was significantly jittered when capturing the previous frame, and the previous frame can be considered unclear. Then, if the value of the static counter is greater than or equal to the second preset count threshold corresponding to the current frame, it can be determined that the terminal device is continuously in a state of minimal jitter, and the currently captured frame can be considered clear.
[0230] Therefore, the terminal device determines that the state flag at the second moment is the quiescent state flag (is_stable), that is, determines that the second flag is the quiescent state flag. In addition, the terminal device clears the quiescent counter.
[0231] S417: When the first identifier is a motion state identifier and the stationary counter is less than a second preset counting threshold, the terminal device determines that the second identifier is a motion state identifier.
[0232] Exemplarily, after step S415, the terminal device determines that the state flag at the first moment is the motion state flag (is_moving), that is, determines that the first flag is the motion state flag; and the terminal determines that the still counter is less than the second preset count threshold corresponding to the current frame image.
[0233] At this time, since the state flag at the first moment is a motion state flag, it can be determined that the terminal device jittered significantly when capturing the previous image frame, and the previous image frame can be considered unclear. Then, if the value of the static counter is less than the first preset count threshold, the terminal device determines that a stable state has not been reached. The terminal device determines that jittered significantly when capturing the current image frame, and the current image frame can be considered unclear.
[0234] Therefore, the terminal device determines that the state flag at the second moment is the moving state flag (is_moving), that is, determines that the second flag is the moving state flag. At this time, the stationary counter is not modified.
[0235] It can be seen that in step S417, the terminal device keeps the status flag unchanged.
[0236] In the two situations shown in step S416 and step S417, since the state flag is in motion when the previous frame image is captured, it is necessary to judge the value of the still counter to determine whether the terminal device has reached a stable state when capturing the current frame image, that is, to determine whether the terminal device has a large jitter when capturing the current frame image, and then determine whether the state flag is a still state flag when capturing the current frame image.
[0237] The lower the ambient light brightness (i.e., a dark environment), the longer the exposure time when capturing an image. This requires a larger count threshold for the still counter, making it more difficult for steps S416-S417 to reach a stable state (i.e., stillness), thus preventing the terminal device from capturing unclear images. Therefore, it is necessary to determine the second preset count threshold for the current frame image in real time based on the first exposure time of the current frame image.
[0238] The higher the ambient light brightness (i.e., bright light environment), the shorter the exposure time when capturing the image. This requires that the count threshold corresponding to the stillness counter be smaller, so that steps S416-S417 can more easily reach a stable state (i.e., stillness). Therefore, it is necessary to determine the second preset count threshold for the current frame image in real time based on the first exposure time of the current frame image.
[0239] S418: When the state flag at the second moment is the second flag, and the second flag is the static state flag, the terminal device performs a snapshot process on the current frame image; wherein the second moment is the moment of capturing the current frame image.
[0240] In one example, step S418 includes: the terminal device determines the image parameters of the current frame image; when the image parameters are greater than or equal to a preset parameter threshold, the terminal device performs a snapshot process on the current frame image.
[0241] In one example, the image parameters include one or more of the following: parameters obtained by an image processing method based on the spatial domain, parameters obtained by an image processing method based on the frequency domain, and parameters obtained by an image processing method based on a deep learning model.
[0242] Exemplarily, after step S404, or after step S411, or after step S412, or after step S416, or after step S417, step S418 or step S419 is performed.
[0243] After step S404, or after step S411, or after step S412, or after step S416, or after step S417, the terminal device determines the status flag at the second moment.
[0244] The terminal device determines that the state flag at the second moment is the stationary state flag (is_stable); that is, the second flag is determined to be the stationary state flag (is_stable). The terminal device determines that the current frame image captured is likely to be clear. The state flag is thus used as a new clarity parameter.
[0245] The terminal device then determines the image parameters of the current frame based on a preset image processing method. If the terminal device determines that the image parameters meet preset conditions (for example, the image parameters are greater than or equal to a preset parameter threshold), it further determines that the current frame is clear. The terminal device then completes the capture processing of the current frame, for example, displaying or storing the current frame.
[0246] In one example, the terminal device determines that the state flag at the second moment is a static state flag. The terminal device then determines the neighborhood contrast of the current frame image based on spatial image processing, specifically the gradient difference in grayscale features between adjacent pixels. The terminal device then calculates this gradient difference based on probability theory and statistical methods to obtain a first clarity parameter for the current frame image. If the terminal device determines that the first clarity value for the current frame image is greater than or equal to a first preset clarity, the capture processing for the current frame image is complete.
[0247] In one example, the terminal device determines that the state flag at the second moment is a stationary state flag. The terminal device then determines the frequency components of the current frame image based on frequency-domain image processing. If the image is relatively clear, the image is in focus and has a higher number of high-frequency components; if the image is relatively blurry, the image is out of focus and has a higher number of low-frequency components. The terminal device then calculates the frequency components based on probability theory and statistics to obtain a second clarity value for the current frame image. If the terminal device determines that the second clarity value for the current frame image is greater than or equal to the second preset clarity, the capture processing of the current frame image is completed.
[0248] In one example, the terminal device determines that the state flag at the second moment is a stationary state flag. The terminal device then identifies a third clarity value for the current frame image based on image processing using a deep learning model. If the terminal device determines that the third clarity value for the current frame image is greater than or equal to the third preset clarity, the capture process for the current frame image is completed.
[0249] One or more of the above-mentioned image processing methods may be used.
[0250] S419: When the state flag at the second moment is the second flag, and the second flag is the motion state flag, the terminal device captures the next frame of image.
[0251] Exemplarily, after step S404, or after step S411, or after step S412, or after step S416, or after step S417, the terminal device determines the status identification bit at the second moment.
[0252] The terminal device determines that the state flag at the second moment is the motion state flag (is_moving); that is, the second flag is determined to be the motion state flag (is_moving). The terminal device determines that the current frame image being captured is not clear. The state flag is thus used as a new clarity parameter.
[0253] Then, the terminal device does not perform snapshot processing on the current frame image, and collects the next frame image, and executes the process of this embodiment again.
[0254] For the next image frame, the terminal device acquires second gyroscope data and a second exposure time when capturing the next image frame. The second gyroscope data refers to the data captured by the terminal device's gyroscope when capturing the next image frame, and the second exposure time refers to the exposure time when capturing the next image frame. Then, referring to steps S403-S417, the clarity of the next image is pre-determined, and the state flag is updated. If the state flag indicates a stationary state, step S418 is executed; if the state flag indicates a moving state, step S419 is executed.
[0255] Through the above steps S401-S417, a state identification bit is added as a new clarity parameter. When the terminal device is capturing, it first determines whether the state identification bit when the current frame image is captured is a static state identification bit or a motion state identification bit. If the state identification bit when the current frame image is captured is a static state identification bit, then other clarity parameters are judged to determine whether the capture of the current frame image is completed; thus, the state identification bit is added as a new clarity parameter to pre-judge the clarity of the image to avoid obtaining unclear images. If the state identification bit when the current frame image is captured is a motion state identification bit, then it is pre-determined that the captured current frame image is unclear, and there is no need to judge other clarity parameters, and then it is directly determined not to capture the current frame image; thereby reducing the amount of calculation.
[0256] Furthermore, in the present application, since the shaking of the terminal device is an important factor leading to the generation of blurred images, the state flag is updated based on the gyroscope data and exposure time of the terminal device when the terminal device collects the current frame image, and it is determined whether the state flag when collecting the current frame image is a static state flag or a motion state flag. The state flag is used as a new clarity parameter; before generating an image, if the state flag when collecting the current frame image is a static state flag, it is determined that the image is clear to a certain extent, and then the current frame image is captured; before generating an image, if the state flag when collecting the current frame image is a motion state flag, it is determined in advance that the current frame image collected is unclear, and the next frame image is directly analyzed.
[0257] Figure 5 is a block diagram of the software layer of the terminal device provided in an embodiment of the present application. As shown in Figure 5, the terminal device includes an application layer (app), an application framework layer (Framwork, FW), a system runtime layer (Native), a hardware abstraction layer (Hardware Abstraction Layer, HAL), and a Linux kernel layer (Kenrel).
[0258] The camera application is deployed in the application layer.
[0259] The above steps S401-S419 may be an image clarity judgment module, and the image clarity judgment module is deployed in the hardware abstraction layer of the terminal device.
[0260] Automatically capture the scene: when the user opens the terminal device camera preview, the terminal device triggers the camera application to enter the preview mode; the terminal device determines whether the state identification bit when collecting the current frame image is a static state identification bit or a motion state identification bit according to the solution of this application; if the terminal device determines that the state identification bit when collecting the current frame image is a static state identification bit, it is considered that the current frame image meets a certain clarity; then, the terminal device obtains other clarity parameters according to one or more methods of spatial domain image processing, frequency domain image processing, and deep learning model; if the terminal device determines that other image clarity parameters meet the preset conditions, the capture of the current frame image is completed.
[0261] Manual snapshot scenario: When the user opens the terminal device camera preview, the terminal device triggers the camera application to enter the preview mode; then the user is required to press the photo button, so that the terminal device determines, based on the user's trigger and the solution of this application, whether the state identification bit when collecting the current frame image is a static state identification or a motion state identification; if the terminal device determines that the state identification bit when collecting the current frame image is a static state identification, it is considered that the current frame image meets a certain clarity; then, the terminal device obtains other clarity parameters according to one or more methods of spatial domain image processing, frequency domain image processing, and deep learning model; if the terminal device determines that other image clarity parameters meet the preset conditions, the capture of the current frame image is completed.
[0262] In the process of this application, the terminal device writes the above processing process into a log; the terminal device stores the generated log. The terminal device can also send the generated log to the cloud device for storage.
[0263] In the present application, based on the first gyroscope data and the first exposure time when the current frame image is collected, the state identification bit when the current frame image is collected is output, and then the clarity parameter of the current frame image is obtained; the state identification bit is used as a new clarity parameter. If the state identification bit when the current frame image is collected is a static state identification bit, it is considered that the current frame image meets a certain clarity, and then other clarity parameters are obtained according to other image processing methods to further determine whether to display or store the current frame image. If the state identification bit when the current frame image is collected is a motion state identification bit, it is considered that the current frame image does not meet a certain clarity, and there is no need to calculate other clarity parameters of the current image, and the next frame image is directly processed; thereby, the amount of calculation of the image processing method is reduced.
[0264] Furthermore, a dynamic threshold value corresponding to the current frame image is dynamically calculated in real time based on the first gyroscope data and the first exposure time of the current frame image. The dynamic threshold value corresponding to the current frame image serves as the threshold value for determining the first gyroscope data of the current frame image. A determination is made as to whether the first gyroscope data of the current frame image is greater than or equal to the dynamic threshold value corresponding to the current frame image. Since different dynamic threshold values are obtained based on the exposure time in different lighting environments, image clarity determination can be adapted to different lighting environments.
[0265] Furthermore, based on the value range of the exposure time, a plurality of first time range segments are quantified; based on the plurality of first time range segments, the value range of the gyroscope threshold is quantified into a plurality of first threshold range segments; the first threshold range segment is a value range segment of the gyroscope threshold used to discriminate gyroscope data. Then, based on the first exposure time corresponding to the current frame image, the first time range segment corresponding to the exposure time of the current frame image, and the first threshold range segment corresponding to the first time range segment, a dynamic threshold matching the current frame image (i.e., the dynamic threshold corresponding to the current frame image) is determined. The dynamic threshold matching the current frame image is the threshold value for discriminating the first gyroscope data of the current frame image. Thus, the gyroscope threshold used for clarity judgment is fine-tuned. The number of interval segments in the value range of the exposure time can also be adjusted to achieve debugging of algorithm effects with different fineness.
[0266] Furthermore, a dynamic threshold matching the current frame image (the dynamic threshold matching the current frame image is the threshold for determining the first gyroscope data of the current frame image) and a second preset count threshold matching the current frame image (the second preset count threshold matching the current frame image is the threshold for determining the value of the stationary counter) can be determined in real time, thereby using a dual dynamic threshold. Furthermore, based on the first exposure time of the current frame image, a dynamic adjustment mechanism is used for both the gyroscope threshold of the terminal device and the buffer threshold from motion to stability (i.e., the second preset count threshold).
[0267] The method for sorting a device list in an embodiment of the present application has been described above. The following describes an apparatus for performing the aforementioned method for sorting a device list provided in an embodiment of the present application. Those skilled in the art will appreciate that the method and apparatus may be combined and referenced with one another, and that the relevant apparatus provided in an embodiment of the present application may perform the steps in the aforementioned method for sorting a device list.
[0268] The embodiment of the present application can divide the functional modules of the device of the above method according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0269] FIG6 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip 600 includes one or more (including two) processors 601 , a communication line 602 , a communication interface 603 , and a memory 604 .
[0270] In some implementations, the memory 604 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.
[0271] The method described in the above embodiment of the present application can be applied to the processor 601, or implemented by the processor 601. The processor 601 may be an integrated circuit chip with signal processing capabilities. During the implementation process, the various steps of the above terminal device execution method can be completed by the hardware integrated logic circuit in the processor 601 or the instructions in the form of software. The above processor 601 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 601 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application.
[0272] The steps of the method disclosed in the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be implemented by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read-only memory (EEPROM). The storage medium is located in memory 604, and processor 601 reads the information in memory 604 and performs the steps of the above method in conjunction with its hardware.
[0273] The processor 601 , the memory 604 , and the communication interface 603 can communicate with each other via the communication line 602 .
[0274] FIG7 is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. As shown in FIG7 , terminal device 700 includes the aforementioned chip and a display unit. The display unit is provided with an integrated circuit panel, which is used to issue periodic interrupt events. The integrated circuit panel excludes the integrated circuit unit used to calculate coordinate information corresponding to touch operations.
[0275] The physical sensor-based capture method provided in the embodiments of the present application can be applied to electronic devices with communication functions. The electronic devices include terminal devices. The specific device form of the terminal device can refer to the above-mentioned relevant description and will not be repeated here.
[0276] An embodiment of the present application provides a terminal device, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the above method.
[0277] The present embodiment provides a chip. The chip includes a processor configured to invoke a computer program stored in a memory to execute the technical solution of the above embodiment. The implementation principles and technical effects are similar to those of the above-mentioned related embodiments and will not be further described here.
[0278] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above-mentioned method is implemented. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the functions can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0279] In one possible implementation, computer-readable media may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium designed to carry or store the desired program code in the form of instructions or data structures and accessible by a computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technologies such as infrared, radio and microwave are used to transmit software from a website, server or other remote source, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of medium. Disk and optical disk as used herein include optical disk, laser disk, optical disk, digital versatile disk (DVD), floppy disk and Blu-ray disk, where disks generally reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0280] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above method.
[0281] The present application embodiment is described with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present application.It should be understood that each flow process and / or box in the flow chart and / or block diagram and the combination of the flow process and / or box in the flow chart and / or block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processing unit of general-purpose computer, special-purpose computer, embedded processing machine or other programmable device to produce a machine, so that the instruction executed by the processing unit of computer or other programmable data processing device produces the device for realizing the function specified in one flow chart flow or multiple flows and / or one block or multiple blocks of block diagram.
[0282] The above specific implementation methods further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the scope of protection of the present invention.
Claims
1. A capture method based on a physical sensor, characterized in that: The method is applied to a terminal device, and the method comprises: When the terminal device captures an image, the state identification bit at the first moment is the first identification; wherein the first moment is the moment of capturing the previous frame image of the current frame image; the state identification bit represents the degree of jitter of the terminal device when capturing the image, and the first identification is a motion state identification or a static state identification; The terminal device acquires first gyroscope data and a first exposure time; wherein the first gyroscope data is data collected by the gyroscope of the terminal device when collecting the current frame image, and the first exposure time is the exposure time when collecting the current frame image; the first gyroscope data and the first exposure time are used to update the status flag; When the state identification bit at the second moment is the second identification, and the second identification is the static state identification, the terminal device performs a snapshot process on the current frame image; wherein the second moment is the moment of capturing the current frame image.
2. The method according to claim 1, characterized in that The method further comprises: When the first gyroscope data is greater than or equal to the dynamic threshold of the current frame image, the terminal device determines a motion counter plus a preset value; wherein the motion counter represents the number of consecutive images whose gyroscope data is greater than or equal to the dynamic threshold of the image; the dynamic threshold is a threshold for determining gyroscope data; the first exposure time is used to determine the dynamic threshold of the previous frame image; The state flag at the first moment and the motion counter are used to determine the state flag at the second moment.
3. The method according to claim 2, characterized in that The method further comprises: When the first identifier is a stationary state identifier and the motion counter is greater than or equal to a first preset counting threshold, the terminal device determines that the second identifier is a motion state identifier and clears the motion counter; When the first identifier is a stationary state identifier and the motion counter is less than the first preset counting threshold, the terminal device determines that the second identifier is a stationary state identifier.
4. The method according to claim 2 or 3, characterized in that: The first exposure time corresponds to a first time range segment, the first time range segment corresponds to a first threshold range segment, the first time range segment is a value range segment of the exposure time, and the first threshold range segment is a value range segment of a gyroscope threshold for determining gyroscope data; The exposure time in the first time range segment is positively correlated with the gyroscope threshold in the first threshold range segment; The method further comprises: The terminal device performs mapping calculation on the first exposure time, the first time range segment, and the first threshold range segment to obtain a dynamic threshold of the current frame image.
5. The method according to any one of claims 2 to 4, characterized in that: The method further comprises: When the first gyroscope data is less than the dynamic threshold of the current frame image, the terminal device determines a still counter plus a preset value; wherein the still counter represents the number of consecutive images whose gyroscope data is less than the dynamic threshold of the image; The state flag at the first moment and the static counter are used to determine the state flag at the second moment.
6. The method according to claim 5, characterized in that The method further comprises: When the first flag is a motion state flag and the stationary counter is greater than or equal to a second preset counting threshold, The terminal device determines that the second identifier is a static state identifier, and clears the static counter; When the first identifier is a motion state identifier and the stationary counter is less than the second preset counting threshold, the terminal device determines that the second identifier is a motion state identifier.
7. The method according to claim 6, characterized in that The first exposure time corresponds to a second time range, the first time range corresponds to a second threshold range, the second time range is a value range of the exposure time, and the second threshold range is a value range for determining a count threshold of a still counter; The exposure time in the second time range segment is positively correlated with the gyroscope threshold in the second threshold range segment; The method further comprises: The terminal device performs mapping calculation on the first exposure time, the second time range segment, and the second threshold range segment to obtain the second preset counting threshold.
8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: When the state flag at the second moment is a second flag, and the second flag is a motion state flag, the terminal device captures a next frame of image.
9. The method according to any one of claims 1 to 8, characterized in that When the state flag at the second moment is the second flag, and the second flag is the static state flag, before the terminal device performs snapshot processing on the current frame image, the method further includes: When the first gyroscope data is greater than or equal to a preset limit value, the terminal device determines that the state identification bit at the second moment is a second identification, and the second identification is the same as the first identification; When the first gyroscope data is less than the preset limit value, the terminal device determines that when the state identification bit at the second moment is the second identification bit and the second identification bit is the static state identification bit, the terminal device performs a snapshot process on the current frame image.
10. The method according to any one of claims 1 to 9, characterized in that The terminal device performs a capture process on the current frame image, including: The terminal device determines the image parameters of the current frame image; When the image parameter is greater than or equal to a preset parameter threshold, the terminal device captures the current frame image.
11. The method according to claim 10, characterized in that The image parameters include one or more of the following: parameters obtained based on a spatial domain image processing method, parameters obtained based on a frequency domain image processing method, and parameters obtained based on a deep learning model image processing method.
12. A terminal device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method according to any one of claims 1 to 11.
13. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
14. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables a computer to execute the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Camera anti-shake method and device, electronic equipment and computer readable storage medium
CN110166697A
Image recognition method and device, terminal and computer readable storage medium
CN110717452A
Moving image processing apparatus and method
US20070260985A1
Electronic device and method for providing notification related to image displayed through display and image stored in memory based on image analysis
US20200053288A1
Remote-controlled shooting system, video camera apparatus and remote-controlled shooting method
US6731331B1
