diff --git a/edgedetection.py b/edgedetection.py index 3dd93f9..de25159 100644 --- a/edgedetection.py +++ b/edgedetection.py @@ -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-') @@ -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-') @@ -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-') @@ -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-') @@ -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-') diff --git a/grayscale.py b/grayscale.py index bd79813..2921e82 100644 --- a/grayscale.py +++ b/grayscale.py @@ -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") @@ -14,8 +14,8 @@ 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] diff --git a/opencvfundamentals.py b/opencvfundamentals.py index 41338fe..c4ab219 100644 --- a/opencvfundamentals.py +++ b/opencvfundamentals.py @@ -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") @@ -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) @@ -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) diff --git a/threshold.py b/threshold.py index 2a6216b..8ce32ec 100644 --- a/threshold.py +++ b/threshold.py @@ -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")