Skip to content

Instantly share code, notes, and snippets.

View rahim42324's full-sized avatar

Rahim Akhtar rahim42324

  • Karachi, Pakistan
View GitHub Profile
# defining Class
class university:
pass
import cv2
import numpy as np
image = cv2.imread('image.png')
# Store height and width of the image
height, width = image.shape[:2]
quarter_height = height / 4
quarter_width = width / 4
import cv2
#to read the image
img = cv2.imread("image.png")
#Saving the image
cv2.imwrite("new.jpg", img)
import cv2
#to read the image
img = cv2.imread("image.png")
#Saving the image
cv2.imwrite("new.jpg", img)
import cv2
#reading the image
img = cv2.imread('image.png')
#displaying image
cv2.imshow('image', img)
#wait and destroy
cv2.waitKey(0)
cv2.destoryAllWindows()
import cv2
#reading image
img=imread("image.png")
import numpy as np
import cv2
# Open the image.
img = cv2.imread('damaged.png')
# Load the mask.
mask = cv2.imread('mask.png', 0)
# Inpaint.
import cv2
import numpy as np
image1 = cv2.imread('image.png')
# cv2.cvtColor is applied over the
# image input with applied parameters
# to convert the image in grayscale
img = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
import cv2
import numpy as np
# Read image from disk.
img = cv2.imread('cat.png')
# Canny edge detection.
edges = cv2.Canny(img, 100, 200)
# Write image back to disk.
import cv2
image = cv2.imread('python.png')
window_name = 'Image'
# Using cv2.copyMakeBorder() method
image = cv2.copyMakeBorder(image, 10, 10, 10, 10, cv2.BORDER_CONSTANT)
cv2.imshow(window_name, image)