[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:11.58,0:00:14.23,Default,,0000,0000,0000,,Hello my name is Sascha Dorenbeck. Dialogue: 0,0:00:14.39,0:00:16.49,Default,,0000,0000,0000,,I'm Image Processing Senior Developper at STEMMER IMAGING. Dialogue: 0,0:00:16.83,0:00:25.10,Default,,0000,0000,0000,,Today, I'm in the STEMMER IMAGING European Training Center and I will talk about how easy it is to acquire and display an image with Common Vision Blox (CVB). Dialogue: 0,0:00:25.10,0:00:30.37,Default,,0000,0000,0000,,We're doing the application in Microsoft Visual Studio and I chose C#. Dialogue: 0,0:00:30.37,0:00:37.51,Default,,0000,0000,0000,,We can use any supported Common Vision Blox language but for simplicity and speed I simply chose C#. Dialogue: 0,0:00:37.51,0:00:44.73,Default,,0000,0000,0000,,First, we need to create a C# project, so I click on "New project". Dialogue: 0,0:00:44.73,0:00:48.89,Default,,0000,0000,0000,,Here, I make sure that I select the "Windows Forms" application Dialogue: 0,0:00:48.89,0:00:57.38,Default,,0000,0000,0000,,and give our example application a good name like "CVB Display". Dialogue: 0,0:00:57.38,0:01:04.06,Default,,0000,0000,0000,,Check that we have "Windows Forms" application and a nice name, then click OK. Dialogue: 0,0:01:04.06,0:01:09.09,Default,,0000,0000,0000,,After a short while you will see the form we will work on now. Dialogue: 0,0:01:09.09,0:01:14.55,Default,,0000,0000,0000,,First, we need to import the Common Vision Blox Active X controls to work with. Dialogue: 0,0:01:14.55,0:01:21.80,Default,,0000,0000,0000,,To do that, scroll down on the toolbox to the general tab and right-click on the area here Dialogue: 0,0:01:21.80,0:01:27.45,Default,,0000,0000,0000,,and in the context menu shown here you click on "Choose items". Dialogue: 0,0:01:28.24,0:01:34.48,Default,,0000,0000,0000,,In this dialoge we simply switch to "Com components tab" because Active X Controls are also com components. Dialogue: 0,0:01:34.48,0:01:37.26,Default,,0000,0000,0000,,We need two Active X Controls. Dialogue: 0,0:01:37.26,0:01:41.39,Default,,0000,0000,0000,,The first one is Common Vision Display control. Dialogue: 0,0:01:41.39,0:01:45.40,Default,,0000,0000,0000,,And the next one would be the Common Vision Image control. Dialogue: 0,0:01:45.40,0:01:49.91,Default,,0000,0000,0000,,Select both and click OK. Dialogue: 0,0:01:49.91,0:01:55.70,Default,,0000,0000,0000,,After that, we see that we have both the display and the image control in our tab. Dialogue: 0,0:01:55.70,0:02:00.55,Default,,0000,0000,0000,,Select the display control and left-click in the form. Dialogue: 0,0:02:00.55,0:02:06.08,Default,,0000,0000,0000,,Now Visual Studio will import the Active X Control in our Microsoft Visual Studio project. Dialogue: 0,0:02:06.08,0:02:09.92,Default,,0000,0000,0000,,The display is now shown here so we position it a bit. Dialogue: 0,0:02:09.92,0:02:16.81,Default,,0000,0000,0000,,As you would guess probably the display is used to display images or video streams. Dialogue: 0,0:02:16.81,0:02:22.76,Default,,0000,0000,0000,,To control the image streams, we use the Common Vision Blox image control. Dialogue: 0,0:02:22.76,0:02:27.98,Default,,0000,0000,0000,,So we also put it into our form. Dialogue: 0,0:02:29.48,0:02:34.36,Default,,0000,0000,0000,,What's important: the image control is not a visual user interface control, Dialogue: 0,0:02:34.36,0:02:37.57,Default,,0000,0000,0000,,it just helps us to implement our form or processing, Dialogue: 0,0:02:37.57,0:02:42.07,Default,,0000,0000,0000,,so you can position it anywhere it won't be shown later in the application. Dialogue: 0,0:02:42.07,0:02:44.03,Default,,0000,0000,0000,,So these are our core components Dialogue: 0,0:02:44.03,0:02:49.74,Default,,0000,0000,0000,,but we want to do something with it so we add a few other controls to control what we are doing. Dialogue: 0,0:02:49.74,0:02:54.71,Default,,0000,0000,0000,,First, we need a button, so we put the button in here Dialogue: 0,0:02:54.71,0:02:58.56,Default,,0000,0000,0000,,and we need a checkbox. Dialogue: 0,0:02:59.56,0:03:04.01,Default,,0000,0000,0000,,Position it, align it and we're done. Dialogue: 0,0:03:04.01,0:03:07.20,Default,,0000,0000,0000,,Now what do we want to do with the button? Dialogue: 0,0:03:07.20,0:03:12.88,Default,,0000,0000,0000,,This we use to open an image source for CVB which is called a driver. Dialogue: 0,0:03:12.88,0:03:20.52,Default,,0000,0000,0000,,So we give it a nice name and call it "Open button". Dialogue: 0,0:03:20.52,0:03:24.97,Default,,0000,0000,0000,,This would be the name we use later on in the source code. Dialogue: 0,0:03:24.97,0:03:30.70,Default,,0000,0000,0000,,And we need also a nice name for our user so we name this button "Open". Dialogue: 0,0:03:30.70,0:03:36.70,Default,,0000,0000,0000,,To do that we select a text property and give it a readable name which is then displayed on the button. Dialogue: 0,0:03:36.70,0:03:40.75,Default,,0000,0000,0000,,We also want to start or stop the aquisition. Dialogue: 0,0:03:41.29,0:03:43.70,Default,,0000,0000,0000,,For that, we go to the checkbox Dialogue: 0,0:03:43.70,0:03:49.16,Default,,0000,0000,0000,,and in CVB we call starting / stopping acquisition or acquisition handling in general grabbing. Dialogue: 0,0:03:49.86,0:03:54.56,Default,,0000,0000,0000,,Grabbing comes from the term frame grabber, so we grab an image. Dialogue: 0,0:03:54.56,0:03:59.31,Default,,0000,0000,0000,,So we call this checkbox "Grab checkbox" Dialogue: 0,0:03:59.31,0:04:02.85,Default,,0000,0000,0000,,and also have a nice display text for it. Dialogue: 0,0:04:03.08,0:04:06.43,Default,,0000,0000,0000,,We simply call it "Grab". Dialogue: 0,0:04:06.77,0:04:09.49,Default,,0000,0000,0000,,This is everything we need for our form. Dialogue: 0,0:04:09.49,0:04:12.51,Default,,0000,0000,0000,,So we now want to fill it with life. Dialogue: 0,0:04:12.51,0:04:20.90,Default,,0000,0000,0000,,So we go to the open button and double-click it to wire its click event handler. Dialogue: 0,0:04:20.90,0:04:24.21,Default,,0000,0000,0000,,So now we have an event function which is called on a click. Dialogue: 0,0:04:24.21,0:04:30.63,Default,,0000,0000,0000,,And to open a CVB image source we can use the image Active X Control. Dialogue: 0,0:04:30.63,0:04:36.20,Default,,0000,0000,0000,,Active X Controls are always prefixed by default with an AX in Visual Studio. Dialogue: 0,0:04:36.20,0:04:40.01,Default,,0000,0000,0000,,So if I type AX I see all Active X Controls Dialogue: 0,0:04:40.01,0:04:49.23,Default,,0000,0000,0000,,and go to the image control as utility method on this control which is called "load image" by dialogue. Dialogue: 0,0:04:49.23,0:04:54.88,Default,,0000,0000,0000,,This opens a file dialogue to choose a CVB driver. Dialogue: 0,0:04:55.90,0:05:02.69,Default,,0000,0000,0000,,To check if everything went OK, we put an if-clause around it. Dialogue: 0,0:05:04.06,0:05:09.76,Default,,0000,0000,0000,,If the function succeeds it returns true and we can go to the if body. Dialogue: 0,0:05:09.76,0:05:17.90,Default,,0000,0000,0000,,If everything is successful we need to make the display aware of the image we now loaded. Dialogue: 0,0:05:17.90,0:05:23.90,Default,,0000,0000,0000,,To do that we go via display Dialogue: 0,0:05:23.90,0:05:26.53,Default,,0000,0000,0000,,and use its image property. Dialogue: 0,0:05:26.53,0:05:29.09,Default,,0000,0000,0000,,This image property represents a CVB image. Dialogue: 0,0:05:29.09,0:05:37.37,Default,,0000,0000,0000,,So we need to simply assign the image property of the image control we used before loading the image Dialogue: 0,0:05:37.37,0:05:40.46,Default,,0000,0000,0000,,and assigning it to the display. Dialogue: 0,0:05:40.46,0:05:45.80,Default,,0000,0000,0000,,So now the display knows about the loaded image. Dialogue: 0,0:05:45.80,0:05:51.03,Default,,0000,0000,0000,,This is fine so far but we now want to enable and disable the grab, so life acquisition. Dialogue: 0,0:05:51.03,0:05:55.98,Default,,0000,0000,0000,,So we go to the "Grab" checkbox and also double-click it to wire the check / change event. Dialogue: 0,0:05:58.25,0:06:05.82,Default,,0000,0000,0000,,To enable and disable the grab we can use the image control's grab property. Dialogue: 0,0:06:05.82,0:06:08.33,Default,,0000,0000,0000,,This is a Boolean value. Dialogue: 0,0:06:08.33,0:06:11.43,Default,,0000,0000,0000,,If set to true the grab is enabled, so life acquisition is on. Dialogue: 0,0:06:11.43,0:06:15.57,Default,,0000,0000,0000,,And if false, life acquisition is disabled. Dialogue: 0,0:06:15.57,0:06:18.96,Default,,0000,0000,0000,,The grab checkbox we used before has a nice property. Dialogue: 0,0:06:18.96,0:06:23.73,Default,,0000,0000,0000,,It's called checked which is true if it's checked and false if not, Dialogue: 0,0:06:23.73,0:06:27.33,Default,,0000,0000,0000,,so simply enabling / disabling all acquisition. Dialogue: 0,0:06:27.33,0:06:30.11,Default,,0000,0000,0000,,So now we enabled the grab but we want to see images. Dialogue: 0,0:06:30.11,0:06:33.66,Default,,0000,0000,0000,,So we need to tell the display that the new image arrived in the system. Dialogue: 0,0:06:33.66,0:06:39.100,Default,,0000,0000,0000,,To do that, we go again to the image control and go to the "Events". Dialogue: 0,0:06:39.100,0:06:44.88,Default,,0000,0000,0000,,You need to do this here because the event we're using now is not a default event. Dialogue: 0,0:06:44.88,0:06:48.63,Default,,0000,0000,0000,,So we go now to the image snapped event. Dialogue: 0,0:06:48.63,0:06:51.100,Default,,0000,0000,0000,,This is called always when a new image arrives in the system. Dialogue: 0,0:06:51.100,0:06:57.46,Default,,0000,0000,0000,,To wire it, simply double-click in the text control right next to it. Dialogue: 0,0:06:57.46,0:07:01.21,Default,,0000,0000,0000,,What we simply want to do here is tell the display to redraw itself. Dialogue: 0,0:07:01.21,0:07:06.80,Default,,0000,0000,0000,,So we go to the display and call the refresh method. Dialogue: 0,0:07:06.80,0:07:12.07,Default,,0000,0000,0000,,That's all we need currently to show an image and grab it. Dialogue: 0,0:07:12.07,0:07:15.49,Default,,0000,0000,0000,,So we can fire up the application. Dialogue: 0,0:07:15.49,0:07:17.49,Default,,0000,0000,0000,,Now we see the application here. Dialogue: 0,0:07:17.49,0:07:21.56,Default,,0000,0000,0000,,I prepared a simple camera set-up with a GigE Vision camera. Dialogue: 0,0:07:21.56,0:07:25.06,Default,,0000,0000,0000,,So we want to open the GigE Vision camera. Dialogue: 0,0:07:25.06,0:07:29.74,Default,,0000,0000,0000,,We click on the "Open" button and now we get a file dialogue. Dialogue: 0,0:07:29.74,0:07:34.39,Default,,0000,0000,0000,,There's a simple or handy shortcut: you can use the environment variable CVB. Dialogue: 0,0:07:34.39,0:07:44.43,Default,,0000,0000,0000,,So you type %CVB% and then Enter which directly brings you to the Common Vision Blox directory on your disc. Dialogue: 0,0:07:44.43,0:07:47.42,Default,,0000,0000,0000,,Here you can go to the "Drivers" subdirectory Dialogue: 0,0:07:47.42,0:07:51.05,Default,,0000,0000,0000,,and now select the GenICam driver. Dialogue: 0,0:07:51.05,0:07:56.19,Default,,0000,0000,0000,,So you can see the driver by the Common Vision Blox symbol in front of it. Dialogue: 0,0:07:56.19,0:08:01.84,Default,,0000,0000,0000,,A GigE Vision device is a GenICam device so we can open it with a GenICam driver. Dialogue: 0,0:08:02.79,0:08:05.83,Default,,0000,0000,0000,,So we now open it Dialogue: 0,0:08:05.83,0:08:09.49,Default,,0000,0000,0000,,and we see it acquired a first image. Dialogue: 0,0:08:09.49,0:08:12.24,Default,,0000,0000,0000,,So now we want to introduce a life stream. Dialogue: 0,0:08:12.24,0:08:15.27,Default,,0000,0000,0000,,I can simply click on "Grab" Dialogue: 0,0:08:15.27,0:08:19.97,Default,,0000,0000,0000,,and if I now move the part a bit you see we have a life image. Dialogue: 0,0:08:19.97,0:08:26.73,Default,,0000,0000,0000,,So this is all you need to do to bring a life image in with CVB. Dialogue: 0,0:08:29.01,0:08:31.29,Default,,0000,0000,0000,,So to summarize everything: Dialogue: 0,0:08:31.29,0:08:37.07,Default,,0000,0000,0000,,you just need four simple lines of code to load an image source Dialogue: 0,0:08:37.07,0:08:41.20,Default,,0000,0000,0000,,which is done here by "load image by dialogue" Dialogue: 0,0:08:41.20,0:08:46.93,Default,,0000,0000,0000,,or you can use "load image" if you have a hard wired driver you want to use. Dialogue: 0,0:08:46.93,0:08:51.03,Default,,0000,0000,0000,,Then we need to make the image source known to the display Dialogue: 0,0:08:51.03,0:08:58.41,Default,,0000,0000,0000,,which we do here by assigning the image properties from the image handling control / the image control to the display control. Dialogue: 0,0:08:58.41,0:09:00.94,Default,,0000,0000,0000,,Then we want to enable / disable the grabbing, Dialogue: 0,0:09:00.94,0:09:08.82,Default,,0000,0000,0000,,so the life streaming which we do via the grab property by simply assigning the checked state. Dialogue: 0,0:09:08.82,0:09:12.19,Default,,0000,0000,0000,,And if a new image arrives we have the image snapped event Dialogue: 0,0:09:12.19,0:09:16.17,Default,,0000,0000,0000,,and here we simply tell the display to re-draw itself. Dialogue: 0,0:09:16.17,0:09:21.98,Default,,0000,0000,0000,,So these are the only four lines of Common Vision Blox source code you need. Dialogue: 0,0:09:22.55,0:09:29.65,Default,,0000,0000,0000,,This training was about to show how easy it is to acquire and display an image with Common Vision Blox. Dialogue: 0,0:09:29.65,0:09:34.53,Default,,0000,0000,0000,,For additional information on Common Vision Blox, additional trainings and onsite trainings, Dialogue: 0,0:09:34.53,0:09:37.60,Default,,0000,0000,0000,,please visit our website www.stemmer-imaging.com