ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply codecs in LabView

I have a stream of JPEG files (wireless transmission) and i need to compress them before sending and decompress after receiving. Using NI Vision toolkit namely IMAQ AVI2 Codec Names.vi I found out that I have codec H.264. How can i use it for compressing and decompressing JPEG files. Is it possible using NI Vision toolkit ?

Thank you in advance.

0 Kudos
Message 1 of 10
(4,534 Views)

Hi Hovhannes,

 

why do you want to compress and decompress JPEG files?

 

- JPEG already is compressed and has a certain datastructure: compressing it with "lossy" compression like H264 will damage that data structures!

- Have you tried to ZIP the files? (With JPEG files you will maybe gain 1-2% filesize…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(4,504 Views)

Thanks for replay.

When I compress my images with JPEG converter (IMAQ Flatten Image to String.vi) for transfer it I get a very bad quality. Because of it i want to compress my data send in via serial port and decompress so as not to have a strong loss of quality.

0 Kudos
Message 3 of 10
(4,473 Views)

Hi Hov,

 

did you read the help and did you play with the parameters?

- You might change the quality of the JPEG compression.

- You might even switch off JPEG compression.

 

Did you try to ZIP the (image) string for transfer?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(4,470 Views)

Yes I know, but the file with appropriate size (for transfer minimum 15 frames per second) have very poor quality.

0 Kudos
Message 5 of 10
(4,466 Views)

It sounds like you basically need to reinvent MPEG. Don't send the full JPG, send the difference from the previous one.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 10
(4,458 Views)

If it's not hard for you can tell how it can be implemented? I try to transfer video via UART with 230.4 kbit/s baud rate with minimum 15 frame per second. 

0 Kudos
Message 7 of 10
(4,453 Views)

Hi Hov,

 

I try to transfer video via UART with 230.4 kbit/s baud rate with minimum 15 frame per second. 

Wow.

Which frame size (in pixels)?

 

Some simple math: You can send ~23kB/s using your 230kbaud serial port. So you have just ~1.5kB/frame available: unless your frames are tiny the video quality will be poor…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(4,450 Views)

Frame size is 320x240

0 Kudos
Message 9 of 10
(4,448 Views)

Hi Hov,

 

Frame size is 320x240

So you are stuck with 1500byte/(320×240pixels)=0.02bits/pixel.

 

I'm not an expert with MPEG compression, but that sounds very low for me…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 10
(4,443 Views)