LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I decode a data stream to jpeg image?

Solved!
Go to solution

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

0 Kudos
Message 1 of 31
(9,352 Views)

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?).

 

ConvertStringToImage.PNG

Message 2 of 31
(9,335 Views)

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

 

 

0 Kudos
Message 3 of 31
(9,309 Views)

You forgot to make current value default on your string.

0 Kudos
Message 4 of 31
(9,298 Views)

maybe this can help

cosmin

0 Kudos
Message 5 of 31
(9,294 Views)

@Darin:

what do you mean with "make current value default" exactly?

 

 

0 Kudos
Message 6 of 31
(9,267 Views)

@ 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?

 

 

0 Kudos
Message 7 of 31
(9,265 Views)

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

0 Kudos
Message 8 of 31
(9,257 Views)

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

0 Kudos
Message 9 of 31
(9,250 Views)

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.

 

 

0 Kudos
Message 10 of 31
(9,225 Views)