Method and apparatus for acquiring grayscale image, master device and storage medium

By acquiring image data in YUV format through the SPI interface of the main control device and using direct memory access for data transfer, the problem of being unable to acquire grayscale images was solved, enabling independent acquisition and classification of grayscale image data and improving the operating efficiency of the device.

CN116193046BActive Publication Date: 2026-08-25BEIJING TSINGTENG MICROSYSTEM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310191380.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-24
Publication Date
2026-08-25
Estimated Expiration
2043-02-24

AI Technical Summary

Technical Problem

When the interface of the master device is SPI, grayscale image data cannot be obtained directly, causing the kernel to be unable to respond to other operations during the process of obtaining grayscale image data.

Method used

By sending configuration commands to return image data in YUV format and using direct memory access to move the image data to a designated storage space, grayscale and color image data can be classified, avoiding kernel involvement.

Benefits of technology

Without relying on the main control device kernel, grayscale image data acquisition and color image data classification were achieved, improving the device's operating efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116193046B_ABST
    Figure CN116193046B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image acquisition, and discloses a method for acquiring a gray-scale image, which comprises the following steps: sending a configuration instruction to an image acquisition device, triggering the image acquisition device to feed back one frame of image data according to a configured output data format after feeding back one frame of synchronization signals every time; under the condition of receiving the synchronization signals fed back by the image acquisition device, alternately carrying each byte of data received to a first set storage space and a second set storage space by using a first direct memory access; and transmitting each byte of data in the first set storage space to a third set storage space according to the sequence of storing each byte of data in the first set storage space until the number of bytes of data in the third set storage space is equal to a set number. In this way, the color image data and the gray-scale image data can be classified without using the kernel of a host device. The application further discloses a device for acquiring a gray-scale image, a host device and a storage medium.
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, such as a method, apparatus, main control device, and storage medium for acquiring grayscale images. Background Technology

[0002] Currently, color image acquisition devices can generally only output color image information, which includes grayscale image data and color image data.

[0003] The main control device of an image recognition device typically uses an interface of MIPI (Mobile Industry Processor Interface), DVP (Digital Video Port), or SPI (Serial Peripheral Interface). Both MIPI and DVP interfaces have image data filtering capabilities. Therefore, when the main control device uses an MIPI or DVP interface, it can directly obtain grayscale image data using the image data filtering functions of these interfaces.

[0004] However, when the interface of the master device is SPI, the master device cannot directly obtain grayscale image data because SPI does not have an image data filtering function.

[0005] In the process of implementing the embodiments of this disclosure, at least the following problems were found in the related art:

[0006] Related technologies typically utilize SPI to receive color image information, while the host device's kernel processes and discards the received color image data to obtain grayscale image data. However, this requires the kernel to be involved in the entire grayscale image data acquisition process, preventing the kernel from responding to other operations during this process.

[0007] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0008] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.

[0009] This disclosure provides a method, apparatus, main control device, and storage medium for acquiring grayscale images, enabling the acquisition of grayscale images without using the kernel of the main control device.

[0010] In some embodiments, the method for acquiring a grayscale image is applied to a master control device, the master control device including a first direct memory access, the method including: sending a configuration command to an image acquisition device, triggering the image acquisition device to feed back a frame of image data according to a configured output data format after each frame of synchronization signal is fed back; wherein the configured output data format is YUV format; upon receiving the synchronization signal fed back by the image acquisition device, using the first direct memory access to alternately move each byte of data in the received image data to a first set storage space and a second set storage space; sequentially transferring each byte of data in the first set storage space to a third set storage space according to the order in which each byte of data is stored in the first set storage space, until the number of bytes of data in the third set storage space is equal to a set number; obtaining the image data to be decoded.

[0011] In some embodiments, the master control device includes a first serial peripheral interface (SPI1); before using a first direct memory access to alternately move each byte of data in the received image data to a first set storage space and a second set storage space, the device further includes enabling the SPI1 to receive image data fed back by the image acquisition device.

