Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions edgedetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
else:
f = np.append(f, 100 + np.random.normal(0,1))

print f.shape
print index.shape
print(f.shape)
print(index.shape)

plt.figure(2)
plt.plot(index, f, 'r-')
Expand Down Expand Up @@ -50,7 +50,7 @@

x = np.arange(-20, 20, 0.1)
kernel = (1/(std*np.sqrt(2*np.pi)))*np.exp(-np.square((x-mean)/std)/2)
print kernel.shape
print(kernel.shape)

plt.figure(4)
plt.plot(x, kernel, 'b-')
Expand All @@ -62,7 +62,7 @@

# Convolve original image signal with Gaussian filter
smoothed = np.convolve(kernel, f, 'same')
print smoothed.shape
print(smoothed.shape)

plt.figure(5)
plt.plot(smoothed, 'r-')
Expand Down Expand Up @@ -96,7 +96,7 @@

# Convolve original image signal with Gaussian filter
smoothed = np.convolve(first_diff, f, 'same')
print smoothed.shape
print(smoothed.shape)

plt.figure(8)
plt.plot(smoothed, 'r-')
Expand All @@ -119,7 +119,7 @@

# Convolve original image signal with Gaussian filter
smoothed = np.convolve(laplacian, f, 'same')
print smoothed.shape
print(smoothed.shape)

plt.figure(10)
plt.plot(smoothed, 'r-')
Expand Down
6 changes: 3 additions & 3 deletions grayscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
import cv2
import imutils

print "All packages imported properly!"
print("All packages imported properly!")

# Load & show original image
image = cv2.imread("testudo.jpg")
true = image.copy()

cv2.imshow("Original Image", image)

print "height: %d" % (image.shape[0])
print "width: %d" % (image.shape[1])
print("height: %d" % (image.shape[0]))
print("width: %d" % (image.shape[1]))

x_lim = image.shape[0]
y_lim = image.shape[1]
Expand Down
16 changes: 8 additions & 8 deletions opencvfundamentals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cv2
import imutils

print "All packages imported properly!"
print("All packages imported properly!")

# Displaying & resizing images
image = cv2.imread("testudo.jpg")
Expand All @@ -20,18 +20,18 @@
cv2.imwrite("testimage.jpg", image)

# Image shape (dimensions)
print image.shape
print "height: %d" % (image.shape[0])
print "width: %d" % (image.shape[1])
print "channels: %d" % (image.shape[2])
print(image.shape)
print("height: %d" % (image.shape[0]))
print("width: %d" % (image.shape[1]))
print("channels: %d" % (image.shape[2]))

# Pixel operations & image slicing
(b, g, r) = image[0, 0]
print "Pixel at (0, 0) - Red: %d, Green: %d, Blue: %d" % (r, g, b)
print("Pixel at (0, 0) - Red: %d, Green: %d, Blue: %d" % (r, g, b))
#
image[0, 0] = (0, 0, 255)
(b, g, r) = image[0, 0]
print "Pixel at (0, 0) - Red: %d, Green: %d, Blue: %d" % (r, g, b)
print("Pixel at (0, 0) - Red: %d, Green: %d, Blue: %d" % (r, g, b))

corner = image[0:100, 0:100]
cv2.imshow("Corner", corner)
Expand Down Expand Up @@ -96,7 +96,7 @@

white = (255, 255, 255)

for r in xrange(0, 275, 25):
for r in range(0, 275, 25):
cv2.circle(canvas, (centerX, centerY), r, white)
cv2.imshow("Concentric Circles", canvas)
cv2.waitKey(0)
Expand Down
2 changes: 1 addition & 1 deletion threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import cv2
import imutils

print "All packages imported properly!"
print("All packages imported properly!")

# Load & show original image
image = cv2.imread("testudo.jpg")
Expand Down