# IPython log file

import cv2
import numpy as np
import matplotlib.pyplot as plt
frame = plt.imread("oring_sample_1.jpg")
get_ipython().magic(u'pwd ')
get_ipython().magic(u'cd ..')
get_ipython().magic(u'cd ..')
get_ipython().magic(u'cd ..')
get_ipython().magic(u'cd gayatree/')
get_ipython().magic(u'cd oring_sorter.git/trunk/')
frame = plt.imread("oring_sample_1.jpg")
cv2.imshow('test', frame)
cv2.waitKey(0)
cv2.destroyAllWindows
cv2.destroyAllWindows()
cv2.destroyAllWindows()
cv2.destroyWindow('test')
cv2.imshow('test1', frame)
cv2.waitKey(0)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imshow('test1', frame)
cv2.waitKey(0)
cv2.waitKey(0)
cv2.destroyAllWindows()
imgray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(imgray,127,255,0)
contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(img, contours, -1, (0,255,0), 3)
cv2.drawContours(frame, contours, -1, (0,255,0), 3)
cv2.waitKey(0)
cv2.imshow(frame)
cv2.imshow('frame',frame)
cv2.waitKey(0)
cv2.destroyAllWindows()
plt.imshow(im)
plt.imshow(frame)
plt.show()
cv2.imshow('frame',frame)
plt.show()
plt.ion()
plt.show()
plt.show()
plt.imshow(frame)
get_ipython().magic(u'who ')
thresh.shape
thresh2 = thresh
cv2.drawContours(thresh2, contours, -1, (0,255,0), 3)
plt.imshow(thresh)
plt.imshow(thresh2)
thresh2 = thresh
imshow(thresh)
plt.imshow(thresh2)
plt.imshow(thresh2)
cv2.drawContours(thresh2, contours, -1, (0,255,0), 3)
plt.imshow(thresh2)
plt.imshow(frame)
plt.imshow(imgray)
imTrash = imgray
imTrash = 0
plt.imshow(imgray)
plt.imshow(imTrash)
imTrash = imgray
cv2.drawContours(imTrash, contours, -1, (0,255,0), 3)
plt.imshow(imTrash)
frame = plt.imread("oring_sample_1.jpg")
trashFrame = frame
cv2.drawContours(trashFrame, contours, -1, (0,255,0), 3)
plt.imshow(trash
Frame)
plt.imshow(trashFrame)
trashFrame = frame
cv2.drawContours(trashFrame, contours, 1, (0,255,0), 3)
plt.imshow(trashFrame)
plt.imshow(frame)
frame = plt.imread("oring_sample_1.jpg")
plt.imshow(frame)
trashFrame = frame
cv2.drawContours(trashFrame, contours, 1, (0,255,0), 3)
plt.ismhow(frame)
plt.imshow(frame)
plt.imshow(trashFrame)
frame = plt.imread("oring_sample_1.jpg")
trashFrame = zeros(frame.shape)
trashFrame = np.zeros(frame.shape)
plt.ismhow(trashFrame)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, 2, (0,255,0), 3)
plt.imshow(trashFrame)
plt.imshow(frame)
cv2.drawContours(trashFrame, contours, 3, (0,255,0), 3)
plt.imshow(trashFrame)
trashFrame = frame
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, 3, (0,255,0), 3)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, 5, (0,255,0), 3)
plt.imshow(trashFrame)
plt.imshow(frame)
plt.imshow(frame)
trashFrame = frame * 1
cv2.drawContours(trashFrame, contours, 5, (0,255,0), 3)
plt.imshow(frame)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, -1, (0,255,0), 3)
plt.imshow(trashFrame)
plt.imshow(frame)
plt.imshow(frame)
hierarchy
contours.extend()
contours.count()
contours.count(1)
contours.count(2)
contours.count(0)
hierarchy.all
hierarchy.all()
hierarchy.size
hierarchy.shape
hierarchy.shape[2]
hierarchy.shape[1]
input()
input():
    
