简体   繁体   中英

Visualize Raw image data

I have a buffer in my embedded memory that I can extract via some function, or I could dump, with hexadecimal values containing the raw data of my picture. Now this variable contains the whole raw data.

uint8_t UYVYBuffer[720u*2u*487u]

Is it possible to visualize these raw image data in JPEG or PNG file or something else to see what kind of picture I am having after I had made the processing and store the values of the image in the new variable (as below) UYVYBuffer.

If you also have some propositions of softwares that would read my .dat files and Plot these data, that would be also great

You could dump this raw data to a file, let say /tmp/raw_image , then convert it to png with the convert utility from ImageMagick . Here is an example assuming your image has size 128 x 128 :

convert -size 128x128 -depth 8 yuv:/tmp/raw_image /tmp/image.png

What I've done is extract the raw data in some fashion, into a text file in my case, and then I wrote a short Python program that loaded in the raw data and then used the png module to create a PNG image which is then written out to disk.

I did this for RGB565 data though which is nice since PNG is typically used for RGB-encoded data. From the variable name, it sounds as if your data is YUV which might require further processing in order to fit typical image formats.

This is pretty straight-forward, and keeps the complexity of "real" image formats where it belongs (ie, in somebody else's library).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM