Why is computer vision so hard

chodba chodba nakres

Object orientation

hrnek hrnek hrnek

Reflections

hrnek cd

In [5]:
%pylab inline --no-import-all
Populating the interactive namespace from numpy and matplotlib

klam

In [2]:
# %pylab inline --no-import-all
import scipy
import scipy.misc
import skimage
import skimage.io
import numpy as np
import urllib
# import cStringIO

import matplotlib.pyplot as plt
In [5]:
# scipy.misc.imread(
URL = "http://uc452cam01-kky.fav.zcu.cz/snapshot.jpg"
# URL = "http://plzen.cz/kamera.php?0.8989779513794929"
# URL = "http://www.chmi.cz/files/portal/docs/meteo/kam/pribram.jpg"

im = skimage.io.imread(URL)
# im = skimage.io.imread(URL, as_grey=True)
plt.imshow(im)
plt.show()
In [ ]:
 

Work with image

In [8]:
im.shape
Out[8]:
(480, 640, 3)
In [ ]:
 
In [8]:
im[50, 10, 0]
Out[8]:
106
In [ ]:
 
In [ ]:
 
In [9]:
im[10:15, 10:15, 0]
Out[9]:
array([[107, 108, 108, 109, 109],
       [106, 107, 108, 108, 108],
       [106, 106, 107, 108, 108],
       [105, 106, 106, 107, 107],
       [105, 106, 106, 107, 107]], dtype=uint8)
In [9]:
pole = [1,2,3,4,5,6,7,8,9]
print pole[::2]
[1, 3, 5, 7, 9]
In [15]:
im = scipy.misc.imread(URL)
im[130:140,:, 2] = 0
plt.imshow(im)
Out[15]:
<matplotlib.image.AxesImage at 0x7fe68b97c890>
In [16]:
plt.imshow(im[::10, ::10, :])
Out[16]:
<matplotlib.image.AxesImage at 0x7fe689294590>

Color to gray

In [18]:
import skimage.color
img = skimage.color.rgb2gray(im)
plt.imshow(img)
Out[18]:
<matplotlib.image.AxesImage at 0x7fe68b90a150>
In [ ]:
 

Plot

In [29]:
plt.imshow(img[50:350, 150:350, 0], cmap='gray')
Out[29]:
<matplotlib.image.AxesImage at 0x7f574c983bd0>
In [17]:
plt.axis('off')
plt.imshow(img)
plt.suptitle('muj titulek')
plt.plot([100,200,300, 400, 500], [100, 200, 50,300, 80])
plt.savefig('obrazek.png')
In [25]:
plt.subplot(2,2,1)
plt.imshow(img[:,:,0], cmap='gray')
plt.subplot(222)
plt.imshow(img[:,:,1], cmap='gray')
plt.subplot(223)
plt.imshow(img[:,:,2], cmap='gray')
plt.subplot(224)
plt.imshow(img[:,:])

plt.show()
In [9]:
plt.figure()
plt.imshow(img[:,:,0], cmap='gray')
plt.figure()
plt.imshow(img[:,:,1], cmap='gray')
plt.figure()
plt.imshow(img[:,:,2], cmap='gray')
plt.show()
In [ ]:
 

Dictionary

  • filtration
  • detection
  • tracking
  • recognition
  • identification
  • verification
  • classification
  • segmentation