Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Decoding jpeg string

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

Bruce Ammons
Ammons Engineering
Message 11 of 17
(3,450 Views)
Bruce thank you for providing the library again. I know they are sometimes resistant against any changes.
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 12 of 17
(3,447 Views)

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

 

 

0 Kudos
Message 13 of 17
(3,257 Views)

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

Bruce Ammons
Ammons Engineering
0 Kudos
Message 14 of 17
(3,250 Views)

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

0 Kudos
Message 15 of 17
(3,246 Views)

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

Bruce Ammons
Ammons Engineering
0 Kudos
Message 16 of 17
(3,244 Views)

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

0 Kudos
Message 17 of 17
(3,230 Views)