06-25-2008 08:01 AM
Here is the original code, updated to the newer Vision controls. The only functions I really use are encode and decode, but I included the whole library. You can replace the encode with the IMAQ Write String, but for some reason NI has not provided an IMAQ Read String to complement it. I would like them to do so, but they seem fairly resistant for some unknown reason. Perhaps in the next version.
Bruce
06-25-2008 08:13 AM
10-21-2008 07:07 AM
Bruce,
Thanx for the IMAQ JPEG Decode.vi but there seems to be a big memory leak in your dll.
I slightly modified the demo code and introduced a while loop: in the Task manager I observe the memory usage going continuously up and Labview is crashing after a short while.
best regards,
Jean-Philippe
10-21-2008 10:20 AM
Hmm, I never noticed that. I will have to do some testing myself before I use it again. I haven't had any problem with it, though. Perhaps the memory leak is very slow. For the record, I didn't write the code. I just downloaded it from NI a long time ago.
Depending on what you are trying to do, NI now has the ability to read/write images to strings using flatten to string. Unfortunately, they use a proprietary format for the strings so you can't read the files from any other program. However, they work well if you stay within LabVIEW. I keep suggesting they implement a JPEG string to image, but they don't think anybody would use it. Perhaps if other people submitted product suggestions, they would realize that it would be a useful feature.
Bruce
10-21-2008 11:13 AM
Hi Bruce,
Thx for your input.
It seems that the leaking pb (massive in my case) occurs only with RGB images.
I looked around and found another thread speaking of that pb:
http://forums.ni.com/ni/board/message?board.id=170&message.id=325881&requireLogin=False
Since I wanted to transfer a compressed image over the net I will use the solution (flatten_image_to_string_lv70.vi) discussed here:
http://sine.ni.com/devzone/cda/epd/p/id/3314
regards,
JPh
10-21-2008 11:34 AM
That explains it. I have never tried anything but grayscale images, for which it works fine with no memory leak.
I didn't realize flatten image to string has been around since LV 7. I thought it was introduced around 8.0. Or are you using a different function?
Bruce
10-22-2008 03:15 AM
Bruce,
I will use the solution with flatten image to string and "IMAQ Remote Compression".
I tried and it seems to work fine with RGB images.
Cheers,
JPh