Rahul  Hickle

Rahul Hickle


Raspberrypi + Opencv

環境(version)Opencv:3.2.1python:3.7raspberrypi:zerowebカメラ:bufflo したいこと単純にカメラデバイスで画像をとり画像を保存したいだけです。 コードこれだけ。opencvのコードはこれだけなのか…(opencv-camera.py)

#raspberrypi #opencv #progamming

What is GEEK

Buddha Community

Raspberrypi + Opencv
Rahul  Hickle

Rahul Hickle


Raspberrypi + Opencv

環境(version)Opencv:3.2.1python:3.7raspberrypi:zerowebカメラ:bufflo したいこと単純にカメラデバイスで画像をとり画像を保存したいだけです。 コードこれだけ。opencvのコードはこれだけなのか…(opencv-camera.py)

#raspberrypi #opencv #progamming

Verda  Conroy

Verda Conroy


Create a Virtual Pen and Eraser with Python OpenCV - Genial Code

Learn Free how to create a virtual pen and eraser with python and OpenCV with source code and complete guide. This entire application is built fundamentally on contour detection. It can be thought of as something like closed color curves on compromises that have the same color or intensity, it’s like a blob. In this project we use color masking to get the binary mask of our target color pen, then we use the counter detection to find the location of this pen and the contour to find it.

#python #create virtual pen and eraser with opencv #create virtual pen and eraser with python opencv #programming #opencv #python opencv

A Simple HDR Implementation on OpenCV Python

Learn how to create a high dynamic range (HDR) image using Python and OpenCV

HDR images encompass the information of multiple pictures with different exposures. In a scene which the source of light is uneven, a single shot may overexpose certain areas of the image and details will be lost due to elevated brightness. Conversely, this picture may also present underexposed areas which will also lead to information loss.

To create an HDR image you will need:

  1. Take pictures with different exposures. Minimum of 2, generally 3, you can use more than 3 images but it will take a lot of CPU resources.
  2. Align the images. Even if you use a tripod you will need to perform this step (we are talking about pixel level alignment). Not properly aligning your image will lead to artifacts and ‘ghosts’ in your HDR image.
  3. Merge the aligned images into one.
  4. Perform tone mapping on the merged image. In nature the minimum possible brightness is zero but the maximum is not limited to 255, in fact there is no limit to it, it can be infinity. For this reason we need to map the image obtained in the third step to a (0, 255) range. This can be achieved with tone mapping.

#hdr #opencv #computer-vision #python #opencv #opencv python

Hertha  Walsh

Hertha Walsh


OpenCV + CUDA + AWS EC2 + (No More Tears)

By default, there is no need to enable OpenCV with CUDA for GPU processing, but during production, when you have heavy OpenCV manipulations to do on image/video files, we can make use of the OpenCV CUDA library to make those operations to run on GPU rather than CPU and it saves a lot of time.

It was not easy as it is said to connect the OpenCV library to enable it with CUDA, I had to go through a painful process for a week to establish the connection properly, also its both time & money consuming process. So this time I want to record the overall process for my future, as well as for others.

For the demonstration, I am renting an EC2 instance with a p3.8xlarge instance in the AWS, which has 4 Nvidia GPUs.

Image for post

Source — AWS EC2 Pricing

So if you need any help in starting an EC2 instance for the first time, you can refer to my previous post on Step by Step Creation of an EC2 Instance in AWS and Access it via Putty & WinSCP and during the process select the GPU instance you require.

Now after ssh-ing into the instance, before we get into the process we need to install a lot of packages to make the environment ready.

_Note: I have consolidated all the commands I ran from start to end and added them at the bottom. If you are more curious find them here in this __link _and follow along.

Run the below commands one after another on your instance and also I have attested the screenshots to compare the outputs against mine.

All the screenshots used hereafter are sourced by the author.

Table of Contents:

  1. Install OpenCV Dependencies, Nvidia CUDA driver, CUDA toolkit
  2. Download OpenCV Source Code
  3. Configure Python Virtual Environment
  4. Determine Your CUDA Architecture Version
  5. Configure OpenCV with Nvidia GPU Support
  6. Compile OpenCV and Create a Symbolic link
  7. References
  8. History of Commands

Step 1: Install OpenCV Dependencies, Nvidia CUDA driver, CUDA toolkit.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake unzip pkg-config
sudo apt-get install gcc-6 g++-6
sudo apt-get install screen
sudo apt-get install libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libopenblas-dev libatlas-base-dev liblapack-dev gfortran
sudo apt-get install libhdf5-serial-dev
sudo apt-get install python3-dev python3-tk python-imaging-tk
sudo apt-get install libgtk-3-dev
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-driver-418
sudo reboot

#opencv-in-ubuntu #opencv-python #cuda #nvidia #opencv #ubuntu

OpenCV putText() - Writing Text on Images

Hello fellow learner! In this tutorial, we will learn how to write string text on Images in Python using the OpenCV putText() method. So let’s get started.

Table of Contents

What is the OpenCV putText() method?

OpenCV Python is a library of programming functions mainly aimed at real-time computer vision and image processing problems.

OpenCV contains putText() method which is used to put text on any image. The method uses following parameters.

  • img: The Image on which you want to write the text.
  • text: The text you want to write on the image.
  • org: It is the coordinates of the Bottom-Left corner of your text. It is represented as a tuple of 2 values (X, Y). X represents the distance from the left edge and Y represents the distance from the top edge of the image.
  • fontFace: It denotes the type of font you want to use. OpenCV supports only a subset of Hershey Fonts.
  • fontScale: It is used to increase/decrease the size of your text. The font scale factor is multiplied by the font-specific base size.
  • color: It represents the color of the text that you want to give. It takes the value in BGR format, i.e., first blue color value, then green color value, and the red color value all in range 0 to 255.
  • thickness (Optional): It represents the thickness of the lines used to draw a text. The default value is 1.
  • lineType (Optional): It denotes the type of line you want to use. 4 LineTypes available are
  • LINE_4
  • LINE_8 (Default)
  • bottomLeftOrigin (Optional): When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner. The default value is False.

#python modules #opencv #opencv puttext() #writing text on images #opencv puttext() - writing text on images #puttext() - writing text