OpenCV programming tutorial


In [2]:
%pylab inline
import cv2
import numpy as np
import matplotlib.pyplot as plt


Populating the interactive namespace from numpy and matplotlib

In [3]:
import os
import sys
sys.path.append(os.path.join(os.getcwd(), 'python'))

In [19]:
from mvq import path, data_path, images_path, videos_path

In [24]:
road_img = os.path.join(images_path, 'road.jpg')
img = cv2.imread(road_img, cv2.IMREAD_COLOR)

In [41]:
cv2.rectangle(img, (100, 300), (200, 400), (0, 255, 255), 2);
edges = cv2.Canny(img,150,300);

In [42]:
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB));



In [43]:
plt.imshow(edges, cmap='gray')


Out[43]:
<matplotlib.image.AxesImage at 0x7f43e984e278>

In [ ]: