# Getting Started with CVB.Net

**URL:** <https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246>\
**Category:** .Net API\
**Tags:** csharp, tutorial\
**Created:** [September 9, 2019, 10:00pm UTC](https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246 "2019-09-09T22:00:00Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![parsd](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/parsd/32/7_2.png) [@parsd](https://forum.commonvisionblox.com/u/parsd)\
**Post date:** [September 10, 2019, 12:29am UTC](https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246/3 "2019-09-10T00:29:03Z")

</div>

# Loading Image Stream Sources (Console)

Previously we have seen how to load and save single images with :cvb::

> [@parsd](#):
>
> # Loading and Saving Images (Console)

In Common Vision Blox we mostly deal with cameras which send a stream of images. So let’s have a look how to do this (with an _AVI_ video for starters):

1. Add namespaces (we only need _Stemmer.Cvb.dll_):

2. We use a tutorial video:

3. Stream sources are `Device`s:

4. And these have `Stream`s and `DeviceImage`s:

With these objects we can print out some very basic information:

```auto
Console.WriteLine("Video:");
Console.WriteLine(" Resolution: " + deviceImage.Size);
Console.WriteLine(" Color model: " + deviceImage.ColorModel);
Console.WriteLine(" Frames: " + stream.ImageCount);

```

If we execute this, we get:

```auto
Video:
  Resolution: [1024; 576]
  Color model: RGBGuess
  Frames: 300

```

We take a look into acquisition later on.

## Quick Overview of the Types

> **Stream vs IndexedStream**
>
> The `IndexedStream` is a special kind of `Stream`. A `Stream` is a possibly endless stream of `Image`s (e.g. from a camera). An `IndexedStream` is a finite stream with an `ImageCount`. To access this special property we needed to downcast the `Stream` into an `IndexedStream` via `as`. Both video-streams and emu-streams are indexed.

> **ColorModel and Planes**
>
> Perhaps you wondered about `ColorModel.RGBGuess`. :cvb: `Image`s only know `ImagePlane`s. A Mono8 image would have one plane with a `DataType` `DataTypes.Int8BppUnsigned` (8 bit per pixel unsigned integer – or `byte` for short 🙂). An RGB8 image on the other hand would have three planes with a `byte` `DataType` each.
> 
> This information is not enough to really determine the color model: YUV or HSV images also have three planes. When :cvb: was conceived 20 years ago, the _Windows Bitmap_ was widely used and it only worked with monochrome or RGB images (even the indexed images resulted in RGB images). Thus we assumed three planes being RGB. (A lot of our algorithms actually do not care about the color model or even work on only one `ImagePlane`.)
> 
> If you use `Stemmer.Cvb.Foundation.ConvertColorSpace` methods, you get the actual `ColorModel` from the resulting images.

> **Image vs DeviceImage**
>
> A `DeviceImage` is a very special kind of `Image`. Normally the pixel buffer stays the same for a given `Image`. A `DeviceImage` on the other hand represents the latest image from a `Device`. The object stays the same, but the pixel buffer changes. Thus you should be careful when using these images when you process their image data – especially in multi-threaded environments. For display purposes on the other hand these images are perfect.
> 
> But the pixel buffer does not change randomly: only if you call one of the `Stream.Wait` or `Stream.GetSnapshot` methods. Acquisition will be handled later in more detail.

---

_[View the full topic](https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246)._
