LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to overlay a partially transparent image (RGB user created) on an grab acquired image (I16 Grayscale) session in a while loop?

Solved!
Go to solution

Hi DW,

 

Confessions first:

 

I did not review your code and have only limited experience with IMAQ (I have specialists that do image apps).

 

I have played around a lot with pictures.

 

Grey-scale image when converted to RGB end up with the three bytes RGB all set equal each other.

 

Once your grey scale is in RGB form and assuming the two image are of the same dimension then convert the two images to arrays and process each pixel's value one byte at a time (For RGB). The "interpolate" Vi can be feed a two element array consiting of a byte from one of you images and the associated byte from the other image with an index between "0" and "1" to control which of the two images gets the heavier weighting. The returned interpolated value converted back to a byte  packed back together with all of the rest. I have used this approach to fade from one image to another.

 

Like this

 

 

 

Ben

Message Edited by Ben on 03-31-2009 10:23 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Download All
Message 11 of 27
(8,712 Views)

Here is the output from the front panel when I alter your attached code to use a 'live feed' acquisition.

I think this is almost my answer.  However, I need the output to contain the RGB information during the feed.  I will continue trying to alter the code slightly to see if I am able to get the output.

Thank you,

dwfox

0 Kudos
Message 12 of 27
(8,695 Views)

Here is the output from the front panel when I alter your attached code to use a 'live feed' acquisition.

I think this is almost my answer.  However, I need the output to contain the RGB information during the feed.  I will continue trying to alter the code slightly to see if I am able to get the output.

Thank you,

dwfox

0 Kudos
Message 13 of 27
(8,692 Views)

I "cheated' in my simple example by using images of the same size. Your image

 

looks like you may be off by one pixel. A mis-match in size will throw-off the one to one relationship between the pixels so you will have to copmensate. When doing this please note that the rows of picture images are padded to be multiples of 8 long.

 

Just trying to help,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 14 of 27
(8,692 Views)

Okay, thanks for the help.  I have seen vi's which are using the same idea as those which have been posted.  However, my issue arises when I attempt to overlay onto a "LIVE FEED" from IMAQ.  I accomplished the portion of the coding which overlays one picture onto another in a unique manor.  However, now, I need to do the same except overlay my created picture onto my 'LIVE FEED' session.  Overlaying onto the 'LIVE FEED' is the tricky part.

In reply to BEN, this coding turns the transparency to "fully on" or "fully off".  I need a partial transparency level.  Please refer to the zip file I attached to this thread which contains the RGB/Greyscale image I created in a like manor.  In this vi, I control the amount of transparency.  You can find this transparency control on the message boards by searching for "merge two images.vi" if you are curious.  Nonetheless, the problem I am having is changing my coding to the "live feed".

dwfox

0 Kudos
Message 15 of 27
(8,671 Views)

You are coercing your I16 image data to a U8 input.  That is one problem.  You need to rescale your I16 image data to U8 image data.

 

You set your reshape array for that data to 245760 elements when that array should be 81920 elements since it does not have three colors.  This will pad the array will alot of zeros at the end.

 

Take the 81920 array and feed it into a three input Interleave Array function to make it the right size and format (three sequential elements will have to same value) and then feed that into your 'merge two images' vi.

 

I never saw your vi that read in files, but it must have done some image conversions for you if it worked.

Message Edited by rpursley8 on 03-31-2009 05:02 PM
Randall Pursley
Message 17 of 27
(8,653 Views)

rpursley,

Nice catch!  I think when I was creating the PNG file that the picture was using a the RGB version of greyscale (215,215,215); so, I had no problems.  I applied to suggestions, array sizes are identical, and the numbers have been converted to 8bit.  However, perhaps the issue now is a bit more common.  I have attached the error jpg which I am receiving.  This error pops up twice when I stop my "live feed loop."  The picure is of the first error window.  The second error window is the same except that I am given the option to stop the program and happens at the 'IMAQ Dispose.vi.'

I think you all will be familiar with this error.  But, since I am new to labview, I am having trouble debugging this error.

Thank you all for you help,

dwfox

0 Kudos
Message 18 of 27
(8,616 Views)
Solution
Accepted by dwfox1977
You need to fix how you wire the cluster going into the loop.  See attached.  You wired it to the definition of the cluster (which is filled with default values) as opposed to the output of the cluster which has valid values.
Randall Pursley
0 Kudos
Message 19 of 27
(8,598 Views)

hi

   iam new to labview i want to make some colors look transparent in labview is this possible please can any one help me out

0 Kudos
Message 20 of 27
(8,368 Views)