PDA

View Full Version : Creating an overlay



Franck M57
February 24, 2015, 11:18:37
Hello,

(translate google French English)

Quick presentation of my project vb.net before exposing my problem.

With a DMK 41, calculation of the barycenter of the light beam of a laser onto a selected area by the user of 100 x 100 pixels. Draws a rectangle the search area.

I used some of the example « Performing Advanced Image Processing ». The barycenter is found. The rectangle is drawn using the method "DrawRectangleY8".

Everything works. :cool:

I would like to see additional information such as date and time, xy position of center of gravity. So I followed the example "Creating an overlay," but I am having problems.

1 / A the procedure “Setting the Overlay Path position” (vb.net), there seems to be an error, the proposed code is the "ShowBitmap" sub . Is that code for " Setting the Overlay Path position " can sent myself ?

2 / In the procedure "IcImagingControl1_LivePrepared" I have an error : DrawOverlayInfo is not declared. I saw on the net an example with three lines placed in comments ( ' DrawOverlayInfo ...).

3 / In the procedure "IcImagingControl1_OverlayUpdate" I have an error :
Sink is not declared. I do not know what to do.


I still managed to display the text "IC Imaging Control 3.2" and graduated reticule. But the value of the pixel is changed. For example, if the user selects an area with the reticle, the result of the calculation of the barycenter is distorted.

But before we go further and for I know well "Overlay" could you help me for the three problems above ?

Thank you

Franck

Stefan Geissler
February 25, 2015, 10:54:27
Good Morning Franck!

Sorry for the delay of my answer.

First of all, you should place the OverlayBitmap in the "Display Path". That means, the texts are shown in the display only and the sink, where you do the image processing on, is untouched.

IcImagingControl1.OverlayBitmapPosition = TIS.Imaging.PathPositions.Display

You can call this e.g. in the Form_Load sub.

The Overlay is valid, after the live video has been prepared. This means, either after you called
IcImagingControl1.LivePrepare()

' do something in here ...

IcImagingControl1.LivePrepare()

or
IcImagingControl1.LiveStart()


So a complete segement of code looks like this:



If IcImagingControl1.DeviceValid Then
IcImagingControl1.LivePrepare()
Dim Overlay As TIS.Imaging.OverlayBitmap = IcImagingControl1.OverlayBitmapAtPath(TIS.Imaging. PathPositions.Display)

Overlay.Enable = True
Overlay.DrawText(Color.Red, 10, 10, "Hello World")


IcImagingControl1.LiveStart()

Overlay.DrawText(Color.Red, 10,25, "I am live!")


End If

Stefan Geissler
February 25, 2015, 10:54:28
Good Morning Franck!

Sorry for the delay of my answer.

First of all, you should place the OverlayBitmap in the "Display Path". That means, the texts are shown in the display only and the sink, where you do the image processing on, is untouched.

IcImagingControl1.OverlayBitmapPosition = TIS.Imaging.PathPositions.Display

You can call this e.g. in the Form_Load sub.

The Overlay is valid, after the live video has been prepared. This means, either after you called
IcImagingControl1.LivePrepare()

' do something in here ...

IcImagingControl1.LivePrepare()

or
IcImagingControl1.LiveStart()


So a complete segement of code looks like this:



If IcImagingControl1.DeviceValid Then
IcImagingControl1.LivePrepare()
Dim Overlay As TIS.Imaging.OverlayBitmap = IcImagingControl1.OverlayBitmapAtPath(TIS.Imaging. PathPositions.Display)

Overlay.Enable = True
Overlay.DrawText(Color.Red, 10, 10, "Hello World")


IcImagingControl1.LiveStart()

Overlay.DrawText(Color.Red, 10,25, "I am live!")


End If

Franck M57
February 28, 2015, 18:27:28
Hello,



Sorry for the delay of my answer.


There is no emergency. It is already very well having technical assistance.



My code was missing "IcImagingControl1.OverlayBitmapPosition = TIS.Imaging.PathPositions.Display"

The overlay no longer changes the value of the pixels. Very well.

I tried to put the color overlay but I can not. The superimposed information is in grayscale.

I selected "ICRGB24" in "MemoryCurrentGrabberColorFormat" of IcImagingControl1
I added "IcImagingControl1.OverlayBitmap.ColorMode = OverlayColorModes.Color" in Form_load.

But the overlay is still in grayscale.

Is it possible to have color with "PathPositions.Display"?

Franck

Stefan Geissler
March 2, 2015, 11:50:39
Hello Franck

use

// Force the overlay bitmap to operate in color mode.
ICImagingControl1.OverlayBitmap.ColorMode = OverlayColorModes.Color;

for having the overlay colored. Please refer to:

http://www.theimagingsource.com/en_US/support/documentation/icimagingcontrol-dotnet/prop_descOverlayBitmap_ColorMode.htm

Stefan Geissler
March 2, 2015, 11:50:39
Hello Franck

use

// Force the overlay bitmap to operate in color mode.
ICImagingControl1.OverlayBitmap.ColorMode = OverlayColorModes.Color;

for having the overlay colored. Please refer to:

http://www.theimagingsource.com/en_US/support/documentation/icimagingcontrol-dotnet/prop_descOverlayBitmap_ColorMode.htm