How to Use OpenCV in PyCharm

OpenCV in PyCharm

OpenCV in PyCharm: In this post, I will share about how to use OpenCV in Pycharm. Pycharm is an incredible Python IDE. It is a product of JetBrains. It is available both as the community(free) edition and professional (paid) edition. I use the community edition of it and works great for my study purpose.  Check out more about PyCharm on their official website.

OpenCV in PyCharm

1. Install Python3.X.

I assume you have installed Python on your PC or laptop already. If you have not done it yet, do it now. Download it from the official Python website, based on the OS on which your machine runs.

You can check out my post on OpenCV installation with Python by clicking here.

2. Install OpenCV using PIP
To install you will have to use pip tool which comes along with your Python installation.
To install OpenCV, run the following command:

#pip install python-opencv

 

3. Test Installation
Test whether the installation is successful or not by importing OpenCV to your Python shell.
1. Open your command prompt and enter python
2. Type the following press enter:

import cv2

If no errors get echoed, your installation is successful!

Install Pycharm

If you have not install PyCharm, install it now. Download its installation file from its official website.

After the installation, do the following:
Create A Project
1. Create a new project

File > New Project

2. Name and Choose the project directory

3. Click on Create
3. Choose whether to open in new window or in existing Window and click OK

Window Selection
Window Selection

4. By default, PyCharm selects its virtual environment interpreter. To use OpenCV, select your own installation of Python. In your PyCharm click: File > Setting > Project: ‘Project name’ > Project Interpreter

Select interpreter
Select interpreter

5. Choose the Installation path of your python and click OK as shown above.

 

Test installation

Create a new file:
1. Select: File > New or use the shortcut combination: Alt + Insert
2. Choose Python File using arrow up and down keys
3. Enter a name and click OK
4. Import OpenCV and run the file.

If no errors get echoed, you can now use OpenCV with your PyCharm!

Leave a Reply

Discover more from BHUTAN IO

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top