'Overwrite in Python- How can I overwrite the code, that "cv2.imshow("HSV from BGR", cv2.cvtColor(img, cv2.COLOR_BGR2HSV))" also valdis at the end?
How can I overwrite the code, that "cv2.imshow("HSV from BGR", cv2.cvtColor(img, cv2.COLOR_BGR2HSV))" also valdis at the end ?
import numpy as np
#read image
src = cv2.imread('input/cat.jpg', cv2.IMREAD_UNCHANGED)
print(src.shape)
#BGR to HSV --> this line must also valid at the end
cv2.imshow("HSV from BGR", cv2.cvtColor(img, cv2.COLOR_BGR2HSV))
# extract red channel
red_channel = src[:,:,2]
# create empty image with same shape as that of src image
red_img = np.zeros(src.shape)
#assign the red channel of src to empty image
red_img[:,:,2] = red_channel
#save image
cv2.imwrite('output/cat_rot.jpg',red_img)'''
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
