LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resizing images

Hello!

 

I've been looking around the forum image resizing functions that don't suck, i.e. shrinking that uses proper anti-aliasing and expanding that uses bicubic interpolation. I couldn't find anything and have now written my own functions (vanilla LabVIEW only) that do this.

 

Now I wonder how interesting this is to the rest of you, and whether I've missed some smart solution somewhere.

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 1 of 15
(4,055 Views)

@O.P. wrote:

Hello!

 

I've been looking around the forum image resizing functions that don't suck, i.e. shrinking that uses proper anti-aliasing and expanding that uses bicubic interpolation. I couldn't find anything and have now written my own functions (vanilla LabVIEW only) that do this.

 

Now I wonder how interesting this is to the rest of you, and whether I've missed some smart solution somewhere.


You might also want to post your query at  Machine Vision board.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 15
(4,039 Views)

Having posted some of those VIs who do suck, I can say that there is some interest, but it doesn't seem to be that popular. The resizing I had was good enough for my purposes at the time and I suppose that others just use other options.


___________________
Try to take over the world!
0 Kudos
Message 3 of 15
(4,022 Views)

I have continued posting in this thread: http://forums.ni.com/t5/Machine-Vision/Resizing-images/td-p/2497838

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 4 of 15
(3,986 Views)

I had the same issue. The vision stuff is not free, but if you're on windows you can use GDIPlus which is pretty good.  See the attached. 

 

OP, do you mind posting your solution in G? I'd be pretty interested in seeing how you did it. I tried doing it in G but it was unbearably slow. GDIPlus resizes extremely quickly, and I ended up using this VI to dynamically resize an image as the user resized the window. 

0 Kudos
Message 5 of 15
(3,977 Views)

Have a look in the other thread I linked to.

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 6 of 15
(3,967 Views)

@pobrepablo1 wrote:

 

GDIPlus resizes extremely quickly, and I ended up using this VI to dynamically resize an image as the user resized the window. 


Oh I have a much nicer solution (still using Windows stuff).  I posted this on LAVA not long ago but can't link to it at the moment.  Attached is a VI and an image in a zip.  It will load the image into a picturebox then set it to fit to the control.  Then the control is set to fit to the pane.  Now when the pane gets resized the image does too.  It works quite smoothly and I have even scaled it up to have a grid of pictures and it all seems to work well.

Message 7 of 15
(3,936 Views)


@Hooovahh wrote:
Oh I have a much nicer solution (still using Windows stuff).  I posted this on LAVA not long ago but can't link to it at the moment.  Attached is a VI and an image in a zip.  It will load the image into a picturebox then set it to fit to the control.  Then the control is set to fit to the pane.  Now when the pane gets resized the image does too.  It works quite smoothly and I have even scaled it up to have a grid of pictures and it all seems to work well.

Neat! Now the only question is, how to keep the aspect ratio?

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 8 of 15
(3,913 Views)

@LarsM wrote:

Neat! Now the only question is, how to keep the aspect ratio?

 


Change the SizeMode from StretchImage to Zoom and the aspect ratio will be kept.  To change the background color, color the pane that the PictureBox is in.

Message 9 of 15
(3,901 Views)


@Hooovahh wrote:
Change the SizeMode from StretchImage to Zoom and the aspect ratio will be kept.  To change the background color, color the pane that the PictureBox is in.

Of course. I must have done something wrong the first time I tried it.

 

It's weird that the image disappears when the vi stops. Is there some way to make the image persistent?

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 10 of 15
(3,890 Views)