[0012] In some embodiments, the master control device includes a second serial peripheral interface SPI2 and a second direct memory access; the MOSI and MISO of the SPI2 are connected, and the first designated storage space is the transmit register of the SPI2; the byte data in the first designated storage space is sequentially transferred to the third designated storage space according to the order in which each byte data is stored in the first designated storage space, including: using the MOSI and the MISO to sequentially transfer each byte data in the first designated storage space to the receive register of the SPI2; triggering the second direct memory access to move the byte data in the receive register to the third designated storage space.

[0013] In some embodiments, triggering a second direct memory access to move byte data in the receive register to a third designated storage space includes: determining the storage address corresponding to the byte data in the receive register within the third designated storage space; and triggering the second direct memory access to move the byte data in the receive register to the corresponding storage address.

[0014] In some embodiments, determining the storage address corresponding to the byte data in the receive register within the third set storage space includes: determining the sum of the set initial address and the number of bytes already stored in the third set storage space as the storage address corresponding to the byte data in the receive register within the third set storage space.

[0015] In some embodiments, after obtaining the image data to be decoded, the method further includes: decoding the image data to be decoded to obtain decoded content.

[0016] In some embodiments, the apparatus for acquiring grayscale images is applied to a master control device, the master control device including a first direct memory access, the apparatus including: a sending module configured to send a configuration command to an image acquisition device, triggering the image acquisition device to feed back a frame of image data according to a configured output data format after each frame of synchronization signal is fed back; wherein the configured output data format is YUV format; a transport module configured to, upon receiving the synchronization signal fed back by the image acquisition device, alternately transport each byte of data in the received image data to a first predetermined storage space and a second predetermined storage space using the first direct memory access; a transmission module configured to sequentially transmit each byte of data in the first predetermined storage space to a third predetermined storage space according to the order in which each byte of data is stored in the first predetermined storage space, until the number of bytes of data in the third predetermined storage space equals a predetermined number; thereby obtaining the image data to be decoded.

[0017] In some embodiments, the master control device includes a processor and a memory storing program instructions, the processor being configured to execute the method described above for acquiring a grayscale image when running the program instructions.

[0018] In some embodiments, the storage medium stores program instructions that, when executed, perform the method described above for acquiring a grayscale image.

[0019] The method, apparatus, main control device, and storage medium for acquiring grayscale images provided in this disclosure can achieve the following technical effects: Since the image data returned by the image acquisition device is in YUV format, by alternately moving each byte of data in the received image data to a first designated storage space and a second designated storage space using a first direct memory access, the image data stored in the first designated storage space is all grayscale image data, and the image data stored in the second designated storage space is all color image data. Thus, the classification of color image data and grayscale image data can be achieved without utilizing the kernel of the main control device.

[0020] The above general description and the description below are exemplary and illustrative only and are not intended to limit this application. Attached Figure Description

[0021] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations and drawings do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are shown as similar elements. The drawings are not to be scaled. And wherein:

[0022] Figure 1 This is a schematic diagram of a method for acquiring a grayscale image provided in an embodiment of this disclosure;

[0023] Figure 2 This is a schematic diagram of another method for obtaining a grayscale image provided in an embodiment of this disclosure;

[0024] Figure 3 This is a schematic diagram of another method for obtaining a grayscale image provided in an embodiment of this disclosure;

[0025] Figure 4 This is a schematic diagram of a barcode reading device provided in an embodiment of this disclosure;

[0026] Figure 5 This is a schematic diagram of an apparatus for acquiring a grayscale image provided in an embodiment of this disclosure;

[0027] Figure 6 This is a schematic diagram of a master control device provided in an embodiment of this disclosure. Detailed Implementation

[0028] To provide a more detailed understanding of the features and technical content of the embodiments of this disclosure, the implementation of the embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of this disclosure. In the following technical description, for ease of explanation, several details are used to provide a full understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be simplified in their depiction to simplify the drawings.

[0029] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.

[0030] Unless otherwise stated, the term "multiple" means two or more.

[0031] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.

[0032] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.

[0033] The term "correspondence" can refer to an association or binding relationship. The correspondence between A and B means that there is an association or binding relationship between A and B.