input()
a = input('a')
get_ipython().magic(u'who ')
trashFrame = zeros(frame.shape)
trashFrame = np.zeros(frame.shape)
cv2.drawContours(trashFrame, contours, [0], (0,255,0), 3)
cv2.drawContours(trashFrame, contours, 0, (0,255,0), 3)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, -1, (0,255,0), 3)
plt.imshow(trashFrame)
trashFrame = np.ones(frame.shape) * 255
cv2.drawContours(trashFrame, contours, -1, (0,255,0), 3)
plt.imshow(trashFrame)
trashFrame = np.ones(frame.shape) * 255
trashFrame.max()
trashFrame.dtype
trashFrame = trashFrame.astype(uint8)
trashFrame = trashFrame.astype('uint8')
trashFrame.dtype
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, -1, (0,255,0), 3)
plt.imshow(trashFrame)
trashFrame = np.ones(frame.shape) * 255
trashFrame = trashFrame.astype('uint8')
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, -1, (0,,255), 1)
cv2.drawContours(trashFrame, contours, -1, (0,0,255), 1)
plt.imshow(trashFrame)
trashFrame = np.ones(frame.shape) * 255
trashFrame = trashFrame.astype('uint8')
cv2.drawContours(trashFrame, contours, 0, (255,0,0), 1)
plt.imshow(trashFrame)
contours[1]
contours[0,:]
contours(0,:)
contours
hierarchy
hierarchy[:,0]
hierarchy[:,1]
cv2.drawContours(trashFrame, contours, 1, (255,0,0), 1)
plt.imshow(trashFrame)
hierarchy[0:4,:]
hierarchy[1,:]
hierarchy
hierarchy[:,0]
hierarchy.shape
hierarchy[0,0,:]
hierarchy[0,0:2,:]
hierarchy[0,0:5,:]
cv2.drawContours(trashFrame, contours, 3, (255,0,0), 1)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, 4, (255,0,0), 1)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, 5, (255,0,0), 1)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, , (255,0,0), 1)
cv2.drawContours(trashFrame, contours, 6 , (255,0,0), 1)
plt.imshow(trashFrame)
hierarchy[0,0:20,:]
hierarchy[0,0:40,:]
hierarchy[0,:,:]
cv2.drawContours(trashFrame, contours, 45, (255,255,0), 2)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, -1, (255,255,0), 2)
plt.imshow(trashFrame)
contours
contours[1]
contours[2]
contours[3]
contours[4]
contours[5]
contours[6]
cv2.drawContours(trashFrame, contours, -1, (255,255,0), -1)
plt.imshow(trashFrame)
cv2.drawContours(trashFrame, contours, -1, (255,0,0), -1)
plt.imshow(trashFrame)
trashFrame = np.ones(frame.shape) * 255
trashFrame = trashFrame.astype('uint8')
plt.imshow(trashFrame)
hierarchy.shape(2)
hierarchy.shape[2]
hierarchy.shape[3]
hierarchy.shape[1]
a  = 0
a  = [1]
a = [ [1]]
a = array([4])
a = np.array([4])
a
a.shape()
a.shape
for k in (0,10)
for k in (0,10):
    print k
    
for k in [0:1:10]:
    print k
    

    print k
len(contours)
for k in contours:
    print k
    
k
np.arange(0,1)
np.arange(0,10)
for k in np.arange(0, len(contours)+1):
    print k
    
for k in np.arange(0, len(contours)+2):
    print k
    
for k in np.arange(0, len(contours)+2):
    print k
    
for k in np.arange(0, len(contours)+2):
    print k
    
for k in np.arange(0, len(contours)+2):
    print k
    
for k in np.arange(0, len(contours)+2):
    contours[k]
    print k
    
for k in np.arange(0, len(contours)+1):
    contours[k]
    print k
    
for k in np.arange(0, len(contours)):
    contours[k]
    print k
    
for k in np.arange(0, len(contours)):
    contours[k]
    print k
    input('')
    
for k in np.arange(0, len(contours)):
    contours[k]
    print k
    a= input('')
    
a = input('test')
a = input('test'):
    
a = input('test');
a = raw_input('test')
for k in np.arange(0, len(contours)):
    contours[k]
    print k
    a= raw_input('')
    
