Image acquisition method and apparatus, computer-readable storage medium, terminal

By combining fixed exposure and automatic exposure after device startup, the problem of poor image acquisition quality after startup was solved, enabling the rapid acquisition of high-quality images.

CN116389911BActive Publication Date: 2026-05-26SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
Filing Date
2022-12-30
Publication Date
2026-05-26

Smart Images

  • Figure CN116389911B_ABST
    Figure CN116389911B_ABST
Patent Text Reader

Abstract

An image acquisition method, apparatus, computer-readable storage medium, and terminal are disclosed. The method includes: acquiring a start signal; acquiring the start signal; wherein, before the number of frames acquired reaches a threshold, the exposure value used to acquire each frame is a first exposure value; after the number of frames acquired reaches the threshold, the exposure value used to acquire each frame is calculated by an automatic exposure algorithm. The solution provided in this application enables the rapid acquisition of high-quality images after startup.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image acquisition technology, and in particular to an image acquisition method and apparatus, a computer-readable storage medium, and a terminal. Background Technology

[0002] With the continuous iteration of electronic technology, the hardware performance of camera modules has been constantly improving, resulting in a variety of image capturing devices to meet the different needs of users in various scenarios. Examples include common mobile phones and tablets with image capturing capabilities, as well as scanning devices that capture images. However, when using existing image capturing devices to start the camera function for image acquisition, the first few frames are often dark, and the image quality fails to meet user requirements.

[0003] Therefore, there is an urgent need for an image acquisition method that can quickly obtain high-quality images after startup. Summary of the Invention

[0004] The technical problem addressed by this application is how to quickly obtain high-quality images after startup.

[0005] To address the aforementioned technical problems, this application provides an image acquisition method, comprising: acquiring a start signal; and acquiring an image in response to the start signal; wherein, before the number of frames acquired reaches a quantity threshold, the exposure value used to acquire each frame of the image is a first exposure value, and after the number of frames acquired reaches the quantity threshold, the exposure value used to acquire each frame of the image is calculated by an automatic exposure algorithm.

[0006] Optionally, before acquiring the image, the method further includes: acquiring a preview image; inputting the preview image into a pre-trained threshold calculation model to obtain the quantity threshold output by the threshold calculation model.

[0007] Optionally, the training method of the threshold calculation model includes: acquiring multiple frame sample images, wherein the multiple frame sample images are acquired in response to a device start signal, and the exposure value used to acquire the multiple frame sample images is calculated by the automatic exposure algorithm; determining a reference image in the multiple frame sample images, and using the sequence number of the reference image in the multiple frame sample images as label data, wherein the reference image refers to the first frame image in the multiple frame sample images whose image quality reaches a preset quality standard; inputting the first frame image in the multiple frame sample images and the label data into a preset model for training until the model converges.

[0008] Optionally, before acquiring the image, the method further includes: obtaining the ambient light intensity collected by the light sensor and a preset set of exposure values; and selecting the first exposure value from the set of exposure values ​​based on the ambient light intensity.

[0009] Optionally, it also includes: performing text recognition on the acquired image to obtain a recognition result; sending the recognition result to a server so that the server can translate the recognition result; and receiving the translation result from the server.

[0010] Optionally, before acquiring the image, the method further includes setting the format of the image and the frame rate for acquiring the image.

[0011] To address the aforementioned technical features, this application also provides an image acquisition device, comprising: an acquisition module for acquiring a start signal; and an acquisition module for acquiring images in response to the start signal; wherein, before the number of frames acquired reaches a quantity threshold, the exposure value for acquiring each frame is a first exposure value, and after the number of frames acquired reaches the quantity threshold, the exposure value for acquiring each frame is calculated by an automatic exposure algorithm.

[0012] This application also provides a computer-readable storage medium storing a computer program thereon, which, when run by a processor, performs the steps of the image acquisition method described above.

[0013] This application also provides a terminal, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor runs the computer program, it performs the steps of the image acquisition method described above.

[0014] Optionally, the terminal is a scanning device.

[0015] Compared with the prior art, the technical solution of this application embodiment has the following beneficial effects:

[0016] In the scheme of this application embodiment, a start signal is obtained; in response to the start signal, an image is acquired; wherein, before the number of frames acquired reaches a threshold, the exposure value used to acquire each frame is a first exposure value; after the number of frames acquired reaches the threshold, the exposure value used to acquire each frame is calculated by an automatic exposure algorithm. Using the above scheme, after startup, images are first acquired with a fixed exposure (i.e., the first exposure value) to avoid underexposure caused by automatic exposure after startup; after the number of frames acquired reaches the threshold, the system is adjusted to automatic exposure to avoid overexposure. Compared to existing schemes that only use automatic exposure to acquire images, the above scheme combines fixed and automatic exposure, eliminating the need for frame skipping and enabling the rapid acquisition of high-quality images after device startup.

[0017] Furthermore, in the solution of this application embodiment, a preview image is acquired and input into a pre-trained threshold calculation model to obtain the quantity threshold output by the threshold calculation model. The quantity threshold calculated by the threshold calculation model can automatically switch from fixed exposure to automatic exposure based on the actual situation of the image, which is beneficial for acquiring images with more appropriate exposure values. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating an image acquisition method according to an embodiment of this application;

[0019] Figure 2 This is a flowchart illustrating another image acquisition method in an embodiment of this application;

[0020] Figure 3 This is a schematic diagram of the structure of an image acquisition device according to an embodiment of this application. Detailed Implementation

[0021] As described in the background section, there is an urgent need for an image acquisition method that can quickly acquire high-quality images after startup.

[0022] Existing image acquisition methods typically rely on automatic exposure algorithms. However, these algorithms require a certain amount of time to converge, and images acquired before convergence are usually dark and of poor quality. To address this issue, existing solutions employ frame skipping. However, frame skipping usually results in the loss of information from the first frame, increasing not only unnecessary computation but also the amount of data transfer between lower and upper layers.

[0023] Taking a scanning pen as an example, as a portable scanner, it not only requires accurate and fast scanning but also clear image quality. When a user scans with a scanning pen, it uses automatic exposure for image acquisition. However, when the user first turns on the pen and presses the tip to scan, automatic exposure results in the first few frames being dark, and the image quality is far from meeting the user's requirements. The current mainstream solution is to use frame skipping, which leads to the loss of information from the first frame, hindering subsequent optical character recognition algorithms and reducing the accuracy of subsequent scanning. It also increases the amount of computation and data transmission, resulting in a longer overall startup time for the scanning pen.

[0024] In view of this, this application provides an image acquisition method. In this embodiment, a start signal is obtained; in response to the start signal, an image is acquired; wherein, before the number of acquired image frames reaches a threshold, the exposure value used for acquiring each frame is a first exposure value; after the number of acquired image frames reaches the threshold, the exposure value used for acquiring each frame is calculated by an automatic exposure algorithm. Using the above scheme, after startup, images are first acquired with a fixed exposure (i.e., the first exposure value) to avoid underexposure caused by automatic exposure after startup; after the number of acquired image frames reaches the threshold, the method is adjusted to automatic exposure to avoid overexposure. Compared to existing schemes that only use automatic exposure for image acquisition, the above scheme combines fixed and automatic exposure, eliminating the need for frame skipping and enabling the rapid acquisition of high-quality images after device startup.

[0025] To make the above-mentioned objectives, features and beneficial effects of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0026] Reference Figure 1 , Figure 1 This is a flowchart illustrating an image acquisition method according to an embodiment of this application. The method can be executed by a terminal, which can be any existing terminal device with image acquisition capabilities, such as a mobile phone, computer, IoT device, scanning device, etc., but is not limited thereto. Figure 1 The image acquisition method shown may include the following steps:

[0027] Step S11: Obtain the start signal;

[0028] Step S12: In response to the start signal, an image is acquired, wherein before the number of frames acquired reaches a quantity threshold, the exposure value used to acquire each frame of the image is the first exposure value, and after the number of frames acquired reaches the quantity threshold, the exposure value used to acquire each frame of the image is calculated by an automatic exposure algorithm.