[0034] Barcodes are increasingly widely used across various industries. Barcodes are divided into one-dimensional (1D) and two-dimensional (2D) barcodes. Barcode reading devices are used to acquire images of barcodes and decode the grayscale image data to obtain the decoded content. In this embodiment, both the main control device and the image acquisition device are located within the barcode reading device. The image acquisition device is used to scan the barcode to obtain its image data.

[0035] In some embodiments, the image acquisition device is a color camera.

[0036] Combination Figure 1 As shown, this disclosure provides a method for acquiring grayscale images, applied to a main control device. The main control device includes a first direct memory access method, the method comprising:

[0037] In step S101, the master control device sends a configuration command to the image acquisition device, triggering the image acquisition device to output one frame of image data according to the configured output data format after each frame of synchronization signal is fed back. The configured output data format is YUV format.

[0038] In step S102, when the main control device receives the synchronization signal from the image acquisition device, it uses the first direct memory access to alternately move each byte of data in the received image data to the first set storage space and the second set storage space.

[0039] In step S103, the main control device sequentially transmits each byte of data in the first set storage space to the third set storage space according to the order in which each byte of data is stored in the first set storage space, until the number of bytes of data in the third set storage space equals the set number, thereby obtaining the image data to be decoded.

[0040] The image acquisition method provided in this embodiment uses a YUV format output data device. Therefore, by alternately moving each byte of the received image data to a first and a second designated storage space using a first direct memory access (DMI), the image data stored in the first designated storage space is all grayscale image data, while the image data stored in the second designated storage space is all color image data. This allows for the classification of color and grayscale image data without utilizing the kernel of the main control device. Simultaneously, the byte data in the first designated storage space is transferred to a third designated storage space according to the order in which they are stored. When the number of bytes in the third designated storage space equals a predetermined number, the image data to be decoded, i.e., all grayscale image data in that frame of image data, can be obtained.

[0041] Furthermore, the configured output data format is YUV4:2:2 or YCrCb4:2:2. Here, Y represents luminance, i.e., grayscale value. U and V both represent chrominance, describing image color and saturation, used to specify the color of pixels. Cr reflects the difference between the red portion of the RGB input signal and the luminance value of the RGB signal. Cb reflects the difference between the blue portion of the RGB input signal and the luminance value of the RGB signal.

[0042] In some embodiments, a frame of image data output by the image acquisition device is Y0V0Y1U1Y2V2Y3U3Y4V4……Y n V n Furthermore, the image data output by the image acquisition device for one frame includes a preset number of bytes. Further, the preset number is equal to half of the preset number. Since the number of bytes in one frame of image data returned by the image acquisition device is always the preset number, and the bytes of color image data and grayscale image data each account for half, it can be determined that the grayscale image data has been completely received when the number of bytes in the third preset storage space equals the preset number. In some embodiments, the 300,000-pixel image acquisition device outputs a total of 600KB of byte data in YUV 4:2:2 output format, of which grayscale image data occupies 300KB and color image data occupies 300KB.

[0043] Optionally, the master control device includes a two-wire synchronous serial bus I2C. The master control device sends configuration commands to the image acquisition device, including: the master control device sends configuration commands to the image acquisition device via I2C.

[0044] In some embodiments, DMA (Direct Memory Access) comprises multiple channels, each independently performing data transfer operations. Data transfer within a DMA channel can be controlled by defining Linked List Items (LLIs). An LLI is a series of linked lists, with each LLI controlling the transfer of a data block. Each LLI defines control information such as the source address, destination address, transfer quantity, and the address of the next LLI to be stored. After completing one LLI, a DMA channel can optionally load another LLI to continue the DMA operation for that channel, or stop the DMA operation for that channel altogether.

[0045] In some embodiments, the barcode reading device further includes a supplementary light. Before sending configuration instructions to the image acquisition device, the main control device further includes sending a start signal to the supplementary light to trigger it to turn on, thereby providing supplementary illumination for the barcode. This enables the image acquisition device to obtain clear barcode image data.

[0046] Optionally, the master control device includes a first serial peripheral interface (SPI1); before using the first direct memory access to alternately move each byte of data in the received image data to the first and second designated storage spaces, it further includes enabling SPI1 to receive image data fed back by the image acquisition device. The SPI1 operates in slave mode.

