Im using a ps4 camera and this driver: GitHub - Hackinside/PS4-CAMERA-DRIVERS: Windows drivers ( WIP)
with the “many-cam” sw, i am able to set gain and exposure time. when i try this in opencv, i dont succeed. Some parameters i can set in open cv,like fps. if i set parameters in many-cam and then open a opencv program in python, the previous settings done in manycam dont have any effect.
Any suggested solutions or workarounds?
type or paste code here
cap = cv2.VideoCapture(0, cv2.CAP_MSMF)
#captureDevice = cv2.VideoCapture(0, cv2.CAP_DSHOW)
cap.set(cv2.CAP_PROP_SPEED, -5)
print (cap.get(cv2.CAP_PROP_SPEED))
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1748)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 408)
time.sleep(2)
cap.set(cv2.CAP_PROP_FPS, 120)
cap.set(cv2.CAP_PROP_EXPOSURE, -5)
cap.set(cv2.CAP_PROP_GAIN,5.0)
print (cap.get(cv2.CAP_PROP_EXPOSURE))
print (cap.get(cv2.CAP_PROP_MODE))
print (cap.get(cv2.CAP_PROP_FORMAT))
print (cap.get(cv2.CAP_PROP_GAIN))
def decode(frame):
left = np.zeros((400,800,3), np.uint8)
right = np.zeros((400,800,3), np.uint8)
for i in range(400):
left[i] = frame[i, 32: 832]
right[i] = frame[i, 832: 1632]
return (left, right)
while(True):
ret, frame = cap.read()
#cv2.normalize(frame, frame, 0, 255, cv2.NORM_MINMAX)
left, right = decode(frame)
cv2.imshow('left',left)
cv2.imshow('right',right)
time.sleep(0.2)
keywi=cv2.waitKey(1)
if keywi & 0xFF == ord('q'):
break
if keywi & 0xFF == ord('r'):
timesy=str(time.time())
timesy=timesy.replace('.', '')
cv2.imwrite(f'C:\PyPj\modbusTcp\data\d{timesy}d.png', left)
print(f'bilde tatt')
cap.release()
cv2.destroyAllWindows()