LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

imaq scale overlay bitmap with zoom

Can anyone give me a starting idea so that my bitmap object gets scalled down when i zoom in on the image and vice versa instead of maintaining its origional size ??

0 Kudos
Message 1 of 10
(3,754 Views)

Can you post a snippet of your code? I guess you are refferring to an Image Display control.  But I do not see any relation to your post.

0 Kudos
Message 2 of 10
(3,738 Views)

I have attached a vi where i am trying to display a customized point as an overlay over an image. But as i zoom out of the image the point starting getting disappear, now is there anyway i can make it scale up as i zoom out and vice versa

0 Kudos
Message 3 of 10
(3,729 Views)

Never had this desire.  Using a property node to read the ZoomInteger or ZoomSingle of the Image Display would be my approach.  Use these values to resize the bitmap before overlaying it.

0 Kudos
Message 4 of 10
(3,715 Views)

Actually a desire which is to be part of my project 😞 .... Zoom single just provides the zooming capability in programming but it has no effect on overlay scaling. I found similar approach in overlay text which has built in scaling capability. Can same capability be introduced in bitmap overlay ??

0 Kudos
Message 5 of 10
(3,712 Views)

It seems that you are right with the behaviour of ZoomSingle.  However, ZoomInteger tells you the current zoom selection of the Image Display.  With this information you should be able to scale your bitmap according to your desire.

0 Kudos
Message 6 of 10
(3,708 Views)

How to scale thats the origional question ??

0 Kudos
Message 7 of 10
(3,698 Views)

If your bitmap was an IMAQ image, I would use IMAQ Resample.

Don't know if a counterpart for this VI exsist in LabVIEW for a 2D array ...

0 Kudos
Message 8 of 10
(3,690 Views)

The imaq resample does reshapes the image but according to another image not according to zoom level. The difference is X,Y resolution remains same in the case of zoom based scaling which makes imaq resample not the block for the case.

0 Kudos
Message 9 of 10
(3,686 Views)

That's one option on how to use IMAQ Resample. 

Let me put some draft code here.  That might avoid lots of posts regarding what I have in mind.

 

ResampleBitmap.PNG

 

I have pasted the the FP after one VI run above the code.  You can see, that the small red cross increased in size to 25 x 25 in the Image Display.  As transparent pixels in the bitmap were not kept in the alpha channel, I simply used a For Loop in a For Loop to correct this Smiley Mad

 

Now its up to you to set the numeric value (instead of my BD constant which is set to 25) according to your desire.  And do not forget to clean up things, like IMAQ Dispose (which I did not here in the draft).

0 Kudos
Message 10 of 10
(3,679 Views)