[0029] It is understood that, in specific implementations, the method can be implemented using a software program that runs in a processor integrated within the chip or chip module; or, the method can be implemented using hardware or a combination of hardware and software.

[0030] In the specific implementation of step S11, the acquired start signal can be a signal that triggers continuous image acquisition. The start signal can be issued by the user, for example, a start signal issued by the user clicking the shooting control on the terminal.

[0031] As a non-limiting example, the terminal may be a scanning device, and the activation signal may be a signal that triggers the terminal to perform a scan.

[0032] In the specific implementation of step S12, image acquisition begins in response to the acquired start signal. In the scheme of this application embodiment, image acquisition refers to the camera taking pictures to capture images.

[0033] Specifically, after receiving the start signal, an image can be acquired using a first exposure value, which can be a preset exposure value. In practical applications, the first exposure value can be an exposure value determined through multiple adjustments to obtain acceptable image quality in environments with varying brightness.

[0034] Furthermore, when the number of frames captured at the first exposure value reaches a certain threshold, subsequent frames can be captured using automatic exposure. Specifically, assuming the threshold is N, frames 1 to N can be captured at the first exposure value. Then, starting from frame N+1, the exposure value of each frame is calculated using an automatic exposure algorithm, and the calculated exposure value is used to capture the image. Here, N is a positive integer greater than 1.

[0035] It should be noted that the automatic exposure algorithm in this application embodiment can be any existing appropriate automatic exposure algorithm, such as the mean method, the mean method improved by histogram, the N-segment statistical method, etc., and this embodiment does not limit it.

[0036] In practice, the quantity threshold can be preset, or it can be calculated.

[0037] In a non-restrictive example, the quantity threshold can be calculated from the preview image by a pre-trained threshold calculation model.

[0038] Specifically, the preview image can be captured before the start signal is received. The preview image refers to the image captured before the camera performs the shooting action. For example, the terminal's camera can capture preview images at preset time intervals. After the start signal is received, the latest preview image can be selected and input into the threshold calculation model to obtain the quantity threshold output by the threshold calculation model.

[0039] The training process of the threshold calculation model is described in detail below.

[0040] In practice, multiple sample images can be acquired. These multiple sample images are acquired in response to the terminal's activation signal, and the exposure values ​​used to acquire each sample image are calculated by an automatic exposure algorithm. In other words, the multiple sample images are a series of consecutive images acquired based on an automatic exposure algorithm after the activation signal is received.

[0041] Furthermore, a reference image can be determined from the multi-frame sample images, and its sequence number within the multi-frame sample images can be used as label data. Since the multi-frame sample images are acquired based on the automatic exposure algorithm after the start signal is received, the first few frames in the multi-frame sample images may be slightly dark. Therefore, the reference image refers to the first frame in the multi-frame sample images whose image quality meets the preset quality standard. In other words, the reference image can refer to the sample image acquired when the automatic exposure algorithm converges.

[0042] Furthermore, the first frame image and label data from multiple sample images can be input into a pre-set model for training until the model converges, thus obtaining the threshold calculation model. In specific implementations, gradient descent can be used for training.

[0043] In another non-limiting example, the terminal may also be equipped with a light sensor that can detect the light intensity of the environment in which the terminal is located. Furthermore, a pre-configured set of exposure values ​​is provided, including multiple exposure values, each with a corresponding light intensity range. After receiving a start signal but before image acquisition, a first exposure value can be selected from the multiple exposure values ​​based on the latest ambient light intensity detected by the light sensor and the light intensity range corresponding to each exposure value. This approach allows for the rapid selection of a more suitable exposure value for image acquisition while maintaining a fixed exposure value.

[0044] Reference Figure 2 , Figure 2 This is a flowchart illustrating another image acquisition method in an embodiment of this application. Figure 2 The method shown can be performed by a scanning pen, which is a portable scanner that can have functions such as machine translation. Figure 2 The method shown may include steps S21 to S29.

[0045] Step S21: Power on the scanning pen.

[0046] Step S22, camera initialization.

