Image data reading system of image sensor and method for reading and organizing
Technical Field
The invention relates to an image data reading system of an image sensor, and also relates to a method for reading and organizing the image data of the image sensor, belonging to the technical field of the image sensor.
Background
The image sensor is a photoelectric imaging device widely applied to machine vision, target reconnaissance, security monitoring and medical detection, and has the advantages of low cost and high integration level, and the image sensor chip can integrate more camera system functions, so that peripheral circuits of a camera are reduced, and the miniaturization of the camera volume and functional diversification are realized.
In target reconnaissance, in order to realize rapid imaging and monitoring tracking of key targets, a camera firstly performs a sub-sampling mode, enters a windowing scanning tracking mode after the targets are found, scans only row and column pixels in a set region in a pixel array, and captures an accurate image of the target object.
With the development of technology, the number of pixels contained in the image sensor can reach tens of millions of pixels and X hundred million pixels, when the image sensor with such large pixels is applied to object detection, the window position needs to be quickly and dynamically adjusted according to the change of the object position, the object is captured, and sometimes a plurality of objects need to be captured, at this time, a plurality of column pixels in a selected range need to be dynamically obtained in each frame of image, but at present, a dynamic windowing solution for the image sensor with high frame rate X hundred million pixels is not needed, and when the existing method is applied to the image sensor with high frame rate X hundred million pixels, if the column pixel data is intercepted in parallel, the circuit scale is increased, the wiring resource at the rear end is tensed, and if the column pixel data is intercepted in series, the frame rate is reduced, and the object cannot be dynamically tracked with high frame rate.
Disclosure of Invention
The primary object of the present invention is to overcome the problems of the prior art, and to provide an image data reading system of an image sensor, which can reduce the circuit scale, alleviate the pressure of a back-end engineer, and can be compatible with full-pixel, sub-sampling and dynamic windowing reading.
In order to solve the above problems, the present invention provides an image data reading system of an image sensor, including a pixel array, a pixel array control unit, a system control module, a mask generating module and a data reorganizing module, where the pixel array control unit includes a column address control module, a row address control module and a pixel data reading module; the system control module receives an instruction through an SPI port, the output end of the system control module is connected with the input end of the pixel array control unit, the output end of the column address control module is connected with a column selection circuit in the pixel array, the output end of the row address control module is connected with a row selection circuit in the pixel array, and the pixel data in the pixel array is connected with the input end of the data reorganization module through the pixel data reading module; the output end of the system control module is connected with the input end of the data reorganization module through the mask generating module, and the data reorganization module outputs reorganized data through an interface.
The beneficial effects of the invention are as follows: 1. column pixel ranges that can be read for high frequency switching from frame to frame of an image;
2. The image is divided into n parts for parallel processing, so that the circuit scale is reduced, the space of the rear-end wiring is reduced, and the pressure of the rear-end wiring is lightened;
3. And the method is compatible with full-pixel, multi-sampling and dynamic windowing reading.
Another object of the present invention is to overcome the problems of the prior art, and to provide a method for reading and organizing image data of an image sensor, which can reduce the circuit scale, alleviate the pressure of a back-end engineer, and can be compatible with full-pixel, sub-sampling and dynamic windowing reading.
In order to solve the above problems, the present invention further provides a method for reading and organizing image data of an image sensor, which sequentially includes the following steps:
Step 1: updating at the beginning of each frame to obtain a pixel mask M, wherein each bit of the pixel mask corresponds to one pixel data in one row, the pixel mask is averagely divided into n parts according to requirements, each part is provided with M/n bit pixel masks, and n is an integer larger than 1;
Step 2: waiting for one line of exposure to finish to obtain one line of pixel data D, mapping and dividing the pixel data D into n parts, and processing the n parts in the pixel data D in parallel with each other by the same flow corresponding to the pixel mask in the step 1;
step 3: selecting a buffer register R capable of accommodating a plurality of pixels as a buffer for each part of the divided pixel data;
step 4: judging whether the pixel mask value is 1, if the pixel mask value is 0, discarding the pixel data corresponding to the pixel mask value; if the pixel mask value is 1, entering step 5;
Step 5: putting the pixel data corresponding to the pixel mask value in the step 4 into a buffer register R, and splicing the effective pixel data;
step 6: judging whether the buffer register R is full, if not, continuing to process the next pixel data; if the buffer register R is full, namely when the pixel data are spliced to be of a fixed bit width, the spliced effective pixel data are written into a data queue;
when all the pixel data are processed, whether the buffer register is full or not, writing the spliced effective pixel data into a data queue;
step 7: when all the pixel data are processed, writing the pixel data of n parts into a data queue at the same time, and sequentially reading out the data;
Step 8: repeating the steps 2-7 until a frame is processed;
step 9: repeating steps 1-8 until the image stops exposing.
Further, the data queue is a fifo data queue.
The beneficial effects of the invention are as follows: 1. column pixel ranges that can be read for high frequency switching from frame to frame of an image;
2. The image is divided into n parts for parallel processing, so that the circuit scale is reduced, the space of the rear-end wiring is reduced, and the pressure of the rear-end wiring is lightened;
3. And the method is compatible with full-pixel, multi-sampling and dynamic windowing reading.
Drawings
FIG. 1 is a schematic diagram of an image data reading system of an image sensor according to the present invention;
FIG. 2 is a schematic diagram of the pixel data read, mask generation and buffer registers of FIG. 1;
FIG. 3 is a flow chart of a method of image data reading and organization of an image sensor;
Fig. 4 is a schematic diagram of the data processing end sequential output in the present invention.
Detailed Description
The invention will now be described in further detail with reference to the accompanying drawings. The drawings are simplified schematic representations which merely illustrate the basic structure of the invention and therefore show only the structures which are relevant to the invention.
As shown in fig. 1, the image data reading system of the image sensor of the present invention includes a pixel array, a pixel array control unit, a system control module, a mask generating module and a data reorganizing module, wherein the pixel array control unit includes a column address control module, a row address control module and a pixel data reading module; the system control module receives an instruction through an SPI port, the output end of the system control module is connected with the input end of the pixel array control unit, the output end of the column address control module is connected with a column selection circuit in the pixel array, the output end of the row address control module is connected with a row selection circuit in the pixel array, and pixel data in the pixel array is connected with the input end of the data reorganization module through the pixel data reading module; the output end of the system control module is connected with the input end of the data reorganization module through the mask generating module, and the data reorganization module outputs reorganized data through the interface.
An engineer sends an image processing instruction to a system control module through an SPI port, the system control module controls a mask generating module to generate a pixel mask, meanwhile, the system control module controls a column selection circuit of a pixel array through a column address control module in a pixel array control unit, controls a row selection circuit of the pixel array through a row address control module in the pixel array unit, and the column selection circuit receives the instruction issued by the column address control module, selects pixel data of a corresponding column address and outputs the pixel data; the row selection circuit receives an instruction issued by the row address control module, selects and outputs pixel data corresponding to a row address, reads the pixel data output by the pixel array through the pixel data reading module, and then recombines the pixel data with a pixel mask, and the recombined pixel data is output through an interface and is transmitted to an engineer for further processing.
As shown in fig. 2 to 4, the method for reading and organizing image data of an image sensor according to the present invention sequentially includes the following steps:
Step 1: updating at the beginning of each frame to obtain a pixel mask M, wherein each bit of the pixel mask corresponds to one pixel data in one row, the pixel mask is averagely divided into n parts according to requirements, each part is provided with M/n bit pixel masks, and n is an integer larger than 1;
Step 2: waiting for one line of exposure to finish to obtain one line of pixel data D, mapping and dividing the pixel data D into n parts, and processing the n parts in the pixel data D in parallel with each other by the same flow corresponding to the pixel mask in the step 1;
step 3: selecting a buffer register R capable of accommodating a plurality of pixels as a buffer for each part of the divided pixel data; as shown in fig. 2, when an image of 18 pixels in a row is processed, the pixel mask is divided into 2 parts equally, that is, each part has a 9bit pixel mask, a row of pixel data D is divided into 2 parts, each part selects one buffer register R, each buffer register R can hold 3 pixel data, and the pixel mask value is a binary value of 9' h 193;
step 4: judging whether the pixel mask value is 1, if the pixel mask value is 0, discarding the pixel data corresponding to the pixel mask value; if the pixel mask value is 1, entering step 5;
Step 5: putting the pixel data corresponding to the pixel mask value in the step 4 into a buffer register R, and splicing the effective pixel data;
step 6: judging whether the buffer register R is full, if not, continuing to process the next pixel data; if the buffer register R is full, namely when the pixel data are spliced to be of a fixed bit width, the spliced effective pixel data are written into a data queue;
when all the pixel data are processed, whether the buffer register is full or not, writing the spliced effective pixel data into a data queue;
Step 7: when all the pixel data are processed, writing the pixel data of n parts into a data queue at the same time, and sequentially reading out the data; as shown in fig. 4, if the mask value corresponding to the pixel data P0 is 1, the pixel data is put into the buffer register, if the mask value corresponding to the pixel data P3 is 0, the pixel data is discarded, when the buffer registers are filled with the pixel data P0, P1 and P4, the buffer registers are written into the fifo queue, the buffer registers are emptied, and when the buffer registers are put into the pixel data P7 and P8, the pixel data is processed completely although the buffer registers are not filled, the buffer registers at this time are written into the fifo queue, and when the first part works, the second part works in parallel according to the same flow;
Step 8: repeating the steps 2-7 until a frame is processed;
step 9: repeating steps 1-8 until the image stops exposing.
With the above-described preferred embodiments according to the present invention as an illustration, the above-described descriptions can be used by persons skilled in the relevant art to make various changes and modifications without departing from the scope of the technical idea of the present invention. The technical scope of the present invention is not limited to the description, but must be determined according to the scope of claims.