[0047] In some embodiments, the master device includes a first port GPIO1 (General-purpose input / output), a second port GPIO2, a third port GPIO3, and a fourth port GPIO4. The master device controls the power-on timing of the image acquisition device through GPIO1 and GPIO2. The master device receives the synchronization signal fed back by the image acquisition device through GPIO3. The enable pin CS1 of SPI1 is connected to GPIO4 of the master device. The master device enables SPI1 through GPIO4.

[0048] Optionally, the image acquisition device includes a synchronous clock PCLK (Peripheral Bus Clock) and data output lines D0, D1, D2, and D3. The image acquisition device outputs image data through PCLK, D0, D1, D2, and D3. Further, the clock line SCK1 (Serial Clock) and data output lines D'0, D'1, D'2, and D'3 of SPI1 are respectively connected to the clock output PCLK and data output lines D0, D1, D2, and D3 of the image acquisition device.

[0049] Optionally, the master control device includes a second serial peripheral interface SPI2 and a second direct memory access (DMI). The MOSI (Master Output Slave Input) and MISO (Master Input Slave Output) of SPI2 are connected. The first designated storage space is the transmit register of SPI2. The data is sequentially transferred from the first designated storage space to the third designated storage space according to the order in which each byte of data is stored. This includes: using MOSI and MISO to sequentially transfer each byte of data from the first designated storage space to the receive register of SPI2; triggering the second DMI to move the byte data in the receive register to the third designated storage space. Here, SPI2 is single-wire and in master mode. Thus, whenever there is a byte of data in the receive register of SPI2, the second DMI moves the byte data in the receive register to the third designated storage space. This allows the byte data in the grayscale image data to be stored in the third designated storage space according to its order in the image data.

[0050] Furthermore, the data of each byte in the first set storage space is transmitted to the receive register of SPI2 using MOSI and MISO, including: outputting each byte of data in the first set storage space to MISO through MOSI, and then inputting each byte of data into the receive register of SPI2 through MISO.

[0051] In some embodiments, the master control device includes a first designated random access memory (RAM1) and a second designated random access memory (RAM2). The second designated storage space is RAM1. The third designated storage space is RAM2.

[0052] Optionally, triggering a second direct memory access to move the byte data in the receive register to a third designated storage space includes: determining the storage address corresponding to the byte data in the receive register within the third designated storage space; and triggering a second direct memory access to move the byte data in the receive register to the corresponding storage address.

[0053] Combination Figure 2 As shown, this disclosure provides a method for acquiring grayscale images, applied to a master control device. The master control device includes a first direct memory access (DMI), a second direct memory access (DMI), and an SPI2, wherein the MOSI of the SPI2 is connected to the MISO. The method includes:

[0054] In step S201, the master control device sends a configuration command to the image acquisition device, triggering the image acquisition device to output one frame of image data according to the configured output data format after each frame of synchronization signal is fed back. The configured output data format is YUV format.

[0055] In step S202, upon receiving a synchronization signal from the image acquisition device, the main control device uses the first direct memory access to alternately move each byte of data in the received image data to the first set storage space and the second set storage space.

[0056] In step S203, the master device uses MOSI and MISO to sequentially transmit each byte of data in the first set storage space to the receive register of SPI2.

[0057] In step S204, the master control device determines the storage address corresponding to the byte data in the receiving register in the third set storage space, triggers the second direct memory access to move the byte data in the receiving register to the corresponding storage address, until the number of byte data in the third set storage space is equal to the set number, and obtains the image data to be decoded.

[0058] The image acquisition method provided in this disclosure uses a YUV format output by the image acquisition device. Therefore, by alternately transferring each byte of the received image data to a first and a second designated storage space using a first direct memory access, the image data stored in the first designated storage space is all grayscale image data, while the image data stored in the second designated storage space is all color image data. This allows for the classification of color and grayscale image data without utilizing the kernel of the main control device. Furthermore, by transferring each byte of data from the first designated storage space to a third designated storage space, and ensuring that the number of bytes in the third designated storage space equals a predetermined number, the image data to be decoded—that is, all grayscale image data in the frame—can be obtained.

[0059] Optionally, determining the storage address of the byte data in the receive register within the third set storage space includes: determining the sum of the set initial address and the number of bytes already stored in the third set storage space as the storage address of the byte data in the receive register within the third set storage space.

[0060] Optionally, after obtaining the image data to be decoded, the method further includes: decoding the image data to be decoded to obtain the decoded content.

[0061] Combination Figure 3As shown, this disclosure provides a method for acquiring grayscale images, applied to a main control device. The main control device includes a first direct memory access method, the method comprising:

[0062] In step S301, the master control device sends a configuration command to the image acquisition device, triggering the image acquisition device to output one frame of image data according to the configured output data format after each frame of synchronization signal is fed back. The configured output data format is YUV format.

[0063] In step S302, upon receiving a synchronization signal from the image acquisition device, the main control device uses the first direct memory access to alternately move each byte of data in the received image data to the first set storage space and the second set storage space.

[0064] In step S303, the main control device sequentially transmits each byte of data in the first set storage space to the third set storage space according to the order in which each byte of data is stored in the first set storage space, until the number of bytes of data in the third set storage space equals the set number; thus obtaining the image data to be decoded.

[0065] Step S304: The main control device decodes the image data to be decoded to obtain the decoded content.

[0066] The image acquisition method provided in this embodiment uses a YUV format output data device. Therefore, by alternately transferring each byte of the received image data to a first and a second designated storage space using a first direct memory access (DMI), the image data stored in the first designated storage space is all grayscale image data, while the image data stored in the second designated storage space is all color image data. This allows for the classification of color and grayscale image data without utilizing the kernel of the main control device. Furthermore, by transferring each byte of data from the first designated storage space to a third designated storage space, and ensuring that the number of bytes in the third designated storage space equals a predetermined number, the image data to be decoded—that is, all grayscale image data in the frame—can be obtained.

[0067] In some embodiments, the master device includes a kernel (CORE), which decodes the image data to be decoded to obtain the decoded content.

[0068] Optionally, after obtaining the decoded content, the method further includes: sending the decoded content to the voice broadcasting device to trigger the voice broadcasting device to broadcast the decoded content.

[0069] The main control device also includes PWM (Pulse Width Modulation) or DAC (Digital-to-Analog Converter). The main control device sends the decoded content to the voice broadcasting device via PWM or DAC.

[0070] Furthermore, the voice broadcasting device includes a power amplifier and a speaker. The main control device sends the decoded content to the power amplifier via PWM or DAC, triggering the power amplifier to drive the speaker to broadcast the decoded content.

[0071] In some embodiments, combined with Figure 4 As shown, this embodiment of the present disclosure provides a barcode reading device 400, including a main control device 401, a fill light 402, a color camera 403, a power amplifier 404, and a speaker 405. The main control device 401 is configured to send a start signal to the fill light 402, triggering the fill light 402 to start. The main control device 401 is also configured to send a configuration command to the color camera 403, triggering the color camera to feed back one frame of image data according to the configured output data format after each frame of synchronization signal is fed back. Upon receiving the synchronization signal from the color camera 403, the device uses a first direct memory access method to alternately move each byte of data in the received image data to a first predetermined storage space and a second predetermined storage space. Following the order in which each byte of data is stored in the first predetermined storage space, the device sequentially transfers each byte of data in the first predetermined storage space to a third predetermined storage space until the number of bytes of data in the third predetermined storage space equals a predetermined number; thus obtaining the image data to be decoded. The image data to be decoded is then decoded to obtain the decoded content. The decoded content is then sent to the power amplifier 404, which triggers the power amplifier 404 to drive the speaker 405 to play the decoded content.

[0072] The barcode reading device provided in this embodiment utilizes a first direct memory access method to alternately transfer each byte of received image data to a first and a second predetermined storage space. This ensures that the image data stored in the first predetermined storage space is all grayscale image data, while the image data stored in the second predetermined storage space is all color image data. Therefore, it is possible to classify color image data and grayscale image data without utilizing the kernel of the main control device. Furthermore, by transferring each byte of data from the first predetermined storage space to a third predetermined storage space, and ensuring that the number of bytes in the third predetermined storage space equals a predetermined number, the image data to be decoded can be obtained, i.e., all grayscale image data in the frame can be obtained.

