Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my feild training i've come across LPBYTE variable that is streamed to me as frames
I want to find a way to view these frames on my pc
since i don't have a lot of experiance, i'm kinda stuck there :(

the LPBYTE arrives to me as unrecognized symbols, like:

،¤¤¤££££££££££¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¥¥¥¥¥¥¥¥¥¥¥¥¥¥¦¦¦§§§§§§§§§§§§§§§¦¦¦¦¦¦¦§§§§¨¨¨©©©ھھھھھھھھھھھ©©¨¨©©¨©©©©©©©©©©©©©ھھھ«««««««««««ھھ««ھ««««¬¬­¬¬¬¬¬¬¬­¬¬ھھ©©©©§§§¦¥¥¦¦¨©ھ««¬¬¬¬¬¬¬¬¬­­­­­­­­­­­­­­­­­­­­­­­­­­­¬©›„fccccXuv\”¬«ھ«ھھھ««¬¬¬­­­­­­­­­­¬®®­®®®®®®®®®®®­­®®­®®®®¯°°°°¯®­­®®­®®®®®®®®®®®­­­­®®¯°¯¯®®­­­­­¬®®­­­¬¬¬¬¬¬­­­­¬­­­­­­¬¬¬«««««ھھ««ھ««««¬¬ھ©¨‹¦‚ں


and when saving it as (.JPEG or .bmp) it wont open,
so, I was thinking that it may be raw pixel data, but still can't find a way to view it

can any one help me to view these frames on my pc ?
Posted
Comments
Richard MacCutchan 25-Jun-13 4:43am    
You need to go to the person or device that is sending the data and find out what format it is in.
Mesa1993 25-Jun-13 5:06am    
That's the problem i can't reach the device
but idk if this helps the program is streaming the video on my iPhone
so I'm running the software's SDK on my pc to convert it from a mobile appliction to a desktop aplication
enhzflep 25-Jun-13 5:21am    
Nah, that's for paid-work or wimps. :-p

1 solution

Got any of the _important_ details?
I.e
■ How many bytes are in each frame?
■ What is the expected bit-depth of the images?
■ What's the resolution?

Anyway, Try working with a small section of the image - perhaps 5 or 10 pixels.
1) Save the received data to a binary file
2) Open the file with a hex editor and write down 15->20 or 30->40 of the bytes (I.e 3 or 4 bytes for 5 pixels, or 3 or 4 bytes for 10 pixels)
3) Open your favourite image editing program and start entering the data.

I.e if the first 6 bytes are FF 000 00 FF 00 00, then you may try working with an assumption that the image is 24 bits. You could then say that the colour values for 2 pixels are (255,0,0) and (255,0,0) - use windows calculator in programmer mode if you're not familiar with hexidecimal numbers.

After several pixels - perhaps 5 or 10, you may be able to recognize the data as an image.
Also note, I've assumed that the data is stored as RR GG BB RR GG BB etc. You may also wish to try BB GG RR BB GG RR.

Finally, depending on your device, it may not even be rgb data - even if it is raw, uncompressed video frames. It wouldn't surprise me if the data came out in the YUV format - one that draws roots from analog tv signals. Data that would need conversion to either of the rgb or hsl colour models. Though, YUV would make my next suggestion less useful.

A good approach may also be to print the data as ascii characters, ensuring that the number of chars per line is the same as the number of expected pixels per row. Although it wont really reveal the picture, it can be a fast way of visually recognising a pattern. It would also be helpful if the data was only 8 bit. You wouldn't have the palette, but you could see the image.

As you can see, there are lots of potential pitfalls and things that may thwart your efforts.
Good luck!
 
Share this answer
 
Comments
Mesa1993 25-Jun-13 5:13am    
Now that you mentioned the YUV, IT IS YUV video but i'm receicing it as frames
352*288 -> Width*Height
152064 -> Size
The first line in the binary editor is :
10 29 2A 29 28......
I was assuming that this is the header of the frame

*idk if this helps but the software is streaming normaly on my iphone
enhzflep 25-Jun-13 5:28am    
Looks like you're in luck!
352*288 * 1.5 = 152064

So,
■ 12 bits per pixel
■ raw, uncompressed frames
■ no frame-header

Just try processing the data, with different assumptions on its format (but still adhering to only 12 bits per sample) Understand that the bits may not be in two consecutive bytes.

For instance, here's the inner loop of some code that processed the raw data from a web-cam, before applying a black and white filter/transformation on it. Notice that the indices are not contiguous..

if (isBW)
{
src = lpVHdr->lpData;
curPixel = src;
for (i=0; i<capWidth*capHeight; i++)
{
y = curPixel[0];
u = curPixel[1];
v = curPixel[3];

curPixel[0] = y;
curPixel[1] = 128;
curPixel[3] = 128;

curPixel += 2;
}
}
Mesa1993 25-Jun-13 5:34am    
I feel that i'm now on the right track
Thank you :)
enhzflep 25-Jun-13 5:46am    
Fantastic.

You're welcome, oh and have fun! :)
Mesa1993 25-Jun-13 8:27am    
do you have a photo editor to recommend for me so i can dowload it and play with pixels?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900