LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

zoom picture in fixed size control

Hi,

I am using LabView 6.1 and I would like to zoom a picture but in a fixed size control (as a picture viewer). I read many post but they present a solution where the control is being resize along with the picture or they are using an earlier version of LabVIEW where NI did provide the property option "ZoomFactor" which is not the case in 6.1. In my case, I would like to have a fixed size control and then be able to zoom into a picture with a mouse by selecting a certain area. I guess I will have to do some math operations but can anybody help?

Thank you,
Joe
0 Kudos
Message 1 of 8
(4,544 Views)

I have actually written a VI that does just that as an experiment once, but to find it, backsave it to 6.1 and upload it may take a day or two.

In the mean time, you can do the main part (the resizing) like this:

If you don't want to code this, you can search OpenG or LAVA for "Bird's Eye View", which has a bi-linear image resizing VI somewhere inside it and should be saved in 6.1.


___________________
Try to take over the world!
Message 2 of 8
(4,522 Views)
Hi tst,

Thank you for your help. Actually, I did read your post previously and already implemented the portion of code you submitted in 6.1. I did find it slow though. I tried to resize bitmap of size 800x600 to new height and width 1000x1000 and the computation time was very long (more than a minute or two).

BTW, I have LabView 8 at work, so if the VI you were talking about is written in 8, you can post it and I could open and try myself to implement it back to 6.1

I am looking forward to your reply.
Joe
0 Kudos
Message 3 of 8
(4,493 Views)


@JoeCAE wrote:

I tried to resize bitmap of size 800x600 to new height and width 1000x1000 and the computation time was very long (more than a minute or two).

That doesn't sound right at all. These sizes take me a lot less than a second using a pretty old laptop. They shouldn't take you any longer. I think there might be something you're missing in your implementation. You can find the VI posted online, so you can open it in 8 and compare to your own version.

The VI was only a quick and dirty test, so it's not much to look at. Basically, it draws a rectangle on the picture as you move the mouse to show you the zoom area and when you click it cuts the relevant part out of the picture and uses the resizing VI to do the zooming. Anyway, I have it on another computer and it will probably be another day or two before I can get to it.

As I previously suggested, you can also get the Bird's eye view toolkit, which uses a fake bi-linear interpolation to do the resizing. I haven't tested whether the quality is better, but I have benched it and my VI is just a tiny bit faster (when I opened a folder with a lot of big pictures it took about 15 seconds with the other VI and 14.something with mine).


___________________
Try to take over the world!
0 Kudos
Message 4 of 8
(4,481 Views)
Tst,

You were right. I did a small mistake. I put "insert into array" instead of "replace array subset". Now it works well. Thanks.
Now, I am trying (in 6.1) to translate the picture so that I can show the area I want to zoom.

Thank you for your help,
Joe
0 Kudos
Message 5 of 8
(4,471 Views)

OK, I finally managed to dig up the example I did back then, and here it is, in 6.1.

Remember that this was basically just a proof of concept to myself, so it's quite messy, but it's not very complicated, so you should have no problem figuring it out.


___________________
Try to take over the world!
Message 6 of 8
(4,453 Views)
Thank you so much tst. You have been of a great help. I did finally succeed in 6.1. Although, it needs some optimization.

Thanks,
Joe
0 Kudos
Message 7 of 8
(4,435 Views)
I'm not sure whether this specific algorithm can be optimized any further. It does strike me as relatively wasteful for large images in terms of memory, but I think the speed is comparable for the time it takes Windows, for instance, to create a preview of a large image.

___________________
Try to take over the world!
0 Kudos
Message 8 of 8
(4,429 Views)