Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
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 Frown | :(
 
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 24-Jun-13 23:04pm
Comments
Richard MacCutchan at 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.
Lamees O. Ghunaim at 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 at 25-Jun-13 5:21am
   
Nah, that's for paid-work or wimps. :-p

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
Comments
Lamees O. Ghunaim at 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 at 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;
}
}
Lamees O. Ghunaim at 25-Jun-13 5:34am
   
I feel that i'm now on the right track
Thank you :)
enhzflep at 25-Jun-13 5:46am
   
Fantastic.
 
You're welcome, oh and have fun! :)
Lamees O. Ghunaim at 25-Jun-13 8:27am
   
do you have a photo editor to recommend for me so i can dowload it and play with pixels?
enhzflep at 25-Jun-13 8:42am
   
I'm pretty sure I've used The Gimp (linux man's photoshop) for something like that in the past.
I've just checked, it can load raw images i.e those without any header info.
But it only does rgb or rgba images out-of-the-box. There may be a plugin for dealing with yuv data.
Mesa1993 at 26-Jun-13 3:37am
   
I downloaded GIMP and was able to view the frames Finally!! :)
but I came across a file called mp4core.dll & others like it
do you think this file has something to do with converting the frames into a video stream??
enhzflep at 26-Jun-13 17:13pm
   
Great! It's such a satisfying feeling when you can turn raw data into something tangible. Free software makes it all that much better.
Quite possible that the mp4core.dll file is used as part of the encoding process. There's a bunch of tools around, whose names I forget. So, I'd use my trusted go-to program, OllyDbg - that will let you look inside the DLL and tell you the names of all of the functions that are intended to be called by a process that loads the dll file. (Exported function names) That tool _may_ give you a hint. Similarly, you can look in the host application with the same tool for calls to the functions in the DLL. Of course another approach that I overlook all to commonly is to simply google the file and look for references to it's use. The number of times I've traced out a schematic from a circuit board, only to find there's already an online version is truly infuriating!

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

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 BillWoodruff 220
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,817
2 DamithSL 5,461
3 Manas Bhardwaj 4,946
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 25 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100