Image processing device, processor chip, electronic device
The hardware module realizes the detection of image grayscale value distribution, which solves the problems of long image processing time and large storage space in the prior art, and realizes efficient grayscale value distribution statistics and low storage space requirements.
Patent Information
- Application Number
- CN201980002899.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-04
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2039-11-04
AI Technical Summary
When performing grayscale distribution statistics on images, the prior art requires grayscale calculations for all pixel points on the image one by one, which consumes a lot of time and requires pre-stored images, occupying a high storage space.
The hardware module realizes the grayscale value distribution detection of the image, including the acquisition module, calculation module, buffer module and register module, the acquisition module collects pixel data, the calculation module calculates the grayscale value, the buffer module counts the count value, and the register module obtains the grayscale value. Value distribution enables real-time detection without pre-stored images, reduces storage space requirements, and improves processing efficiency through division of labor of multiple hardware modules.
It realizes efficient detection of image grayscale value distribution, reduces storage space requirements, and improves image processing efficiency through parallel operation.
Smart Images

Figure CN113168683B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing device, a processor chip, and an electronic device. Background Art
[0002] The pixel of an image refers to the smallest unit in the image. An image composed of pixels can be called a bitmap. The bitmap pixel format describes the format used to store pixel data. Common pixel data storage formats include 16-bit, 24-bit, and 32-bit. Take RGB888 as an example, where red, green, and blue each occupy 8 bits.
[0003] The pixel value of each pixel in the image is converted into a grayscale value to obtain a grayscale image with all RGB color components equal. A statistical analysis is performed on the grayscale value distribution of each pixel in the grayscale image to obtain the grayscale value distribution of the image. The grayscale value distribution can be used to adjust the image exposure parameters and has a wide range of uses in the fields of medicine and image recognition.
[0004] At present, various electronic devices can obtain images of objects through built-in image sensors. Common image sensors include 3D sensors and RGB sensors. For 3D sensors, they can sense infrared light, obtain single-channel infrared images, and then convert them into grayscale images; for RGB sensors, they can sense light from objects, obtain RGB three-color images, and can also be converted into grayscale images.
[0005] The inventors have found that the prior art has at least the following problems: when the processor performs grayscale value distribution statistics on an image, it is necessary to calculate the grayscale values of all pixels on the image one by one, and then perform histogram distribution statistics, which consumes a lot of time; at the same time, when performing grayscale value distribution statistics on an image, it is necessary to pre-store the image, which requires a high level of storage space. Summary of the invention
[0006] The purpose of some embodiments of the present application is to provide an image processing device, a processor chip, and an electronic device, which realize the detection of the grayscale value distribution of an image through a hardware module, without the need to pre-store an input image, thereby reducing the requirement for storage space; in addition, compared with using a processor to detect the grayscale value distribution of an image through a software algorithm, the detection of the grayscale value distribution is completed through the division of labor of multiple hardware modules, and the image processing efficiency is higher.
[0007] An embodiment of the present application provides an image processing device, characterized in that it includes: an acquisition module, a calculation module, a buffer module and a register module; the acquisition module is used to acquire pixel data of multiple pixel points on an input image; the calculation module is used to calculate the grayscale value of each pixel point according to the pixel data of the multiple pixel points; the buffer module includes multiple areas, each of which corresponds to a count value of the number of all pixel points within a predetermined grayscale value range; the calculation module is also used to count the count value of each area in the buffer module according to the grayscale values of the multiple pixel points; the register module is used to obtain the grayscale value distribution of the input image according to the count values of the multiple areas.
[0008] An embodiment of the present application also provides a processor chip, comprising the above-mentioned image processing device and a processor.
[0009] An embodiment of the present application also provides an electronic device, comprising the above-mentioned processor chip.
[0010] With respect to the prior art, the embodiment of the present application is that the acquisition module can acquire pixel data of multiple pixel points on the input image, and the calculation module can calculate the grayscale value of each pixel point respectively according to the pixel data of the multiple pixel points acquired by the acquisition module, and then adjust the count values of multiple areas in the buffer module according to the grayscale value of each pixel point. The count value of each area can represent the number of pixel points whose grayscale value is within the grayscale value range of the area. Therefore, the register module can obtain the grayscale value distribution of multiple pixel points in the image according to the count value of each area in the buffer module; the present invention realizes the detection of the grayscale value distribution of the image through the hardware module, without the need to pre-store the input image, thereby reducing the requirement for storage space; in addition, compared with using the processor to detect the grayscale value distribution of the image through software algorithm, the detection of the grayscale value distribution is completed by dividing the work of multiple hardware modules, and the image processing efficiency is higher.
[0011] For example, the buffer module includes: two buffers; each buffer is set with multiple areas; the calculation module is used to count the count values of each area in the buffer in the working state according to the grayscale values of multiple pixels; the buffer is used to switch from the working state to the disabled state when receiving the disable instruction sent by the processor to the buffer with counted values; the buffer is used to switch from the disabled state to the idle state when receiving the enable instruction sent by the processor to the buffer in the disabled state at the end of reading the grayscale value distribution; the buffer is used to switch from the idle state to the working state when receiving the switch instruction sent by the processor to the buffer in the idle state when sending the disable instruction to any buffer. In this embodiment, the parallel operation of the processor and the image processing device is realized through the ping-pong operation of the two buffers, thereby further improving the image processing efficiency.
[0012] For example, the acquisition module is used to acquire pixel data of multiple pixels on the input image input by the camera device. In this embodiment, the image processing device can directly process the original input image acquired by the camera device, thereby realizing real-time detection of the grayscale distribution of the input image.
[0013] For example, the acquisition module is used to acquire pixel data of multiple pixel points within a preset area on the input image. In this embodiment, the gray value distribution detection can be selectively performed on multiple pixel points within the preset area.
[0014] For example, the register module is preset with coordinate parameters of a preset area, and the coordinate parameters include a horizontal coordinate range and a vertical coordinate range of the preset area; the acquisition module is used to obtain the coordinate parameters of the preset area from the register module; the acquisition module is used to determine multiple pixel points in the preset area according to the coordinate parameters and the coordinates of the pixel points on the image, and to acquire pixel data of the multiple pixel points. This embodiment provides a specific implementation method for acquiring pixel data of multiple pixel points in a preset area on an input image.
[0015] For example, the calculation module is used to increase the count value of the area corresponding to the grayscale value range to which the grayscale value of the pixel belongs in a preset manner for each pixel. This embodiment provides a specific method for adjusting the count values of multiple areas in the buffer module according to the grayscale value of each pixel.
[0016] For example, the acquisition module is used to scan multiple pixel points on the input image according to rows or columns to obtain pixel data of the multiple pixel points.
[0017] For example, the span of the grayscale value range corresponding to each region is equal. In this embodiment, multiple grayscale values within the grayscale value range of each region are set to be continuous, which is convenient for the statistics of grayscale value distribution. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0019] Figure 1 is a schematic diagram of a processor chip including an image processing device according to a first embodiment of the present application;
[0020] Figure 2 is a schematic diagram of an image processing device according to a first embodiment of the present application;
[0021] Figure 3 is a schematic diagram of an image processing device according to a second embodiment of the present application;
[0022] Figure 4 is a schematic diagram of an image processing device according to a third embodiment of the present application. Specific embodiments
[0023] In order to make the purpose, technical solution and advantages of this application more clear, some embodiments of this application are further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain this application and are not used to limit this application.
[0024] The first embodiment of the present application relates to an image processing device, which is applied to a processor chip in an electronic device. Figure 1 The processor chip includes the image processing device 100 and a processor 200 connected to the image processing device. The image processing device 100 can perform grayscale value distribution statistics on the image, and the processor 200 can analyze the grayscale value distribution statistics to dynamically adjust parameters such as the exposure rate of the captured image.
[0025] Please refer to Figure 2 The image processing device 100 includes a collection module 1, a calculation module 2, a buffer module 3 and a register module 4 which are connected in sequence.
[0026] The acquisition module 1 is used to acquire pixel data of multiple pixels on the input image. Specifically, after the electronic device captures the initial image through a camera device (which can be an external camera device or a camera device in the electronic device), the initial image is converted into a bitmap, which is the input image, and then the pixels on the input image are output by row or column. The acquisition module 1 scans the multiple pixels on the image by row or column according to the configured scanning method, and obtains the pixel data of the multiple pixels, and the pixel data of the pixel is the RGB value of the pixel. In this article, the input image is the original image input by the camera device to the image processing device 100. If the camera device is a camera based on a 3D sensor, the input image is an infrared image; if the camera device is a camera based on an RGB sensor, the input image is an RGB image.
[0027] The calculation module 2 is used to calculate the grayscale value of each pixel point according to the pixel data of multiple pixels. Specifically, taking any pixel point as an example, R1, G1, and B1 are the RGB values of the pixel point, then the grayscale value of the pixel point Gray1=R1*0.299+G1*0.587+B1*0.114. It should be noted that this calculation formula is only an exemplary grayscale value calculation formula. If the pixel is not an RGB pixel, the grayscale value calculation method can be set according to the specific pixel type.
[0028] A plurality of regions are set in the buffer module 3, and each region corresponds to a count value of the number of pixels within a predetermined grayscale value range. The grayscale value range corresponding to each region is different, that is, there is no overlap in the grayscale value ranges corresponding to any two regions. In one example, the spans of the grayscale value ranges corresponding to each region are equal, that is, the grayscale value range corresponding to each region is set to include a plurality of continuous grayscale values. For example, the grayscale value range is 0 to 255, and each region can be set to span 4 grayscale values, so that 64 regions can be obtained, and the grayscale value ranges of the 64 regions are 0 to 3, 4 to 7, ..., 252 to 255, respectively.
[0029] The calculation module 2 is also used to count the count values of each area in the buffer module 3 according to the grayscale value of each pixel in the multiple pixels. Specifically, for each pixel, the calculation module 2 increases the count value of the area corresponding to the grayscale value range to which the grayscale value of the pixel belongs in a preset manner. For example, the initial value of the count value of each area is 0. For each pixel, after calculating the grayscale value of the pixel, the calculation module 2 obtains the grayscale value range to which the grayscale value belongs, and then adds 1 to the count value of the area corresponding to the grayscale value range. After traversing all the pixels, the final count value of each area can be obtained. For any area, the count value of the area can represent the number of pixels whose grayscale values are within the grayscale value range corresponding to the area.
[0030] The register module 4 is used to obtain the gray value distribution of multiple pixels in the image according to the count value of each area. Specifically, after the calculation module 2 adjusts the count value of each area in the buffer module 3 according to the gray value of each pixel, that is, after the calculation module 2 completes the gray value statistics of all pixels in the input image, it can adjust the value of the flag bit of the buffer module 3 to notify the buffer module 3 that the calculation of the entire image is completed, and the buffer module 3 sends a signal to the register module 4, and the register module 4 will copy the count value of each area in the buffer module 3, and then a histogram can be generated, which is the gray value distribution of multiple pixels in the image.
[0031] In this embodiment, since the image processing device can detect the input image in real time, there is no need to pre-store the input image. Therefore, the requirement for storage space is low. It is suitable for situations where the storage space is small in the embedded field and has a lower cost than increasing the storage space.
[0032] Compared with the prior art, the acquisition module of this embodiment can acquire pixel data of multiple pixel points on the input image, and the calculation module can calculate the grayscale value of each pixel point according to the pixel data of the multiple pixel points acquired by the acquisition module, and then adjust the count values of multiple areas in the buffer module according to the grayscale value of each pixel point. The count value of each area can represent the number of pixels whose grayscale value is within the grayscale value range of the area. Therefore, the register module can obtain the grayscale value distribution of multiple pixel points in the image according to the count value of each area in the buffer module; the present invention realizes the detection of the grayscale value distribution of the image through the hardware module, without the need to pre-store the input image, thereby reducing the requirement for storage space; in addition, compared with using the processor to detect the grayscale value distribution of the image through software algorithm, the grayscale value distribution detection is completed by multiple hardware modules, and the image processing efficiency is higher.
[0033] The second embodiment of the present application relates to an image processing device. This embodiment is an improvement on the first embodiment. The main improvement is that the image processing efficiency is further improved through a ping-pong operation of two buffers.
[0034] In this embodiment, the buffer module 3 includes two buffers, each buffer is set with multiple areas, and the setting method of the multiple areas in each buffer is similar to that in the first embodiment, which will not be repeated here.
[0035] In this embodiment, the calculation module 2 is used to count the count value of each area in the buffer in the working state according to the grayscale values of multiple pixels.
[0036] The buffer is used to switch from a working state to a disabled state when receiving a disable instruction sent by the processor 200 to the buffer having counted values. When the processor 200 reads the gray value distribution of the input image from the register module 4, the disable instruction is sent to the buffer having counted values, so that the buffer receiving the disable instruction switches from a working state to a disabled state.
[0037] The buffer is used to switch from a disabled state to an idle state when receiving an enable instruction sent by the processor 200 to the buffer in a disabled state at the end of reading the grayscale value distribution; wherein the processor 200 sends an enable instruction to the buffer in a disabled state at the end of reading the grayscale value distribution, so that the buffer that receives the enable instruction switches to the idle state.
[0038] The buffer is used to switch from an idle state to a working state when receiving a switching instruction sent by the processor 200 to the buffer in an idle state when the processor 200 sends a disable instruction to any buffer. The processor 200 sends a switching instruction to the buffer in an idle state when any buffer sends a disable instruction, so that the buffer in the idle state switches to the working state.
[0039] In this embodiment, please refer to Figure 3 , the two buffers are respectively recorded as buf_bank0 and buf_bank1. When the image processing starts, the two buffers buf_bank0 and buf_bank1 are both in an idle state. The processor 200 can control any buffer (taking buf_bank0 as an example) to switch to a working state. Each time the calculation module 2 calculates the gray value of a pixel, it adjusts the count value of the area in buf_bank0 according to the gray value until all the pixels in the entire image are calculated. Then the register module 4 will copy the count value of each area from the buffer module 3, and then a histogram can be generated, which is the gray value distribution of multiple pixels in the image. At the same time, the register module 4 sends a gray value representation to be read. The processor 200 sends an interrupt request for gray value distribution to the processor 200. After receiving the interrupt request, the processor 200 reads the gray value distribution from the register module 4 and disables buf_bank0. If there are multiple images that need to be tested for gray value distribution at this time, the processor 200 detects whether there are idle buffers in buf_bank0 and buf_bank1. At this time, buf_bank1 is in an idle state, and the processor 200 issues a switching command to control buf_bank1 to be in a working state, that is, buf_bank1 is enabled, so that buf_bank1 can be used to continue to detect the gray value distribution of the next image, that is, the parallel operation of the processor 200 and the image processing device is realized.
[0040] Compared with the first embodiment, this embodiment realizes the parallel operation of the processor and the image processing device through the ping-pong operation of two buffers, thereby further improving the image processing efficiency.
[0041] The third embodiment of the present application relates to an image processing device. This embodiment is an improvement on the first embodiment, and the main improvement is that it can selectively detect the gray value distribution of multiple pixel points in a preset area.
[0042] In this embodiment, the acquisition module 1 is used to acquire pixel data of a plurality of pixel points within a preset area on the input image.
[0043] For an example, see Figure 4The register module 4 is preset with coordinate parameters of the preset area, and the coordinate parameters include a horizontal coordinate range and a vertical coordinate range of the preset area. The coordinate parameters can be configured into the register module 4 by the processor 200.
[0044] The acquisition module 1 obtains the coordinate parameters of the preset area from the register module 4, thereby obtaining the horizontal coordinate range and the vertical coordinate range of the preset area, and then determines the multiple pixel points in the preset area according to the coordinate parameters and the coordinates of the pixel points on the input image. Take any pixel point as an example for explanation, the coordinates of the pixel point are (x1, y1), and the horizontal coordinate range of the preset area is (x min , x max ) and the vertical coordinate range of the preset area is (y min ,y max ), if x min ≤x1≤x max , and y min ≤y1≤y max , it means that the pixel point is within the preset area, and the above process is repeated to determine multiple pixel points within the preset area. After determining multiple pixel points within the preset area, the acquisition module 1 obtains pixel data of the multiple pixel points within the preset area according to the configured scanning method, and then can detect the grayscale value distribution of the multiple pixel points within the preset area.
[0045] Compared with the first embodiment, this embodiment can selectively detect the gray value distribution of multiple pixels in a preset area. It should be noted that this embodiment can also be used as an improvement on the second embodiment to achieve the same technical effect.
[0046] The fourth embodiment of the present application relates to a processor chip, please refer to Figure 1 The processor chip includes an image processing device 100 and a processor 200 connected to the image processing device. The image processing device 100 can perform grayscale value distribution statistics on an image, and the processor 200 can analyze the grayscale value distribution statistics to dynamically adjust parameters such as the exposure rate of the captured image. The image processing device 100 is the image processing device 100 in any one of the first to third embodiments.
[0047] A fifth embodiment of the present application relates to an electronic device, including the processor chip of the fourth embodiment.
[0048] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.
Claims
1. An image processing device, characterized in that: include: Acquisition module, calculation module, buffer module and register module; The acquisition module is used to acquire pixel data of multiple pixel points on the input image; The calculation module is used to calculate the grayscale value of each pixel point according to the pixel data of the multiple pixel points; The buffer module includes a plurality of regions, each of which corresponds to a count value of the number of all pixels within a predetermined grayscale value range; The calculation module is further used to count the count value of each of the areas in the buffer module according to the grayscale values of the multiple pixels; The register module is used to obtain the grayscale value distribution of the input image according to the count values of the multiple regions; The buffer module comprises: two buffer zones; each of the buffer zones is provided with the plurality of zones; The calculation module is used for counting the count value of each of the areas in the buffer in the working state according to the grayscale values of the multiple pixels; The buffer is used to switch from a working state to a disabled state when receiving a disable instruction sent by the processor to the buffer having the count value counted; The buffer is used to switch from a disabled state to an idle state when receiving an enable instruction sent by the processor to the buffer in a disabled state when reading the gray value distribution ends; The buffer is used to switch from an idle state to a working state when receiving a switching instruction sent by the processor to the buffer in an idle state when the processor sends the disable instruction to any of the buffers.
2. The image processing device according to claim 1, wherein: The acquisition module is used to acquire pixel data of a plurality of pixel points on the input image input by the camera device.
3. The image processing device according to claim 1, wherein: The register module is also used to issue an interrupt request representing the grayscale value distribution to be read to the processor after obtaining the grayscale value distribution of the multiple pixels in the image according to the count value of each of the regions, so that the processor can read the grayscale value distribution.
4. The image processing device according to claim 1, wherein: The acquisition module is used to acquire pixel data of a plurality of pixel points within a preset area on the input image.
5. The image processing device according to claim 4, characterized in that The register module is preset with coordinate parameters of the preset area, and the coordinate parameters include a horizontal coordinate range of the preset area and a vertical coordinate range of the preset area; The acquisition module is used to obtain the coordinate parameters of the preset area from the register module; The acquisition module is used to determine the multiple pixel points in the preset area according to the coordinate parameters and the coordinates of the pixel points on the image, and to acquire pixel data of the multiple pixel points.
6. The image processing device according to claim 1, wherein: The calculation module is used for increasing, for each pixel, the count value of the area corresponding to the grayscale value range to which the grayscale value of the pixel belongs in a preset manner.
7. The image processing device according to claim 1, wherein: The acquisition module is used to scan multiple pixel points on the input image according to rows or columns to obtain pixel data of the multiple pixel points.
8. The image processing device according to claim 1, wherein: The spans of the grayscale value ranges corresponding to the regions are equal.
9. A processor chip, characterized in that: An image processing device and a processor comprising any one of claims 1 to 8; The buffer module includes: two buffer zones; each of the buffer zones is provided with a plurality of zones; The processor is used for sending a disable instruction to the buffer having counted values when reading the gray value distribution of the input image from the register module, so that the buffer receiving the disable instruction switches from a working state to a disabled state; The processor is further configured to send an enable instruction to the buffer in a disabled state when reading the gray value distribution is finished, so that the buffer receiving the enable instruction switches to an idle state; The processor is further configured to send a switching instruction to the buffer in an idle state when any of the buffers sends the disabling instruction, so that the buffer in the idle state switches to a working state.
10. An electronic device, characterized in that: Comprising the processor chip described in claim 9.