[0047] In practice, after the scanning pen is powered on, the user can press the pen tip to trigger the camera and scan paper text. When the user presses the pen tip, a start signal is detected. After receiving the start signal, the camera can be initialized.

[0048] Specifically, camera initialization may include image signal processing (ISP) chip initialization, sensor power-on, and register read / write operations.

[0049] Step S23: Query the camera capabilities and set the image format and frame rate for image acquisition.

[0050] Specifically, querying camera capabilities can include checking if the ISP supports image capture or has the capability to stream images. If the query indicates support for image capture and streaming, the image format and frame rate can be further configured. The image format and frame rate can be pre-configured. If the query indicates that image capture or streaming is not supported, a notification can be sent to the user informing them of a malfunction in the barcode scanner.

[0051] Step S24: Set a fixed exposure value.

[0052] Among them, the fixed exposure value can refer to the first exposure value mentioned above.

[0053] Step S25: Start the image data stream.

[0054] Specifically, on the one hand, the camera takes pictures with the fixed exposure value set in step S24, and on the other hand, it can apply for a cache address for each frame image. Then, by starting the image data stream, the image data collected at the lower level is filled into the cache address, and the cache address is set to the lower level to realize frame output.

[0055] Step S26: Determine whether the number of image frames has reached the quantity threshold.

[0056] If the number of image frames reaches the quantity threshold, proceed to step S27; otherwise, proceed to step S28.

[0057] Step S27: Set the automatic exposure value.

[0058] Specifically, the automatic exposure value can be calculated using a pre-set automatic exposure algorithm.

[0059] Step S28: Receive frames and transmit images to the text recognition unit.

[0060] Specifically, it performs frame receiving operations to obtain the captured images from the underlying layer.

[0061] In practice, the scanning pen can be equipped with a text recognition unit. After acquiring an image, the image can be transmitted to the text recognition unit for text recognition. More specifically, an optical character recognition algorithm can be used for parsing to obtain the recognition result.

[0062] In addition, the scanning pen can also be equipped with a display unit, which can transmit images obtained from the underlying layer to the display unit for display.

[0063] Furthermore, the recognition results can be sent to the server so that the server can translate the recognition results, and then the translation results can be received from the server, thereby achieving automatic translation during the scanning process.

[0064] Step S29: Receive the end signal, and in response to the end signal, stop the image data stream and turn off the camera.

[0065] Specifically, when the system detects that the user has lifted the pen tip, it can determine that an end signal has been received. In response to the received end signal, the image data stream is stopped and the camera is turned off.

[0066] The above text is Figure 2 The methods shown and Figure 1 The differences between the methods shown are described, regarding Figure 2 For more details, please refer to [link / reference]. Figure 1 The relevant descriptions will not be repeated here.

[0067] Therefore, this application provides an image acquisition method that combines fixed exposure and automatic exposure. In the initial stage of acquisition, images are acquired using a preset fixed exposure value, bypassing the convergence time of the automatic exposure algorithm and enabling the rapid acquisition of high-quality images after startup. Once a threshold number of images has been acquired, automatic exposure is switched to avoid overexposure when using the fixed exposure value, ensuring the quality of subsequently acquired images. This scheme consistently acquires high-quality images after startup and eliminates the need for frame skipping. This approach not only ensures the accuracy of the scan by acquiring the first frame information but also avoids unnecessary computation and data transmission, further accelerating scanning and recognition.

[0068] Reference Figure 3 , Figure 3 This is a schematic diagram of the structure of an image acquisition device according to an embodiment of this application. Figure 3 The apparatus shown may include:

[0069] Acquisition module 31 is used to acquire the start signal;

[0070] Acquisition module 32 is used to acquire images in response to the start signal;

[0071] Before the number of frames acquired reaches the threshold, the exposure value used to acquire each frame is the first exposure value. After the number of frames acquired reaches the threshold, the exposure value used to acquire each frame is calculated by an automatic exposure algorithm.

[0072] For more information on the working principle, working method, and beneficial effects of the image acquisition device in the embodiments of this application, please refer to the relevant description of the image acquisition method above, which will not be repeated here.

