Jump to content
golzio

Jpeg decoding

Recommended Posts

I have frames coming from a DVR lan from digimaster. If I get the frame in tha raw format I'm able to display the image coming from the camera attacched to the DVR.

If I change the frame format to JPEG I'm already able to receive the frame but I'm not able to decode the JPEG. I'm not using the Vision module for labview because It is not necessary for my work (I need only to decode a Jpeg frame that is an array of U8 at this moment).

I also tried to use a function contained in a JPEG.dll that is called DecompressJPEG2Raw but, even in my opinion all the paramenter are passed correctly, It doesn't work.

If someone have some tip or experience I can attached or describe better my code.

thank you

Golzio

Share this post


Link to post
Share on other sites

Is this a true JPG file that can be loaded in a standard viewer program? If so the Read JPEG File.vi is the place to start (in the Programming...Graphics & Sound...Graphics Formats palette). Could you describe your application in a bit more detail?

Share this post


Link to post
Share on other sites

I don't have to read a file but a stream of byte coming from a digital recording device through ethernet. I'm already able to read the frame if I ask the device to send the frame in a non compressed format and I used "Draw Flattened Pixmap.vi". In this case each frame is about 300k instead if I ask to the device to send the frame in Jpeg format the size is about 12k for a size fo 352x288. It's clear for me that's this is the best way but at the moment I'm not able to decode the jpeg frame coming from DVR Digimaster. I also try to use a function contained in the jpeg.dll but Labview hang even if I suppose to call it in the right way. Attached you can find my trial using jpeg.dll.

Share this post


Link to post
Share on other sites

QUOTE (bmoyer @ Sep 8 2008, 05:20 AM)

Take a look at the NI Forum: http://forums.ni.com/ni/board/message?boar...ssage.id=335445

It seems to be doing exactly what you are doing. It encodes and decodes a JPG serial string.

Bruce

Beware, the IMAQ JPEG Encode and Decode VI's downloadable from NI's website have a memory leak that will crash the application if run over a period of time. I don't remember specifically if its the Encode or the Decode, but I would use either of those with great care. Also, the Encode VI swaps the Red and Blue Color Planes so that the image if decoded by any other application (other than the supplied Decode) will cause the image to appear blue-ish.

There is an available alternative VI if you have Vision called IMAQ Write String.vi which is equivalent to the Encode (and will allow you to convert any type of image to string), but I don't know of an alternative to the Decode VI.

Neville.

Share this post


Link to post
Share on other sites

QUOTE (Neville D @ Sep 8 2008, 02:10 PM)

Beware, the IMAQ JPEG Encode and Decode VI's downloadable from NI's website have a memory leak that will crash the application if run over a period of time. I don't remember specifically if its the Encode or the Decode, but I would use either of those with great care. Also, the Encode VI swaps the Red and Blue Color Planes so that the image if decoded by any other application (other than the supplied Decode) will cause the image to appear blue-ish.

There is an available alternative VI if you have Vision called IMAQ Write String.vi which is equivalent to the Encode (and will allow you to convert any type of image to string), but I don't know of an alternative to the Decode VI.

Neville.

Why wouldn't this info have been posted on the NI forum? I guess what you're saying can be "boiled down" to "use at your own risk". Someone should accurately describe any known issues so that people are properly warned before wasting their time implementing/debugging this if there is in fact a problem.

Bruce

Share this post


Link to post
Share on other sites

QUOTE (bmoyer @ Sep 8 2008, 12:24 PM)

Well, some of it is. If you look through your own link, someone does mention that the R-B planes issue can be fixed by swapping them.

And since no source code has been posted for the dll's you can't fix the issue yourself either.

QUOTE (bmoyer @ Sep 8 2008, 12:24 PM)

Someone should accurately describe any known issues so that people are properly warned before wasting their time implementing/debugging this if there is in fact a problem.

Bruce

Well, I just described it for you; and if you troll through LAVA, you will find links that show the problem as well

N.

Share this post


Link to post
Share on other sites

Hi guys,

sorry for not replying during this day but I was very busy.

I follow your advice and I was able to try the "IMAQ JPEG Decode.vi". It wasn't a good solution for me because I don't want (and I don't need) to use IMAQ Vision.

For this reason I tried to fix my call library function to call the function "DecompressJPEG2Raw" contained in the Jpeg.dll attached here.

I was able to fix it and for this reason I attached here my VI and and dll that I used. I also attached the jepg.h for someone that is interested to look at the prototype

of the function contained in the Jpeg.dll

Share this post


Link to post
Share on other sites

I wasn't able to upload file and for this reason I send the file by email to nico

Golzio

Share this post


Link to post
Share on other sites

If you're on Windows, you might be able to wrap some of the .net System.Drawing.Bitmap class. Being a .net object, it has full support for network streams and actually can handle a whole range of image formats.

The main downside to the .net approach is that some of the processing elements can take longer than pure LV variants (mostly due to crossing the LabVIEW / .NET boundary). In particular, if you go this approach, don't be tempted to use nested for loops and GetPixel() - that can take a ridiculous amount of time!

Share this post


Link to post
Share on other sites

Every post you make has a link to yiigo.com. You must really like their code! Even if you haven't checked the cost and licensing conditions.

I don't see any mention of cost other than requesting a quote.

Share this post


Link to post
Share on other sites
Every post you make has a link to yiigo.com. You must really like their code! Even if you haven't checked the cost and licensing conditions.

I don't see any mention of cost other than requesting a quote.

 

He just made a post replying to another post of one of his "buddies" asking if they have a trial version. Cute! Maybe Michael needs to add a specific check and reject any post with a link to yiiglo.com, rasteredge.com, and businessrefinery.com.

 

Also interesting to know is that the "Company" link on the side arronlee likes to promote so much does not work at all. Always nice to do (online) business with a company that could literally sit in cloud 7 as soon as you are not happy about something.

Share this post


Link to post
Share on other sites

Yeah, there are a bunch of these users in the past few months both here and in the NI forums (although NI has deleted all of them the last time I looked. The LAVA mods haven't, from what I can see). As far as I'm concerned, this is pure spam. These people seem to be pretending to be regular users and pointing to different sites which are probably all owned by the same company (although a whois search doesn't seem to yield any actual results). The one I liked the most was when one of those users started a new thread just so that one of the other users can reply to it.

Share this post


Link to post
Share on other sites

Lots of astroturfing going on.

 

The .net barcode thread had a new comment this morning by a one hit wonder named "cindy313" linking to a different site with an overpriced library.

 

Sigh...

Share this post


Link to post
Share on other sites

At least there was a price! :)

(One of the sites didn't even list a price. Always look on the bright side...)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.