HSV adjustment python opencv cuda

asked 2020-02-26 07:08:10 -0600

Imran B gravatar image

Hi guys, I need to adjust hsv values manually with cuda methods, without cuda I can directly change values of h,s,v .But with cuda I can't change values(or I'm not using the correct method).

import cv2
import numpy as np

img =  cv2.imread('test.jpg')
imgMat = cv2.cuda_GpuMat(img)
imgSat = cv2.cuda.cvtColor(imgMat,cv2.COLOR_BGR2HSV)
shsv = cv2.cuda_GpuMat()
h,s,v = cv2.cuda.split(imgSat)
h = cv2.cuda.threshold(h,50,50,cv2.THRESH_BINARY)
s = cv2.cuda.threshold(s,20,20,cv2.THRESH_BINARY)
v = cv2.cuda.threshold(v,100,100,cv2.THRESH_BINARY)
temp = cv2.cuda.bitwise_and(h[1],s[1])
hsv = cv2.cuda.bitwise_and(temp,v[1])
hsv = hsv.download()
cv2.imshow('Frame',hsv)
cv2.waitKey(0)
cv2.destroyAllWindows()

I found the reference code here https://answers.opencv.org/question/9... . Thanks in advance

edit retag flag offensive close merge delete