Ads

Tampilkan postingan dengan label Tutorial OpenCV. Tampilkan semua postingan
Tampilkan postingan dengan label Tutorial OpenCV. Tampilkan semua postingan

Selasa, 31 Juli 2018

Tracking Circle with OPENCV Camera


Detection and Tracking circles with the Camera using Opencv - this time admin posts Detect and Tracking circles with Camera using Open CV or can be called Tracking Hough Circle with Camera.
In this tutorial, we will definitely be faced with a camera, for sample open camera coding, can be seen in the previous article "Access webcam camera with Open CV". This article is a combination of loop detection and camera. wow, how about it, sir? so we can detect circles in realtime with the camera and issue the position value of the circle in realtime, of course. Just look at the coding below.

Source Code [Raw
import cv2

videoCam = cv2.VideoCapture(1)

while True:
    cond, frame = videoCam.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1.2, 100)

    if circles is not None:
        circles = np.round(circles[0, :]).astype("int")
        for (x,y,radius) in circles:
            cv2.circle(frame, (x,y),radius, (0,255,0), 4)
            cv2.rectangle(frame, (x - 5, y - 5), (x + 5, y + 5), (0,128,255),1)
            nilaix = str(x)
            nilaiy = str(y)
            nilair = str(radius)
            if radius > 10:
                print('nilai x = ' + nilaix + ' | nilai y = ' + nilaiy + ' | nilai radius = ' + nilair)

    
    cv2.imshow('Original Video', frame)
    
    
    #cv2.imshow('Gray Video', gray)

    k = cv2.waitKey(1) & 0xff
    if k == ord('q'):
        break

videoCam.release()
cv2.destroyAllWindows()

Note :
Here I use Video Capture (1). because "0" for cameras on laptops, and "1" for external cameras.
Thanks For Reading tutorial "Detection and Tracking circles with the Camera using Opencv" .

Tag :

  • OpenCv Camera
  • OpenCV Pyhton Camera
  • Opencv python tracking circle

Sabtu, 12 Mei 2018

Access webcam camera with OpenCV Python


Access webcam camera with OpenCV python - this time admin posts How to Access webcam cameras using openCV in python.
This tutorial is the basic of OpenCV, which is accessing the camera / webcam. Camera access is an important aspect in using opencv itself. Because opencv itself is more often to access a camera / webcam. Here the admin uses a logitech camera and uses python version 3. Can also access from laptop webcam default. Just look at the source code below.


Source Code :


import cv2 #untuk memanggil komponen opencv python

videoCam = cv2.VideoCapture(0) #webcam / kamera yang digunakan
videoCam.set(cv2.CAP_PROP_FRAME_WIDTH,720) # panjang panel kamera
videoCam.set(cv2.CAP_PROP_FRAME_HEIGHT,480) # lebar panel kamera
while True:
    cond, frame = videoCam.read() # membaca kondisi apabila frame sudah ada

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # cara mengkonvert gambar BGR ke Mode Gray
    cv2.imshow('Original Video', frame) # menampilkan video aslinya
    cv2.imshow('Gray Video', gray) # menampilkan video asli dengan efek gray

    k = cv2.waitKey(1) & 0xff
    if k == ord('q'): # jika menekan Q maka program akan exit.
        break

videoCam.release()
cv2.destroyAllWindows()


Note :
If using 2 cameras, change the number 1 or 0 on VideoCapture (1)

Screenshot Program Result :


Senin, 26 Maret 2018

INSTALL OPENCV PYTHON IN WINDOWS

 

How to Install OpenCV Python Windows - this time the admin posts How to Install OpenCv Python easily and quickly. only use CMD on windows.
OpenCV (Open Source Computer Vision Library) is a software library aimed at real-time dynamic image processing, created by Intel, and now supported by Willow Garage and Itseez. This program is free and is under the auspices of an open source of BSD licenses. This library is a cross platform library. This program is dedicated in large part to real-time image processing. If this library finds the library of Integrated Performance Primitives from Intel in a computer system, then this program will use this routine to speed up the process of working this program automatically.
Python is a multipurpose interpretive programming language with a design philosophy that focuses on the level of code readability. Python is claimed to be a language that combines capabilities, capabilities, with very clear code syntax, and is equipped with a large and comprehensive standard library functionality. Python is also supported by a large community.
Currently python code can be run on a variety of operating system platforms, some of which are Linux / Unix, Windows, Mac OS X, Java Virtual Machine, OS / 2, Amiga, Palm, Symbian

Screenshot :



Bahan yang dibutuhkan :

  • Internet
  • Latest version of Python 2/3
  • PC / Laptop for sure
  • A cup of coffee to be excited


Download Link :
- Python
[ Download ]

How to Install :
1. Install Python Jangan lupa centang "Add Python to Path"
2. open CMD 
3. type "pip install --upgrade pip" 
4. "pip install wheel" 
5. install open cv by typing "pip install opencv-python" 
6. install contrib opencv "pip install opencv-contrib-python" 
7. done :D
8. If you are still confused, see Tutorial Video below.