#reTerminal – Installing OpenCV, and using a USB WebCam 🤳
Tags: englishpost, reterminal, seeedstudio
Published: 2022-01-31 14:15:25

---
title: #reTerminal – Installing OpenCV, and using a USB WebCam 🤳
published: true
date: 2022-01-04 16:27:47 UTC
tags: EnglishPost,EnglishPost,reTerminal,SeeedStudio
canonical_url: 
---

<p>Hi !</p>

<p>Let's start with some posts using reTerminal with a very simple scenario:</p>

<h4 id="connect-a-camera-to-the-device-and-show-the-camera-feed-in-reterminal-display">Connect a Camera to the device and show the camera feed in reTerminal display</h4>

<p>The output is something similar to this one.</p>

<figure class="wp-block-image size-large"><img src="https://brunocapuano.files.wordpress.com/2022/01/reterminal-with-a-camera-displaying-the-camera-feed.png?w=1024" alt="reterminal with a camera displaying the camera feed" class="wp-image-35011"/></figure>

<p>And let´s start with the base code to run this, based on my previous posts on OpenCV (see references)</p>

{% gist https://gist.github.com/elbruno/8d64daca43a14028385f9e3c1d1babaa %}

<p>The main prerequisite to run this code is to have OpenCV installed. And this is a tricky process in a Raspberry Pi. I used to install all the necessary libraries and apps, and then build OpenCV in my device (see references). </p>

<p>Today I follow these steps to make this happens.</p>

<p>1st I install Virtual Environments to I can work in isolated modes for my tests. Run these scripts</p>

```python
sudo pip3 install virtualenv
virtualenv -p python3 camLabs
source camLabs/bin/activate</pre>
```

<p>Last line will activate my virtual environment.</p>

<p>Once I'm in the virtual environment, I can install OpenCV with the following command</p>

```python
sudo pip install opencv-contrib-python==4.1.0.25</pre>
```

<p>And run the quick test to validate the installation.</p>

<figure class="wp-block-image size-large"><img src="https://brunocapuano.files.wordpress.com/2022/01/image.png?w=797" alt="" class="wp-image-35022"/></figure>

<p>In the process I learned a couple of lessons about installation with amazing errors like these ones</p>

<figure class="wp-block-image size-large"><img src="https://brunocapuano.files.wordpress.com/2022/01/error-installing-opencv-on-reterminal-2.jpg?w=787" alt="error installing opencv on reterminal 2" class="wp-image-35018"/></figure>

<figure class="wp-block-image size-large"><img src="https://brunocapuano.files.wordpress.com/2022/01/error-installing-opencv-on-reterminal.jpg?w=787" alt="error installing opencv on reterminal" class="wp-image-35019"/></figure>

<p>At the end, the simple command to install OpenCV makes the magic!</p>
<h2 id="references">References</h2>
<ul><li><a rel="noreferrer noopener" href="https://wiki.seeedstudio.com/reTerminal/" target="_blank">SeeedStudio - Getting Started with reTerminal</a></li><li><a rel="noreferrer noopener" href="https://elbruno.com/2019/09/25/vscode-20-lines-to-display-a-webcam-camera-feed-with-python/" target="_blank">Visual Studio Code – 20 lines to display a webcam camera feed with Python using OpenCV</a></li><li><a rel="noreferrer noopener" href="https://elbruno.com/2020/01/23/raspberrypi-install-opencv/" target="_blank">RaspberryPi – Install OpenCV</a></li></ul>
<p></p>

[Continue reading #reTerminal – Installing OpenCV, and using a USB WebCam 🤳](https://elbruno.com/2022/01/04/reterminal-installing-opencv-and-using-a-camera-%f0%9f%a4%b3/)