converting binary to image data
I am catching some real time snaps from camera which is connected through com port. I am able to interact with camera and getting data using camera api. Thing is that I need to display image in picture box. The image information I am getting comes in a string variable. Definitly that string contains binary data ( unreadable).
I don't know how to convert this string to image. Once this binary string is converted then it will be easy to display in picture box.
Can anybody tell me, how can I convert this binary string to image file...???
Thanks in advance :
Re: converting binary to image data
Re: converting binary to image data
the code in post may give u some ideas..
Re: converting binary to image data
Do you know the exact format of the data being retrieved? The native image classes are very picky that you use well-formed image data, and a string is generally not well formed image data.
Re: converting binary to image data
Hi Gemmill
The data is in unreadable format. As Unmanaged Structure I am using is to hold image data from camera that is why I suppose that it is image data. The actual structure member (written in VC++) returns void* data. As I am using it from VB.NET, it is providing me in the format of string.... But data is totally unreadable.
Any clue about that..
Regards
Imran
Re: converting binary to image data
Yeah, see the problem is that if you don't know the data format, you can't really do anything with that data (unless you guess obviously). So, do you know if it's JPEG, BMP, RAW, TIFF, etc.?
Better yet, can you take a picture using the smallest resolution possible, then paste the contents of the string value to a text file, zip it, and post it here?
1 Attachment(s)
Re: converting binary to image data
Hi Gemmill
I have saved that string in txt file and file is attached here named 112.txt. Please have a look at it. Thing is that the liberary i am using supports bmp and tiff format. So it could be one of them.
bundle of thanks
Regards
Imran
Re: converting binary to image data
I forgot to ask you, you mentioned that the image data is a structure member. Are there any more member in that structure?
Re: converting binary to image data
Yes
This is the structure.
Public Structure TDICLibImageInformation
Public data As String
Public dataLength As Integer
Public width As Integer
Public height As Integer
Public pixelSize As Integer
Public pitch As Integer
Public roiX0 As Integer
Public roiX1 As Integer
Public pixelType As integer
End Structure
I am able to get datalength. Similary
width = 64
height = 1510
this mean i am getting frame of size 1510*64
regards
imran
Re: converting binary to image data
Is that right? 64x1510 seems a little weird.
Do you have any documentation on the data you are receiving?
Re: converting binary to image data
YES
ACCORDING TO CAMERA DOCUMENTATION THIS SIZE (64*1510) IS OK.
It is the resolution of camera. This thing is confirmed that i have received right data.
actual thing is how to convert it to image to display in picture box ????????????????
Regards
Imran
Re: converting binary to image data
Ok... look, we need all the info you have. We have no idea what you are working with here, so if you have more information, it will only help us help you. Otherwise we are wildy guessing.
What are the rest of the values of the members in that structure?
Again, any documentation?