How to develop with Common Vision Blox (CVB)
-
0:12 - 0:14Hello my name is Sascha Dorenbeck.
-
0:14 - 0:16I'm Image Processing Senior Developper at STEMMER IMAGING.
-
0:17 - 0:25Today, 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).
-
0:25 - 0:30We're doing the application in Microsoft Visual Studio and I chose C#.
-
0:30 - 0:38We can use any supported Common Vision Blox language but for simplicity and speed I simply chose C#.
-
0:38 - 0:45First, we need to create a C# project, so I click on "New project".
-
0:45 - 0:49Here, I make sure that I select the "Windows Forms" application
-
0:49 - 0:57and give our example application a good name like "CVB Display".
-
0:57 - 1:04Check that we have "Windows Forms" application and a nice name, then click OK.
-
1:04 - 1:09After a short while you will see the form we will work on now.
-
1:09 - 1:15First, we need to import the Common Vision Blox Active X controls to work with.
-
1:15 - 1:22To do that, scroll down on the toolbox to the general tab and right-click on the area here
-
1:22 - 1:27and in the context menu shown here you click on "Choose items".
-
1:28 - 1:34In this dialoge we simply switch to "Com components tab" because Active X Controls are also com components.
-
1:34 - 1:37We need two Active X Controls.
-
1:37 - 1:41The first one is Common Vision Display control.
-
1:41 - 1:45And the next one would be the Common Vision Image control.
-
1:45 - 1:50Select both and click OK.
-
1:50 - 1:56After that, we see that we have both the display and the image control in our tab.
-
1:56 - 2:01Select the display control and left-click in the form.
-
2:01 - 2:06Now Visual Studio will import the Active X Control in our Microsoft Visual Studio project.
-
2:06 - 2:10The display is now shown here so we position it a bit.
-
2:10 - 2:17As you would guess probably the display is used to display images or video streams.
-
2:17 - 2:23To control the image streams, we use the Common Vision Blox image control.
-
2:23 - 2:28So we also put it into our form.
-
2:29 - 2:34What's important: the image control is not a visual user interface control,
-
2:34 - 2:38it just helps us to implement our form or processing,
-
2:38 - 2:42so you can position it anywhere it won't be shown later in the application.
-
2:42 - 2:44So these are our core components
-
2:44 - 2:50but we want to do something with it so we add a few other controls to control what we are doing.
-
2:50 - 2:55First, we need a button, so we put the button in here
-
2:55 - 2:59and we need a checkbox.
-
3:00 - 3:04Position it, align it and we're done.
-
3:04 - 3:07Now what do we want to do with the button?
-
3:07 - 3:13This we use to open an image source for CVB which is called a driver.
-
3:13 - 3:21So we give it a nice name and call it "Open button".
-
3:21 - 3:25This would be the name we use later on in the source code.
-
3:25 - 3:31And we need also a nice name for our user so we name this button "Open".
-
3:31 - 3:37To do that we select a text property and give it a readable name which is then displayed on the button.
-
3:37 - 3:41We also want to start or stop the aquisition.
-
3:41 - 3:44For that, we go to the checkbox
-
3:44 - 3:49and in CVB we call starting / stopping acquisition or acquisition handling in general grabbing.
-
3:50 - 3:55Grabbing comes from the term frame grabber, so we grab an image.
-
3:55 - 3:59So we call this checkbox "Grab checkbox"
-
3:59 - 4:03and also have a nice display text for it.
-
4:03 - 4:06We simply call it "Grab".
-
4:07 - 4:09This is everything we need for our form.
-
4:09 - 4:13So we now want to fill it with life.
-
4:13 - 4:21So we go to the open button and double-click it to wire its click event handler.
-
4:21 - 4:24So now we have an event function which is called on a click.
-
4:24 - 4:31And to open a CVB image source we can use the image Active X Control.
-
4:31 - 4:36Active X Controls are always prefixed by default with an AX in Visual Studio.
-
4:36 - 4:40So if I type AX I see all Active X Controls
-
4:40 - 4:49and go to the image control as utility method on this control which is called "load image" by dialogue.
-
4:49 - 4:55This opens a file dialogue to choose a CVB driver.
-
4:56 - 5:03To check if everything went OK, we put an if-clause around it.
-
5:04 - 5:10If the function succeeds it returns true and we can go to the if body.
-
5:10 - 5:18If everything is successful we need to make the display aware of the image we now loaded.
-
5:18 - 5:24To do that we go via display
-
5:24 - 5:27and use its image property.
-
5:27 - 5:29This image property represents a CVB image.
-
5:29 - 5:37So we need to simply assign the image property of the image control we used before loading the image
-
5:37 - 5:40and assigning it to the display.
-
5:40 - 5:46So now the display knows about the loaded image.
-
5:46 - 5:51This is fine so far but we now want to enable and disable the grab, so life acquisition.
-
5:51 - 5:56So we go to the "Grab" checkbox and also double-click it to wire the check / change event.
-
5:58 - 6:06To enable and disable the grab we can use the image control's grab property.
-
6:06 - 6:08This is a Boolean value.
-
6:08 - 6:11If set to true the grab is enabled, so life acquisition is on.
-
6:11 - 6:16And if false, life acquisition is disabled.
-
6:16 - 6:19The grab checkbox we used before has a nice property.
-
6:19 - 6:24It's called checked which is true if it's checked and false if not,
-
6:24 - 6:27so simply enabling / disabling all acquisition.
-
6:27 - 6:30So now we enabled the grab but we want to see images.
-
6:30 - 6:34So we need to tell the display that the new image arrived in the system.
-
6:34 - 6:40To do that, we go again to the image control and go to the "Events".
-
6:40 - 6:45You need to do this here because the event we're using now is not a default event.
-
6:45 - 6:49So we go now to the image snapped event.
-
6:49 - 6:52This is called always when a new image arrives in the system.
-
6:52 - 6:57To wire it, simply double-click in the text control right next to it.
-
6:57 - 7:01What we simply want to do here is tell the display to redraw itself.
-
7:01 - 7:07So we go to the display and call the refresh method.
-
7:07 - 7:12That's all we need currently to show an image and grab it.
-
7:12 - 7:15So we can fire up the application.
-
7:15 - 7:17Now we see the application here.
-
7:17 - 7:22I prepared a simple camera set-up with a GigE Vision camera.
-
7:22 - 7:25So we want to open the GigE Vision camera.
-
7:25 - 7:30We click on the "Open" button and now we get a file dialogue.
-
7:30 - 7:34There's a simple or handy shortcut: you can use the environment variable CVB.
-
7:34 - 7:44So you type %CVB% and then Enter which directly brings you to the Common Vision Blox directory on your disc.
-
7:44 - 7:47Here you can go to the "Drivers" subdirectory
-
7:47 - 7:51and now select the GenICam driver.
-
7:51 - 7:56So you can see the driver by the Common Vision Blox symbol in front of it.
-
7:56 - 8:02A GigE Vision device is a GenICam device so we can open it with a GenICam driver.
-
8:03 - 8:06So we now open it
-
8:06 - 8:09and we see it acquired a first image.
-
8:09 - 8:12So now we want to introduce a life stream.
-
8:12 - 8:15I can simply click on "Grab"
-
8:15 - 8:20and if I now move the part a bit you see we have a life image.
-
8:20 - 8:27So this is all you need to do to bring a life image in with CVB.
-
8:29 - 8:31So to summarize everything:
-
8:31 - 8:37you just need four simple lines of code to load an image source
-
8:37 - 8:41which is done here by "load image by dialogue"
-
8:41 - 8:47or you can use "load image" if you have a hard wired driver you want to use.
-
8:47 - 8:51Then we need to make the image source known to the display
-
8:51 - 8:58which we do here by assigning the image properties from the image handling control / the image control to the display control.
-
8:58 - 9:01Then we want to enable / disable the grabbing,
-
9:01 - 9:09so the life streaming which we do via the grab property by simply assigning the checked state.
-
9:09 - 9:12And if a new image arrives we have the image snapped event
-
9:12 - 9:16and here we simply tell the display to re-draw itself.
-
9:16 - 9:22So these are the only four lines of Common Vision Blox source code you need.
-
9:23 - 9:30This training was about to show how easy it is to acquire and display an image with Common Vision Blox.
-
9:30 - 9:35For additional information on Common Vision Blox, additional trainings and onsite trainings,
-
9:35 - 9:38please visit our website www.stemmer-imaging.com
- Title:
- How to develop with Common Vision Blox (CVB)
- Description:
-
This video shows in an easy to follow step by step explanation how to acquire and display an image with the STEMMER IMAGING machine vision software Common Vision Blox (CVB). This tutorial is mainly intended for beginners in CVB programming.
Common Vision Blox is a flexible software development environment for imaging applications. With its core part "Image Manager" it provides the most comprehensive hardware independent acquisition API available. Coupled with some of the most advanced imaging algorithms and direct image access to other libraries, CVB enables developers freedom to choose what's best for each application.
To find out more about the wide portfolio of machine vision hardware and software components that STEMMER IMAGING provides please visit our homepage http://www.stemmer-imaging.com
To find out more about Common Vision Blox please visit http://www.stemmer-imaging.de/en/products/machine-vision-software/keywords/%7CCVB%7C
- Video Language:
- English
- Duration:
- 09:52
![]() |
webmaster9 edited English subtitles for How to develop with Common Vision Blox (CVB) | |
![]() |
webmaster9 added a translation |