LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Resize a picture

hi
I am using web cam acquiring image using lab view. i want to reduce the size of the picture before saving it .currently the size of the iamge is 300*200. i want to save it in smaller size becaz iwill be displaying this image on mobile and that require small pictures.any idea how to do it in labview.
0 Kudos
Message 1 of 30
(25,645 Views)

Attached is a VI which resizes a 2D array (7.0) . It was designed to resize pictures and for pictures of your size it should be fast enough. I don't think webcams use 24 bit color, so you may have to make some modifications. Also, it doesn't do any "clever" stuff like averaging color values. It just takes some of the elements from the original, which seems to be good enough.

From what I saw, this VI gets slow when handling large arrays (I saw about a second for a 2800x1500). Does anyone have any optimizations ideas? I know that when windows creates thumbnails it also takes time, so I'm not too optimistic.

Message Edited by tst on 07-27-2005 12:14 PM


___________________
Try to take over the world!
Message 2 of 30
(25,644 Views)

Try this link for the quicktime library. It has an imagetransformation vi in it. You can scale the X and Y independent of each other. You need quicktime installed.

 

http://labview.epfl.ch/QT/QTVis.html

0 Kudos
Message 3 of 30
(25,626 Views)
Here's an addition - a VI which loads a directory of JPGs, resizes them and displays them in a 2D array.

___________________
Try to take over the world!
Message 4 of 30
(25,618 Views)

VERY nice vi. 10 stars ..at least

Thanks tst...

0 Kudos
Message 5 of 30
(24,805 Views)
Thank you very much for these most useful vi's
They resize the jpeg's quickly, and present them in a handy 2D array.
Thanks again for sharing your work.
John
0 Kudos
Message 6 of 30
(24,707 Views)

For the ones who came here by search, here is an example that resizes very fast and easy.

Some applications don't need more than this.

 

The VI also converts it to excel, after col & row resize the picture appears.

Maybe by choozing better characters results become even better. 

 

Steven

Message 7 of 30
(23,848 Views)

That's nice - faster and considerably simpler than my version.

 

A few points for improvement:

 

1. The resizing is the same both ways. You could just change it to a be ratio of the current size.

2. You can easily set a different ratio for X and Y.

3. You probably want to convert the value to an integer as early as possible to avoid having repeated coercions inside the loop.


___________________
Try to take over the world!
0 Kudos
Message 8 of 30
(23,827 Views)

First, i know its an old thread 🙂

 

2nd: how can you take RalcoBe resize function and also adjust the image MASK. I want to resize a png and keep the transparency.

- A minute saved is a Minute earned!
0 Kudos
Message 9 of 30
(19,700 Views)

Hi profit,

 

replace the JPGFileLoad by PNGFileLoad. Then rescale the picture data the same way - but do the same for the mask data delivered by PNGFileLoad. Then recombine both scaled arrays into a new image data cluster...

Best regards,
GerdW


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