From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary overlay

Solved!
Go to solution
Hi All I'm stuck trying to overlay a binary image on a (U8)greyscale image with the binary image appearing as a colour. This needs to be performed with the greyscale being acquired at upto 20fps. I've seen another thread along these lines http://forums.ni.com/ni/board/message?board.id=200&message.id=23473&query.id=2548611#M23473this method worked when opening an image from file. However when placed in a loop with an acquired image the programme runs very slowly and the overlay changes colour to white very rapidly.Any suggestions would be greatly appreciated.Many thanksDarren 

 

0 Kudos
Message 1 of 5
(4,090 Views)

Yes the proposed way is not fastest, but easiest.

 

There are two major bottlenecks in this algorithm - conversion to LabVIEW array (IMAQ Image to Array) and Overlay. You will reach 20 fps with difficulties (with image like 800x600 or above).

What you can do is following - you should use indexed colors and working with Palette. This way will be good for you if you don't need lot of different colors. You can pass the pointer of the image into your own DLL, where you should replace some pixels (let's say - pixel with intensity = 1 is your first color, pixel with gray 2 - second color, etc). Of course, you should replace all original pixels with same gray values to zeroes. Now you should modify the default gray palette with your own where entries 1, 2 etc are replaced with color values (by default in gray palette all three RGB components are the same) and display it.

So, you will reach 20 fps or above (depends from the size of the image and speed of your PC).

 

This way required good understanding how image placed in memory, and how to pass image into DLL (and how to prepare and build DLL of course).

 

Andrey.

 

0 Kudos
Message 2 of 5
(4,079 Views)

Thanks Andrey

 

Unfortunatly I'm really up against it and don't have the experience with image DLLs.

I've just tried all three methods form the other thread and can't get them running with anything other then a single image.

As that seems to be the easiest way could you suggest were I'm going wrong placing the code in a loop?

The first run is as the single file after that the overlay colour increments until I have a white overlay.

thanks

darren 

0 Kudos
Message 3 of 5
(4,066 Views)
Solution
Accepted by topic author scoobydont

Hello Scoobydont,

Here is a VI that I have writen that will combine colour details with a gray scale image. This is done by creating two seprate images that held both color and grayscale data. I then used the add function to combine the two to give the results you require.

 

I hope this helps,

 

Regards,


Philip
Applications Engineer
National Instruments
UK Branch

===If this fixes your problem, mark as solution!===
0 Kudos
Message 4 of 5
(4,016 Views)

Hi Philip

 

Just to close this thread. I have just finished the project. My last in LV8.6 having just updated to LV2009. As your example was LV2009 I have only just tested it and no surprise it works well. To complete the project I used the code below. It essentially does the same thing, converting the binary and live U8 images to RGB and adding the two. The overlay colour can be altered by changing the two constants and the plane in `replace color plane.vi' . This ran on three GIGE cameras at over 5f/s.

 

many thanks

Darren

 

colour overlay on U8.png

0 Kudos
Message 5 of 5
(3,965 Views)