python opencv code list. I will add more.
import cv2 # opencv
import numpy as np # numpy
img = cv2.imread('/home/kono/image/image01.jpg') #Put in img
cv2.imwrite("/home/kono/image/output_img.jpg ", img)
cv2.namedWindow('img', cv2.WINDOW_NORMAL) #Window size setting
cv2.imshow('img', img)
cv2.waitKey(2000) #Image display time
cv2.waitKey(1)
cv2.destroyAllWindows() #Close all windows
cv2.waitKey(1)
gaus = cv2.GaussianBlur(img, ksize=(3, 3), sigmaX=10)
Specify kernel size and standard deviation x, y
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) #HSV conversion
lower_color = np.array([10, 100, 100]) #Value below HSV
upper_color = np.array([20, 240, 160]) #Value on HSV
hsv_mask = cv2.inRange(hsv, lower_color, upper_color) #Binarization within a given range
output = cv2.bitwise_and(img, img, mask = hsv_mask) #mask
Recommended Posts