Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

translucent image and image move

Hi,
I have 2 questions.  The first question has to do with making an image translucent or "see through," kind of like Photoshops opacity tool.  I tried using the IMAQ image to array and then dividing the array by 2, but that made the picture darker.  I also tried to multiply the image by 2, but that made the image appear to have "noise" throughout it.  I thought if I could less the pixel values by half, that would the image appear "see through."  The reason I want to make the image "see through," is because I am trying to write a program which will stitch images together.  The second question has to due with picture location.  I created an IMAQ image as a 4096x4096 and can load one 2048x2048 image into it.  Is there a way to load a second image, but be able to move the image around with the mouse, while the first image is still stationary?  I was able to use the "Overlay bitmap" vi to over two images on top of each other, but I can not manipulate any of the images.
 
Thanks,
Adam 
0 Kudos
Message 1 of 6
(8,045 Views)
Hi Adam,

Thank you for posting to the NI forums! Below is a link to a VI posted on the forums to add a 'transparent' image to a second image.  The problem with this VI is that the transparency is constant for the whole transparent image.

Translucent Image Display VI

If you want partial transparency as in Photoshop, or transparency defined by the alpha value of your 32 bit image, you have to program the functionality manually.  The alpha value is equivalent to the slider value in the above VI, because it represents the extent to which the pixel is transparent.

If you are trying to stitch images together, I suggest either multiplying both by half then adding them (like in the above VI), or mask one image and add it to the second. 

To load a second image into a first, you want to use the IMAQ ImageToImage 2.vi.  To position them with transparency, try putting each image into a sub-panel, and setting the window transparency on each panel with the VI property nodes.  Once you have the images placed, you can programatically get the location of the panels, and use the difference between the locations to offset the overlay in the ImageToImage VI. 

Hope this helps!
Maclean G.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 6
(8,017 Views)

Hi,

Thank you for the information you provided, it helped a lot.  I now am able to make an image translucent and get the coordinates moving an image around using IMAQ vi's.  Figuring this out has lead me run into new problems.  I have 2 IMAQ picture indicators on the screen.  The image on the left over laps the image on the right.  I can make the image on the left translucent, but I can't not make it completly translucent because of the background in the picture control.  Is there a way to make the background in the indicator translucent so I can see the right image under the left image.  I also have a question about using the IMAQ image to image vi.  When I try and insert one image into another image, the first image is fine, but the second image has a lot of noise in it and the image is half its original size in the y direction.  I tried multiple ways to use the image to image.vi, but keep getting the same reuslts.  If I can make the image on the left translucent, I don't believe I will need the to use the image to image vi.  Here is the vi I am using, I can't attach any pictures, because they are too large. 

Thanks,

Adam

0 Kudos
Message 3 of 6
(7,995 Views)
Hi Adam,

Can you also post the images you were using?

Thanks,
Maclean G.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 6
(7,992 Views)

Hi,

Here the images.  They are a little large in size, so I had to reduce the resolution from 2048 to 1024.  I also had to rename them, since it would not let me attach .tif files.  You should be able to remove the .jpg from the name, and they should still work.

Thanks,

Adam

Download All
0 Kudos
Message 5 of 6
(7,986 Views)
Hi Adam,

What are your inputs on the image to image VI?  Are you resizing the second image to fit it onto the first?  Try specifying a destination image that is large enough to contain both images, and see if the second image is still blurry.

There is no way to make just the background of the indicator transparent.  My previous suggestion was to put the two images into separate sub-panels, so they are actually disconnected windows that you can move around independently.  You can set the transparency of the whole window then move the images so their windows overlap.

Hope this helps!
Maclean G.
Applications Engineering
National Instruments
0 Kudos
Message 6 of 6
(7,959 Views)