[0073] This application also provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it performs the steps of the image acquisition method described above. The storage medium may include ROM, RAM, a magnetic disk, or an optical disk, etc. The storage medium may also include non-volatile memory or non-transitory memory, etc.

[0074] This application also provides a terminal, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor runs the computer program, it performs the steps of the image acquisition method described above. The terminal includes, but is not limited to, terminal devices such as mobile phones, computers, and tablet computers.

[0075] It should be understood that in the embodiments of this application, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0076] It should also be understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0077] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer program can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means.

[0078] In the several embodiments provided in this application, it should be understood that the disclosed methods, apparatus, and systems can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0079] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can be physically included separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or in a combination of hardware and software functional units. For example, for various devices or products applied to or integrated into a chip, each module / unit can be implemented using hardware such as circuits, or at least some modules / units can be implemented using software programs running on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware such as circuits; for various devices or products applied to or integrated into a chip module, each module / unit can be implemented using hardware such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.

[0080] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article indicates that the preceding and following related objects have an "or" relationship.

[0081] In this application's embodiments, "multiple" refers to two or more. The descriptions of "first," "second," etc., appearing in this application's embodiments are merely illustrative and for distinguishing the described objects; they do not indicate any order and do not imply a specific limitation on the number of devices in this application's embodiments, nor do they constitute any limitation on the embodiments of this application. Although this application discloses the above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of this application; therefore, the scope of protection of this application should be determined by the scope defined in the claims.

[0082] While this application discloses the above information, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of this application; therefore, the scope of protection of this application shall be determined by the scope defined in the claims.

Claims

1. An image acquisition method, characterized in that, include: Get the start signal; In response to the activation signal, an image is acquired; Before the number of frames of the acquired images reaches the quantity threshold, the exposure value used to acquire each frame of the image is the first exposure value. After the number of frames of the acquired images reaches the quantity threshold, the exposure value used to acquire each frame of the image is calculated by the automatic exposure algorithm. Before acquiring the image, the process also includes: acquiring a preview image; inputting the preview image into a pre-trained threshold calculation model to obtain the quantity threshold output by the threshold calculation model.

2. The image acquisition method according to claim 1, characterized in that, The training method for the threshold calculation model includes: Acquire multiple sample images, wherein the multiple sample images are acquired in response to a device start signal, and the exposure values ​​used to acquire the multiple sample images are calculated by the automatic exposure algorithm; A reference image is determined in the multi-frame sample images, and the sequence number of the reference image in the multi-frame sample images is used as label data. The reference image refers to the first frame image in the multi-frame sample images whose image quality reaches a preset quality standard. The first frame image and the label data from the multi-frame sample images are input into a preset model for training until the model converges.

3. The image acquisition method according to claim 1, characterized in that, Before acquiring images, the following steps are also included: Acquire the ambient light intensity collected by the light sensor and the preset exposure value set; Based on the ambient light intensity, the first exposure value is selected from the set of exposure values.

4. The image acquisition method according to claim 1, characterized in that, Also includes: The acquired images are subjected to text recognition to obtain the recognition results. The identification result is sent to the server so that the server can translate the identification result; Receive translation results from the server.

5. The image acquisition method according to claim 1, characterized in that, Before acquiring images, the method further includes: Set the image format and the frame rate for capturing the image.

6. An image acquisition device, characterized in that, include: The acquisition module is used to acquire the start signal; The acquisition module is used to acquire images in response to the start signal; Specifically, before the number of frames of the acquired images reaches the quantity threshold, the exposure value used to acquire each frame of the image is the first exposure value. After the number of frames of the acquired images reaches the quantity threshold, the exposure value used to acquire each frame of the image is calculated by an automatic exposure algorithm. Before acquiring the images, the method also includes: acquiring a preview image; inputting the preview image into a pre-trained threshold calculation model to obtain the quantity threshold output by the threshold calculation model.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is run by the processor, it performs the steps of the image acquisition method according to any one of claims 1 to 5.

8. A terminal comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor runs the computer program, it performs the steps of the image acquisition method according to any one of claims 1 to 5.

9. The terminal according to claim 8, characterized in that, The terminal is a scanning device.