< Return to Video

How to develop with Common Vision Blox (CVB)

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

more » « less
Video Language:
English
Duration:
09:52
webmaster9 edited English subtitles for How to develop with Common Vision Blox (CVB)
webmaster9 added a translation

English subtitles

Revisions