[0073] Combination Figure 5As shown, this disclosure provides an apparatus 500 for acquiring grayscale images, applied to a main control device. The apparatus includes a sending module 501, a transport module 502, and a transmission module 503. The sending module 501 is configured to send a configuration command to an image acquisition device, triggering the image acquisition device to return a frame of image data according to the configured output data format after each frame of synchronization signal is returned; wherein the configured output data format is YUV format. The transport module 502 is configured to, upon receiving the synchronization signal from the image acquisition device, alternately transport each byte of data in the received image data to a first predetermined storage space and a second predetermined storage space using a first direct memory access. The transmission module 503 is configured to sequentially transmit each byte of data in the first predetermined storage space to a third predetermined storage space according to the order in which the byte data was stored in the first predetermined storage space, until the number of bytes in the third predetermined storage space equals a predetermined number; thus obtaining the image data to be decoded.

[0074] The apparatus for acquiring grayscale images provided in this disclosure uses a YUV format output data device. Therefore, by alternately moving each byte of the received image data to a first and a second designated storage space using a first direct memory access, the image data stored in the first designated storage space is all grayscale image data, while the image data stored in the second designated storage space is all color image data. This allows for the classification of color image data and grayscale image data without utilizing the kernel of the main control device.

[0075] Optionally, the master control device includes a first serial peripheral interface SPI1; before using the first direct memory access to alternately move each byte of data in the received image data to the first set storage space and the second set storage space, it further includes: enabling SPI1 to receive image data fed back by the image acquisition device.

[0076] Optionally, the master control device includes a second serial peripheral interface SPI2 and a second direct memory access; the MOSI and MISO of SPI2 are connected, and the first set storage space is the transmit register of SPI2; the byte data in the first set storage space is sequentially transferred to the third set storage space according to the order in which each byte of data is stored in the first set storage space, including: using MOSI and MISO to sequentially transfer each byte of data in the first set storage space to the receive register of SPI2; triggering the second direct memory access to move the byte data in the receive register to the third set storage space.

[0077] Optionally, triggering a second direct memory access to move each byte of data in the receive register to a third designated storage space includes: determining the storage address corresponding to the byte data in the receive register within the third designated storage space, and triggering a second direct memory access to move the byte data in the receive register to the corresponding storage address.

[0078] Optionally, determining the storage address of the byte data in the receive register within the third set storage space includes: determining the sum of the set initial address and the number of bytes already stored in the third set storage space as the storage address of the byte data in the receive register within the third set storage space.

[0079] Optionally, the apparatus for acquiring a grayscale image further includes a decoding module configured to decode the image data to be decoded to obtain decoded content.

[0080] Combination Figure 6 As shown, this embodiment of the disclosure provides a master control device 600, including a processor 601 and a memory 602. Optionally, the device may further include a communication interface 603 and a bus 604. The processor 601, communication interface 603, and memory 602 can communicate with each other via the bus 604. The communication interface 603 can be used for information transmission. The processor 601 can call logical instructions in the memory 602 to execute the method for acquiring grayscale images described in the above embodiment.

[0081] By employing the main control device provided in this embodiment, and alternately moving each byte of received image data to a first and a second designated storage space using a first direct memory access, the image data stored in the first designated storage space is all grayscale image data, while the image data stored in the second designated storage space is all color image data. This allows for the classification of color image data and grayscale image data without utilizing the kernel of the main control device.

[0082] Furthermore, the logic instructions in the aforementioned memory 602 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0083] The memory 602, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 601 executes functional applications and data processing by running the program instructions / modules stored in the memory 602, that is, it implements the method for acquiring grayscale images in the above embodiments.

[0084] The memory 602 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 602 may include high-speed random access memory and may also include non-volatile memory.

[0085] This disclosure provides a storage medium storing program instructions that, when executed, perform the method described above for acquiring a grayscale image.

[0086] The aforementioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.

[0087] The technical solutions of this disclosure can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in this disclosure. The aforementioned storage medium can be a non-transitory storage medium, including: a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media capable of storing program code; it can also be a transient storage medium.

