07-11-2014 02:59 AM - edited 07-11-2014 03:01 AM
I would like to change aspec ratio of my picture. Is that possible in labview.
To show it on example. I would like to take this picture:
and convert it to something like this:
Solved! Go to Solution.
07-11-2014 03:46 AM
If you're working with actual images in LabVIEW then consider using the IMAQ tools for image manipulation. This vertical aspect ratio change is effectively a resample in the y dimension, so can resize a 600x600 image to 600x450 (for example).
If you don't have the IMAQ tools available, then convert your image to a 2D array and perform interpolation on each column, then convert back to an image. The image conversion utilities are in the Picture palette (flatten and unflatten).
07-11-2014 06:43 AM
Thank you for your answer.
I'm trying now with your second proposal (i don't have IMAQ tools) and i'm having problems with perform interpolation part.
I convert image to 2D and get all the columns from array. Problem is then that i really don't know how to do interpolation right. I don't get any usefull result.
Can you show me how to do only the interpolation part? Or maybe if there is any examples how to do it.
07-11-2014 08:21 AM
Here is something I put together quickly based on the suggestion of using interpolation. You could expand on this to increase the image size based on a width and height percentage or set aspect ratio.
07-11-2014 08:37 AM
@Lourens wrote:
Here is something I put together quickly based on the suggestion of using interpolation. You could expand on this to increase the image size based on a width and height percentage or set aspect ratio.
Nice native solution, but when I need to do this I use .NET with a GDI resize function. In testing it ran about 3-4 times faster than the solution you came up with. .NET also supports multiple file types not just PNG, and it supports alpha layers in PNG files which is a royal pain to try to do nativly. Of course not everyone can use .NET and not all environments support it.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-11-2014 12:46 PM
Thank you both for examples.
07-11-2014 01:02 PM
@Schime wrote:
Thank you both for examples.
If you really want to thank us you'll give kudos to posts that helped, and possibly mark a post as the solution to the topic.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-14-2014 03:24 AM
Done. 🙂
I tried Lourens solution and it worked fine. Transformation takes some time but it's ok.
For your example i'm missing a vi when i load it so i didn't test it yet.
07-14-2014 07:43 AM
@Schime wrote:
Done. 🙂
I tried Lourens solution and it worked fine. Transformation takes some time but it's ok.
For your example i'm missing a vi when i load it so i didn't test it yet.
Oh you are so right I'm sorry. That missing subVI isn't needed if you are providing a path and not the Image Data. So I'd recommend deleting the Image Data control, and remove the case structure, leaving only the False case. Then it will work.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-14-2014 10:06 AM - edited 07-14-2014 10:07 AM
Thanks. I used only GDI Resize Image Hooovahh Version.vi and did what you told me to do and it worked just fine. It's super fast.
This problem is solved thanks to you guys.