for k in np.arange(0, len(contours)):
    contours[k]
    print k
    a= raw_input('')
    'tetst'
    
for k in np.arange(0, len(contours)):
    len(contours[k])
    print k
    a= raw_input('')
    
for k in np.arange(0, len(contours)):
    print len(contours[k])
    print k
    a= raw_input('')
    
get_ipython().magic(u'paste ')
get_ipython().magic(u'paste')
get_ipython().magic(u'copy')
help paste
help(paste)
help(%paste)
get_ipython().magic(u'paste ')
get_ipython().magic(u'cpaste ')
get_ipython().magic(u'cpaste ')
get_ipython().magic(u'paste')
get_ipython().magic(u'cpaste')
get_ipython().magic(u'cpaste')
get_ipython().magic(u'cpaste')
out[1]
h
help
get_ipython().magic(u'h')
get_ipython().magic(u'history ')
get_ipython().magic(u'history (1)')
get_ipython().magic(u'hist (2)')
get_ipython().magic(u'history (259)')
get_ipython().magic(u'history 200')
get_ipython().magic(u'run history 200')
get_ipython().magic(u'rep 300')
get_ipython().magic(u'rep 200')
plt.imshow(trashFrame)
get_ipython().magic(u'rep 265')
plt.imshow(trashFrame)
get_ipython().magic(u'recall 265')
plt.imshow(trashFrame)
get_ipython().magic(u'logstart')
get_ipython().magic(u'logstart')
get_ipython().magic(u'logstate')
print 'testing log'
print 'testing log'
print 'testing after delecte 2'
print 'testing after delecte 2'
get_ipython().magic(u'logstart')
get_ipython().magic(u'logstop')
get_ipython().magic(u'logstart')
get_ipython().magic(u'who ')
get_ipython().magic(u'colors')
get_ipython().magic(u'pinfo %colors')
get_ipython().magic(u'colors NoColor')
get_ipython().magic(u'colors Linux')
get_ipython().magic(u'colors LightBG')
get_ipython().magic(u'colors Linux')
get_ipython().magic(u'who ')
contours
hierarchy
get_ipython().magic(u'who ')
imshow(frame)
plt.imshow(frame)
get_ipython().magic(u'pwd ')
get_ipython().magic(u'run contour_study.py')
get_ipython().magic(u'run contour_study.py')
len(contours)
hierarchy
hierarchy[1]
hierarchy(1)
hierarchy
hierarchy[:,:,0]
hierarchy.shape
hierarchy[1, 0, :]
hierarchy[[1, 0, :]]
hierarchy([1, 0, :])
hierarchy[0,0:5,:]
hierarchy[0,0,:]
get_ipython().magic(u'run contour_study.py')
hierarchy[0,k,:]
k
hierarchy[0,k,:]
k = 0
hierarchy[0,k,:]
get_ipython().magic(u'run contour_study.py')
k
get_ipython().magic(u'run contour_study.py')
get_ipython().magic(u'run contour_study.py')
get_ipython().magic(u'run contour_study.py')
get_ipython().magic(u'run contour_study.py')
k = raw_input('Enter to Continue: ')
k
type(k)
b = int(k)
b
type(b)
get_ipython().magic(u'run contour_study.py')
get_ipython().magic(u'run contour_study.py')
a = contours[1]
a
a.shape
a.size
a[1]
a[1,1]
a[1,0]
a[0,0]
a.shape
a[0,0,:]
hierarchy
hierarchy.shape
hierarchy[1,:,2]
hierarchy[0,:,2]
hierarchy[0,:,2] = 0
hierarchy[0,:,3] = 0
a = hierarchy[0,:,3] = 0
a
a=  hierarchy[0,:,3]
a
a.size
hierarchy.size
hierarchy.shape
hierarchy[0,:,3]
contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
hierarchy[0,:,3]
a = hierarchy[0,:,3]==0
a
sum(a)
a = contours[1]
a
a.shape
a[0,1,:]
a[0,0,:]
a[:,0,0]
a[:,0,1]
a.min
a.min()
a.min([:,0,0])
x = a[:,:,0]
x
x.min
x.min()
x.max()
plt.plot(x)
plt.plot(x)
