This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
img = cv2.imread('perspective transformation.jpg', 1) | |
cv2.imshow("Perspective Transformation Image", img) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() | |
rows, cols, ch = img.shape | |
pt1 = np.float32([[219,209],[612,8],[380,493],[785,271]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
rows, cols, ch = img.shape | |
src_points = np.float32([[0,0], [cols-1,0], [0,rows-1]]) | |
dst_points = np.float32([[cols-1,0], [0,0], [cols-1,rows-1]]) | |
matrix = cv2.getAffineTransform(src_points, dst_points) | |
img_afftran = cv2.warpAffine(img, matrix, (cols,rows)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
rows, cols, ch = img.shape | |
src_points = np.float32([[0,0], [cols-1,0], [0,rows-1]]) | |
dst_points = np.float32([[0,0], [int(0.6*(cols-1)),0], [int(0.4*(cols-1)),rows-1]]) | |
matrix = cv2.getAffineTransform(src_points, dst_points) | |
img_afftran = cv2.warpAffine(img, matrix, (cols,rows)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img_rotation = cv2.warpAffine(img, cv2.getRotationMatrix2D((cols/2, rows/2), 180, 0.6), (cols, rows)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
rows, cols, ch = img.shape | |
img_rotation = cv2.warpAffine(img, cv2.getRotationMatrix2D((cols/2, rows/2), 30, 0.6), (cols, rows)) | |
cv2.imshow("Rotation 1", img_rotation) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
rows, cols, ch = img.shape | |
matrix_trans = np.float32([[1, 0, -70], [0, 1, -40]]) | |
translated_img = cv2.warpAffine(img, matrix_trans, (cols, rows)) | |
cv2.imshow("Translated image 1", translated_img) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Read an image | |
img = cv2.imread('transformation image.jpg', 1) | |
#or | |
#img1 = cv2.imread('C:\\Users\\Admin\\Downloads\\transformation image.jpg', 1) | |
#Display an image | |
cv2.imshow('Transformation Image', img) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
#read the images | |
img1 = cv2.imread('bitwise_image_1.jpg') | |
img2 = cv2.imread('bitwise_image_2.jpg') | |
bitwise_AND = cv2.bitwise_and(img1, img2) | |
bitwise_OR = cv2.bitwise_or(img1, img2) | |
bitwise_NOT = cv2.bitwise_not(img1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
img1 = cv2.imread('image1_add.jpg', 1) | |
#or | |
#img1 = cv2.imread('C:\\Users\\Admin\\Downloads\\image1_add.jpg', 1) | |
cv2.imshow('Image 1', img1) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
img1 = cv2.imread('image1_add.jpg', 1) | |
#or | |
#img1 = cv2.imread('C:\\Users\\Admin\\Downloads\\image1_add.jpg', 1) | |
cv2.imshow('Image 1', img1) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
NewerOlder