Background technology
Development along with digital technology, the application of various digitizing videos, camera installation also more and more widely, not only the Digital Video of family expenses, camera are popularized, the watch-dog that is applied in bank, crossing and building is also more and more universal, and the digital image that these equipment produced generally all needs processing such as compression, scaling, demonstration.
Fig. 1 is the structure chart of the image processing apparatus of prior art, as shown in the figure, comprising:
Imageing sensor 101: generally comprise two kinds of CCD (charge couple device, charge coupled device) and CMOS (complementary metal oxide semiconductor, complementary metal oxide semiconductors (CMOS)).Imageing sensor (also being sensor) is a kind of semiconductor chip, and its surface includes hundreds of thousands to millions of photodiodes.When photodiode is subjected to rayed, will produce electric charge.
Format converting module 102 is used for:
1) data type of the original image that collects according to " imageing sensor " is carried out corresponding format conversion;
2) if the form of original image directly is rgb (red, green, blue) form, then rgb directly is converted to yuv (y represents brightness, and u, v represent aberration) form;
3) if the form of original image is a raw data format, be converted to the rgb form earlier, be converted to the yuv form then;
4) rgb is converted to the formula of yuv, can use existing any one formula to change.
Image zoom module 103 is used for: according to actual needs image is carried out convergent-divergent;
Image display 104 is used for:
1) scaled images is shown;
2) generally have the memory space of a demonstration usefulness, the same with actual displayed screen size, scaled images, leave in this memory space, be used for demonstration.
Image compression module 105 is used for:
1) according to the image that transmits, compresses;
2) for example, yuv is to the compression of jpeg form; Eg.yuv422 is to the compression of jpeg;
Fig. 2 a is the IMAQ of prior art and the schematic diagram of compression, as shown in the figure, existing acquisition orders is: (for example size is 1600 * 1200 to whole two field picture, because the memory of memory image will be solidificated in the chip, so in the time of chip design, will decide maximum support width, for example 1600, surpass will not being supported of this width so), carry out from left to right, from top to bottom, the line acquisition transmission.Therefore, prior art is if compressed picture blocks 201 (for example size is 16 * 3), three line data that comprise current line that just must the whole two field picture of first buffer memory, and 3 row also are to give an example, also may not be 3 row (1600 * 3) in the algorithm that has, so its buffer memory that takies be very large.
In addition, IMAQ transmission also has other a lot of orders, and Fig. 2 b is the schematic diagram of multiple IMAQ mode, and these modes the present invention of Fig. 2 b is supported;
The buffer memory that adopts in compression process is generally SRAM (static RAM (SRAM)), and SRAM speed is very fast, be to have read and write the fastest memory device at present, but it is also very expensive, thus only requiring very harsh place to use, for example (,) the first-level buffer of CPU, level 2 buffering.And based on the conventional images acquisition orders, must store the row of whole two field picture in the compression process,, cause the hardware chip that compresses processing must be equipped with big SRAM so SRAM exists great waste, greatly increase the cost of hardware chip, reduced the competitiveness of image processing equipment.
Summary of the invention
The method and apparatus that the purpose of this invention is to provide a kind of IMAQ and processing reduces cost of image processing chips, increases processing speed.
To achieve these goals, on the one hand, provide the method for a kind of IMAQ and processing, having comprised:
Step 1, to original image from imageing sensor, with the image block is acquisition units, first predetermined arrangement according to pixel in image block is gathered in proper order, second predetermined arrangement according to image block in described original image is gathered in proper order, and obtaining with the image block is the image block data stream that unit is arranged according to the described second predetermined arrangement order linear;
Step 2 flows to the row format conversion to described image block data, obtains the image block data stream of predetermined format;
Step 3 to the image block data stream of described predetermined format, is that unit carries out buffer memory and processing with the image block.
Preferably, in the above-mentioned method, described predetermined format is rgb form or yuv format;
Specifically comprise in described step 3:
To the image block data stream of described predetermined format, be unit with the image block, carry out buffer memory and compression successively successively in proper order according to described second predetermined arrangement.
Preferably, in the above-mentioned method, specifically comprise in described step 3:
To the image block data stream of described predetermined format, be unit with the image block, carry out convergent-divergent successively in proper order according to described second predetermined arrangement, the scaled images blocks of data sends to image display successively according to described second predetermined arrangement order.
Preferably, in the above-mentioned method, described first predetermined arrangement according to pixel is gathered specifically in proper order and is comprised: in image block by row capture vegetarian refreshments, in every row from left to right, between each row from top to bottom; Perhaps, in image block, press row capture vegetarian refreshments, every row from top to bottom, each row between from left to right;
Preferably, in the above-mentioned method, described second predetermined arrangement according to image block is gathered specifically in proper order and is comprised: in described original image by the row get image block, in every row from left to right, each the row between from top to bottom; Perhaps, in described original image, get image block by row, every row from top to bottom, each row between from left to right.
Preferably, in the above-mentioned method, before described step 1, also comprise: by user interface the position and the size of described image block are set, described first predetermined arrangement order and described second predetermined arrangement are set in proper order.
Preferably, in the above-mentioned method, all images piece in the described original image is formed the target image in the described original image, and the area of described target image is less than the area of described original image; The width of described target image is the integral multiple of the width of described image block, and the height of described target image is the integral multiple of the height of described image block.
Another aspect of the present invention provides the device of a kind of IMAQ and processing, comprising:
Adopt several devices, be used for: to original image from imageing sensor, with the image block is acquisition units, first predetermined arrangement according to pixel in image block is gathered in proper order, second predetermined arrangement according to image block in described original image is gathered in proper order, and obtaining with the image block is the image block data stream that unit is arranged according to the described second predetermined arrangement order linear;
Format converting module is used for: described image block data is flow to the row format conversion, obtain the image block data stream of predetermined format;
Processing module is used for: to the image block data stream of described predetermined format, be that unit carries out buffer memory and processing with the image block.
Preferably, in the above-mentioned device, described processing module specifically comprises image compression module, image zoom module and image display:
Described image compression module is used for: to the image block data stream of described predetermined format, be unit with the image block, carry out buffer memory and compression successively in proper order according to described second predetermined arrangement;
Described image zoom module, be used for: to the image block data stream of described predetermined format, with the image block is unit, carries out convergent-divergent successively in proper order according to described second predetermined arrangement, and the scaled images blocks of data sends to image display successively according to described second predetermined arrangement order.
Described image display is used for: described scaled images piece is spliced in proper order according to described second predetermined arrangement and show.
Preferably, in the above-mentioned device, also comprise Subscriber Interface Module SIM, be used for: the position and the size of described image block are set, described first predetermined arrangement order and described second predetermined arrangement order are set; All images piece in the described original image is formed the target image in the described original image, and the area of described target image is less than the area of described original image; The width of described target image is the integral multiple of the width of described image block, and the height of described target image is the integral multiple of the height of described image block.
There is following technique effect at least in the present invention:
1) the present invention is to wanting the image transmitted data, and adopting with the image block is unit, in this image block, the image data order can for: with from left to right, gather from top to bottom; In whole frame original image, piece also with from left to right, is divided from top to bottom successively and transmitted.Owing to adopted the piece order to carry out the linearity transmission of data, and compression the time just in time will be that unit compresses with the piece, so saved a large amount of memory spaces that compressing image data needs, this is for the image compression chip that adopts expensive SRAM, when having saved huge carrying cost, because make things convenient for the addressing when compressing also to improve the processing speed of compression.;
2) carry out the linearity transmission of data with the piece order, also saved a large amount of memory spaces that when image amplifies and dwindles, need, saved chip cost greatly.
3) embodiment of the invention also can make target image less than original image by the size that piece is set, therefore the embodiment of the invention also has directly dig the function of gathering behind the frame from original image, this has just been avoided the unnecessary processing to some edge images, therefore be that unit carries out in the process of caching process with the piece, not only can avoid unnecessary buffer memory, can also directly avoid unnecessary collection and processing, when not increasing special treatment step, have extra effect edge image.
Embodiment
For the purpose, technical scheme and the advantage that make the embodiment of the invention is clearer, specific embodiment is described in detail below in conjunction with accompanying drawing.
The embodiment of the invention provides the method for a kind of IMAQ and processing, and the flow chart of steps of the method that Fig. 3 provides for the embodiment of the invention as shown in the figure, comprising:
Step 301, to original image from imageing sensor, with the image block is acquisition units, first predetermined arrangement according to pixel in image block is gathered in proper order, second predetermined arrangement according to image block in described original image is gathered in proper order, and obtaining with the image block is the image block data stream that unit is arranged according to the described second predetermined arrangement order linear;
Step 302 flows to row format conversion to described image block data, obtains the image block data stream of yuv format (rgb form also can);
Step 303 to the image block data stream of described yuv format, is that unit carries out buffer memory and processing with the image block.
Interim, comprise in step 303: to the image block data stream of described yuv format, be unit, carry out buffer memory and compression successively successively in proper order according to described second predetermined arrangement with the image block.Can also comprise: to the image block data stream of described yuv format, be unit with the image block, carry out convergent-divergent successively in proper order according to described second predetermined arrangement, the scaled images blocks of data sends to image display successively according to described second predetermined arrangement order.
Described first predetermined arrangement according to pixel is gathered specifically in proper order and is comprised: in image block by row capture vegetarian refreshments, in every row from left to right, from top to bottom order is gathered between each row; Perhaps, in image block, press row capture vegetarian refreshments, every row from top to bottom, from left to right order is gathered between each row; That is to say that first predetermined arrangement order can be to get by row, in the ranks from top to bottom, also can be to get by row, between row from left to right.Certainly, also can by the row get, in the ranks from top to bottom, perhaps get by row, between row from right to left, as long as meet certain queueing discipline.Equally, second predetermined arrangement order also is that above multiple mode is arranged, and the least member of only every row or every row is image blocks.
Before described step 301, also comprise: by user interface the position and the size of described image block are set, described first predetermined arrangement order and described second predetermined arrangement are set in proper order.All images piece in the described original image is formed the target image in the described original image, and the area of described target image is less than the area of described original image; The width of described target image is the integral multiple of the width of described image block, and the height of described target image is the integral multiple of the height of described image block.
The detail flowchart of the method that Fig. 4 provides for the embodiment of the invention as shown in the figure, comprising:
Step 401, the original position and the size of putting the target image that " adopting several devices " will transmit at " user interface " are provided with the size of transmission block (promptly as the image block that transmits and handle unit);
Step 402 starts image sensor module, obtains the size of " imageing sensor " original image;
Step 403 is the unit of gathering with the piece, and in this piece, the image data order is: with from left to right, gather from top to bottom;
Step 404, the data type that collects of acquisition " imageing sensor ";
Does step 405 judge that this data type is initial data or rgb data? if initial data execution in step 406, if rgb data execution in step 407;
Step 406 is converted to the rgb data to this initial data;
Step 407 is converted to the yuv data to these rgb data, execution in step 408 or execution in step 409;
Step 408, the image block according to transmitting compresses, execution in step 412;
Step 409 is carried out convergent-divergent with the ratio of piece to image earlier, then scaled images is exported;
Step 410 is carried out convergent-divergent to the 1st piece earlier and is transmitted, and then the 2nd piece carried out convergent-divergent and transmit, and the like;
Step 411 shows scaled images;
Step 412 finishes.
As seen, the embodiment of the invention can make target image less than original image by the size that piece is set, therefore the embodiment of the invention also has directly dig the function of gathering behind the frame from original image, this has just been avoided the unnecessary processing to some edge images, therefore be that unit carries out in the process of caching process with the piece, not only can avoid unnecessary buffer memory, can also directly avoid unnecessary collection and processing, have the effect of double gain edge image.
The embodiment of the invention also provides the device of a kind of IMAQ and processing, comprising:
Adopt several devices, be used for: to original image from imageing sensor, with the image block is acquisition units, first predetermined arrangement according to pixel in image block is gathered in proper order, second predetermined arrangement according to image block in described original image is gathered in proper order, and obtaining with the image block is the image block data stream that unit is arranged according to the described second predetermined arrangement order linear;
Format converting module is used for: described image block data is flow to the row format conversion, obtain the image block data stream of yuv format;
Processing module is used for: to the image block data stream of described yuv format, be that unit carries out buffer memory and processing with the image block.
Wherein, described processing module specifically comprises image compression module, image zoom module and image display: described image compression module, be used for: to the image block data stream of described yuv format, be unit, carry out buffer memory and compression successively in proper order according to described second predetermined arrangement with the image block; Described image zoom module, be used for: to the image block data stream of described yuv format, with the image block is unit, carries out convergent-divergent successively in proper order according to described second predetermined arrangement, and the scaled images blocks of data sends to image display successively according to described second predetermined arrangement order.Described image display is used for: described scaled images piece is spliced in proper order according to described second predetermined arrangement and show.
Device also comprises Subscriber Interface Module SIM, is used for: the position and the size of described image block are set, described first predetermined arrangement order and described second predetermined arrangement order are set; The width of described original image is the integral multiple of the width of described image block, and the height of described original image is the integral multiple of the height of described image block.
The detailed structure view of the device that Fig. 5 provides for the embodiment of the invention, as shown in the figure, comprise " Subscriber Interface Module SIM 501 ", " imageing sensor 502 ", " adopting several devices 503 ", " format converting module 504 ", " image zoom module 505 ", " image display 506 ", " image compression module 507 " seven parts.Each module is described in detail as follows:
Subscriber Interface Module SIM 501:
1) size of acquisition " imageing sensor " real image (original image): source width (original image width), source height (original image height);
2) original position and the size of the target image that " adopting several devices " will transmit are set: destinationposition x, destination position y, destination width, destination height; (just original image is dug and deceives the back collection)
3) size of the piece of the image that " adopting several devices " will transmit at every turn is set: block width, blockheight;
4) requirement for restriction, destination width (height) is the integral multiple of block width (height);
Imageing sensor 502:
1) comprises two kinds of ccd (charge coupled device) and cmos (complementary metal oxide semiconductors (CMOS));
2) imageing sensor is a kind of semiconductor chip, and its surface includes hundreds of thousands to millions of photodiodes.When photodiode is subjected to rayed, will produce electric charge.
3) imageing sensor also is sensor, is exemplified below:
A) MI360 of Micron Technology cmos image sensor, pixel are 651 * 487;
B) modern 7131E cmos image sensor, pixel is 648 * 488;
Adopt several devices 503:
1) destination position x, the y that is provided with according to " Subscriber Interface Module SIM ", destinationwidth, height carry out the data acquisition transmission;
2) be the unit of gathering with the piece, in this piece, the image data order is: with from left to right, gather from top to bottom; With reference to figure 6, the schematic diagram of the IMAQ that provides for the embodiment of the invention in piece, is shining from top to bottom, from left to right transmits; In whole two field picture, the order of piece is also according to from top to bottom, order transmission from left to right;
3) size of the piece of Cai Jiing is the block width that " Subscriber Interface Module SIM " is provided with, block height;
Format converting module 504:
1) according to the data type that collects of " imageing sensor ", carries out corresponding format conversion;
2) if directly be the rgb form, then rgb directly is converted to the yuv form;
3) if raw data format is converted to the rgb form earlier, be converted to the yuv form then;
4) rgb is converted to the formula of yuv, can use existing any one formula to change;
Image zoom module 505:
1) according to actual needs image is carried out convergent-divergent;
2) with the ratio of piece image is carried out convergent-divergent earlier, then scaled images is exported;
3) earlier the 1st piece carried out convergent-divergent and transmit, then the 2nd piece carried out convergent-divergent and transmit, and the like;
4) because general convergent-divergent algorithm, use when needing buffer memory 3 line data for convergent-divergent, it is many to take up room, use this method instead after, only need 3 data spaces of going block lengths, saved the memory space of convergent-divergent greatly;
5) eg.source width:1600, source height:1200; Block width:16; Blockheight:8; The general linear collection needs 3 * 1600 data spaces, and this method, only needs 3 * 16 data spaces (concrete size can be set, 8 * 16th, the longest usefulness);
Image display 506:
1) scaled images is shown;
2) generally have the memory space of a demonstration usefulness, the same with actual displayed screen size, scaled images, leave in this memory space, be used for demonstration;
Image compression module 507:
1) according to the piece image that transmits, compresses;
2) for example, yuv is to the compression of jpeg form; Eg.yuv422 is to the compression of jpeg;
3) present compression all is to adopt the compression of block form;
4) if use the general linear image data, compression if desired just needs the memory space with height source width of block, and this method, only need block height * block width memory space, saved the memory space of compression greatly;
5) eg.source width:1600, source height:1200; Block width:16; Blockheight:8; The general linear collection needs 8 * 1600 data spaces, and this method only needs 8 * 16 data spaces;
As from the foregoing, the embodiment of the invention has following advantage:
1) the present invention is to wanting the image transmitted data, and adopting with the image block is unit, in this image block, the image data order can for: with from left to right, gather from top to bottom; In whole frame original image, piece also with from left to right, is divided from top to bottom successively and transmitted.Owing to adopted the piece order to carry out the linearity transmission of data, and compression the time just in time will be that unit compresses with the piece, so saved a large amount of memory spaces that compressing image data needs, this is for the image compression chip that adopts expensive SRAM, when having saved huge carrying cost, because make things convenient for the addressing when compressing also to improve the processing speed of compression.;
2) carry out the linearity transmission of data with the piece order, also saved a large amount of memory spaces that when image amplifies and dwindles, need, saved chip cost greatly.
3) embodiment of the invention also can make target image less than original image by the size that piece is set, therefore the embodiment of the invention also has directly dig the function of gathering behind the frame from original image, this has just been avoided the unnecessary processing to some edge images, therefore be that unit carries out in the process of caching process with the piece, not only can avoid unnecessary buffer memory, can also directly avoid unnecessary collection and processing, when not increasing special treatment step, have extra effect edge image.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.