# Getting Started with CVBpy

**URL:** <https://forum.commonvisionblox.com/t/getting-started-with-cvbpy/241>\
**Category:** Python API\
**Created:** [September 26, 2017, 7:42am UTC](https://forum.commonvisionblox.com/t/getting-started-with-cvbpy/241 "2017-09-26T07:42:41Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Andreas](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/andreas/32/75_2.png) [@Andreas](https://forum.commonvisionblox.com/u/Andreas)\
**Post date:** [February 22, 2018, 12:17pm UTC](https://forum.commonvisionblox.com/t/getting-started-with-cvbpy/241/6 "2018-02-22T12:17:18Z")

</div>

# Acquire from a Camera

This is very simelar to the things shown above.

> [@Andreas](#):
>
> Loading Image Stream Sources

1. load the device. This will open the first configured GenICam device.

```python
vin_device = cvb.DeviceFactory.open(cvb.install_path() + "/drivers/GenICam.vin")
stream = vin_device.stream

```

1. Before you can get any images start the stream.

```python
stream.start()

```

1. Wait for 10 images and print some information about them.

```pythpn
try:
    for i in range(0 ,10):
        image, status = stream.wait_for(1000)
        if status == cvb.WaitStatus.Ok:
            print("Acquired image " + str(i) + " into buffer " + 
               str(image.buffer_index) + ".")
        else:
            raise RuntimeError("timeout during wait" 
                if status == cvb.WaitStatus.Timeout else 
                    "acquisition aborted")
except:
    pass 
finally:
    stream.try_abort()

```

Please note that, although errors are unlikely in this simple example and I just pass them it is usually a good idea to handle them, and at least always stop the stream so that stay in a defined state.

The output given you have three (default) buffers allocated would be:

```auto
Acquired image 0 into buffer 0.
Acquired image 1 into buffer 1.
Acquired image 2 into buffer 2.
Acquired image 3 into buffer 0.
Acquired image 4 into buffer 1.
Acquired image 5 into buffer 2.
Acquired image 6 into buffer 0.
Acquired image 7 into buffer 1.
Acquired image 8 into buffer 2.
Acquired image 9 into buffer 0.

```

---

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