How to change the resolution of PS5 camera in OpenCV?

Question:

I am trying to change the resolution of PS5 camera in OpenCV, Python.

The problem is that PS5 Camera officially isn’t supported on PC, and I have to use custom camera drivers from GitHub: https://github.com/Hackinside/PS5_camera_files

Default image resolution by this code is 640×376

self.capture = cv2.VideoCapture(name)

I found out that supported resolutions of this camera are 640×376 and 5148×1088, so I tried to do next:

res = self.capture.set(cv2.CAP_PROP_FRAME_WIDTH, 5148)
res = self.capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 1088)

But in both cases res is False, and resolution doesn’t change. I can recieve only small resolution frame.

Camera 100% can work in 5148×1088, because if I launch Windows Camera application it shows me high quality images

Asked By: Bogdan Madzhuga

||

Answers:

The best way is if you have a PC, transfer the photo to the PC and then on the photo view application you can change the size. On Mac, you can go to Preview.
Tools>Ajust Size
Then change the pixel size.
Hope that helped.

Answered By: Coozywana

Okay, the problem was, that I had a piece of code, where I read a frame from the capture using a loop:

while True:
    self.capture.read()

It was in a parallel thread so changing the resolution was at the same time as reading images. It was a reason why the change resolution process always failed.

So the provided code in question should work if you do it before starting reading images.

Answered By: Bogdan Madzhuga
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.