03-30-2011 09:39 AM
Hi
I am using the tranfered jpeg-data stream of a scanner module which I need to decode and display as an image on my vi.
Question:
With which method i can do that on the fly?
or
do I need to save the data stream (string) first to decode it afterwards with the "Read JPEG file.vi"? If so, how do I save the data in the correct way in the way that LabView can read it?
thanks in advance
Norick
Solved! Go to Solution.
03-30-2011 11:23 AM
For Windows I use .NET to do this type of conversion without resorting to writing temporary files. This VI will convert most formats (bmp,jpg,gif,tif) to a PNG string and then you can use the native PNG data to LV image VI. Why they do not provide string based versions for all image formats is beyond me (idea perhaps?).
03-31-2011 09:46 AM
Darin
thanks for your reply and the vi you sent. your vi works great with your data-stream but for some reasons I struggle with my data-string. Do you have a clue why I do get
an error message from the call library function during the conversation from the binary PNG stream?
thanks
03-31-2011 11:11 AM
You forgot to make current value default on your string.
03-31-2011 12:11 PM
maybe this can help
cosmin
04-01-2011 04:40 AM
@Darin:
what do you mean with "make current value default" exactly?
04-01-2011 04:44 AM
@ Cosmin:
thanks for the reply. If I am using the proposed vi including the dll the whole LabView crashes complettly! With the data stream from Darin it works without problem if the right picture size is defined previously. I am not sure if this problem is related to what I see with the vi from Darin.
Any ideas about it?
04-01-2011 06:15 AM
Norick, the calling convention is C not stdcall. You change the calling convention.
I modified your vi. Also, as stated in the example, you must put the width and height (72 and 72 in this ex).
cosmin
04-01-2011 07:42 AM
Yes you are right... if i run the app i see a tripple image with my data. The image size is 748 x 480 (256).
Do you have an idea about it?
thanks
04-01-2011 11:13 AM
The issue with my version is that the built-in PNG converter for string data is rather weak, most jpegs are ok, but this one is a problem. The file based Read/Write PNG are much more robust. Here is a modified version which translates via BMP instead of PNG, I have included a string based BMP decoder I use based on the built-in Read BMP File.vi. Converts your image without problem.