[0088] The foregoing description and accompanying drawings fully illustrate embodiments of this disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.

[0089] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0090] The methods and products (including but not limited to devices and equipment) disclosed in the embodiments herein can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed units may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms. The units described as separate components may or may not be physically separate. 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 may be selected to implement this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0091] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

Claims

1. A method for acquiring a grayscale image, characterized in that, It is applied to a master control device, which includes a first serial peripheral interface SPI1, a second serial peripheral interface SPI2, a first direct memory access and a second direct memory access; The SPI2's MOSI and MISO are connected, and the method includes: Enable the SPI1 to receive image data fed back by the image acquisition device; A configuration command is sent to the image acquisition device, triggering the image acquisition device to feed back one frame of image data according to the configured output data format after each frame of synchronization signal is fed back; wherein, the configured output data format is YUV format; Upon receiving a synchronization signal from the image acquisition device, the system uses SPI1 to receive image data from the image acquisition device and uses a first direct memory access to alternately move each byte of data in the received image data to a first set storage space and a second set storage space; wherein, the first set storage space is the transmit register of the SPI2; the image data stored in the first set storage space is all grayscale image data, and the image data stored in the second set storage space is all color image data; According to the order in which each byte of data is stored in the first set storage space, the byte of data in the first set storage space is sequentially transferred to the receive register of the SPI2 using the MOSI and the MISO; and the second direct memory access is triggered to move the byte data in the receive register to the third set storage space until the number of bytes in the third set storage space is equal to the set number; the image data to be decoded is obtained; wherein, the image data to be decoded is all the grayscale image data in the frame image data.

2. The method according to claim 1, characterized in that, Triggering a second direct memory access to move the byte data in the receive register to a third designated storage space includes: Determine the storage address corresponding to the byte data in the receive register within the third designated storage space; The second direct memory access is triggered to move the byte data in the receive register to the corresponding memory address.

3. The method according to claim 2, characterized in that, Determining the storage address of the byte data in the receive register within the third designated storage space includes: The sum of the initial address set and the number of bytes of data already stored in the third set storage space is determined as the storage address of the byte data in the receive register in the third set storage space.

4. The method according to claim 1, characterized in that, After obtaining the image data to be decoded, the following steps are also included: The image data to be decoded is decoded to obtain the decoded content.

5. An apparatus for acquiring a grayscale image, characterized in that, It is applied to a master control device, which includes a first serial peripheral interface SPI1, a second serial peripheral interface SPI2, a first direct memory access and a second direct memory access; The SPI2's MOSI is connected to the MISO, and the device includes: The transmitting module is configured to enable SPI1; send a configuration command to the image acquisition device, triggering the image acquisition device to feed back a frame of image data according to the configured output data format after each frame of synchronization signal is fed back; wherein, the configured output data format is YUV format; The transfer module is configured to, upon receiving a synchronization signal from the image acquisition device, use the SPI1 to receive image data from the image acquisition device, and use a first direct memory access to alternately transfer each byte of data in the received image data to a first set storage space and a second set storage space; wherein, the first set storage space is the transmit register of the SPI2; the image data stored in the first set storage space is all grayscale image data, and the image data stored in the second set storage space is all color image data; The transmission module is configured to sequentially transmit each byte of data in the first designated storage space to the receive register of the SPI2 using the MOSI and the MISO, according to the order in which each byte of data is stored in the first designated storage space; and trigger the second direct memory access to move the byte data in the receive register to the third designated storage space until the number of bytes of data in the third designated storage space equals the set number; and obtain the image data to be decoded; wherein, the image data to be decoded is all grayscale image data in the frame image data.

6. A master control device, comprising a processor and a memory storing program instructions, characterized in that, The processor is configured to, when executing the program instructions, perform the method for acquiring a grayscale image as described in any one of claims 1 to 4.

7. A storage medium storing program instructions, characterized in that, When the program instructions are executed, they perform the method for acquiring a grayscale image as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Image processing method and device, storage medium and electronic equipment

    CN110766621A

  • Method and system for video format transformation in a mobile terminal having a video display

    US20070188515A1