LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scaling a 2D picture without using zoom factor

Solved!
Go to solution

I currently have a large 2D image and several smaller 2D iamges that overlap the large image.  The large image is created with the draw in labview, while the smal iamges are created with a png.  The zoom factor on the large image is 7, while the png 2D images have to be scale by .21 to fit properally on the large image.  Since the 2D images are stacked, while the back image updates it sometimes "flickers" through the small images.  To solve this I can combine the images, but this does not work since the zoom factors are different.  Is there a way to scale down an image without using a zoom factor?  Is it possible I have to programmatically scale the bitmap?

 

Thank you for your time

 

Mitchell Worner

0 Kudos
Message 1 of 14
(6,195 Views)

Have you tried to defer panel updates while doing the scaling operations?  This should eliminate the "flickering". 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 14
(6,147 Views)

Defering front panel update did not work.  I believe that the problem is that when the larger display updates, it gets set to the front in the front panel.  Which is why I was trying to get all the displays on the same front panel object.

0 Kudos
Message 3 of 14
(6,043 Views)

Can you post your code and the sample pictures?

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 4 of 14
(6,036 Views)
Solution
Accepted by topic author MWorner

Post your code for sure, but in the past when I needed to resize an image the GDI resize built into .NET always worked pretty well for me.

 

http://forums.ni.com/t5/LabVIEW/Net-image-resize-how-to-convert-to-format-labview-can-use/m-p/219902...

 

I used this in my Show Open VI QuickDrop

 

https://decibel.ni.com/content/docs/DOC-31302

0 Kudos
Message 5 of 14
(6,008 Views)

If you don't want .NET, you can also do some scaling of the array itself. A quick search for "resize picture", for instance, shows this as one the results - http://forums.ni.com/t5/LabVIEW/How-to-Resize-a-picture/m-p/246785/highlight/true#M133860. You could also try searching for 2D interpolation.


___________________
Try to take over the world!
0 Kudos
Message 6 of 14
(5,978 Views)

I was not going to download it has 21 SubVis and 50+ network variables to read.  I did not think anyone really wanted to go through that much code.  With the resizing VI that the 2 people posted I could resize the picture, but the background og the picture becomes black instead of transparent, which will not work with my display.  Attached is just a short code showing that/showing the pictures I am working with.  I think I am going to try to just draw simialr objects with the in labview draw arc and see if I can advoide this problem.

 

 

Download All
0 Kudos
Message 7 of 14
(5,953 Views)

Sorry i guess I should have said that I can only open 2012.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 8 of 14
(5,945 Views)

Here you go, should open in 2012

Download All
0 Kudos
Message 9 of 14
(5,937 Views)

@MWorner wrote:

I did not think anyone really wanted to go through that much code.   


Well when my car doesn't start I don't just bring my engine to the mechanic, I bring the whole car.  Of course some times if I talk to a mechanic it might be clear that I forgot to put the key in.

 

LabVIEW's image format doesn't support alpha layers, so you can perform the scale, but using the PNG data to Image will be forced to give it a background.  And I'm guessing even if the transparency is set to 100%, the color of black was choosen for the RGB color in the other 3 U8s that make up a pixels.  The PNG can be displayed with transparency using a .NET picture box, using that same PNG data stream.  That has a few other limitations in how any .NET container is handled in LabVIEW, but I'm pretty sure you could load the large non-transparent LabVIEW image first, then put the png with alpha layers on top of it, then either load it in the .NET picture box, or convert to LabVIEW data and display it.  Here are a few links of code of mine demonstrating how some of this can be done, the second link includes a PNG with alpha layers.

 

http://forums.ni.com/t5/LabVIEW/How-to-put-a-NET-control-with-PictureBox-at-background-Z-order/m-p/2...

http://forums.ni.com/t5/LabVIEW/NET-picturebox-convert-to-LabView-image/m-p/3125944#M897890

0 Kudos
Message 10 of 14
(5,916 Views)