Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Should Sony PS3 camera work with VideoCapture?

Trying to combine Ubuntu 18, OpenCV 3.4.10 and Sony PS3 camera. Use the standard sample code found on opencv.org:

#include "opencv2/opencv.hpp"
#include "iostream"

int main(int, char**) {
cv::VideoCapture camera(0);
if (!camera.isOpened()) {
    std::cerr << "ERROR: Could not open camera" << std::endl;
    return 1;   }
cv::namedWindow("Webcam", CV_WINDOW_AUTOSIZE);
cv::Mat frame;
camera >> frame;
while (1) {
    cv::imshow("Webcam", frame);
    if (cv::waitKey(10) >= 0)
        break;
}
return 0;

}

Compiles without errors, Executes without errors too. Yet shows nothing as if the code is not supposed to display anything. With the camera unplugged returns "ERROR: Could not open camera".

In dev the camera shows as video0.

With Cheese it works fine. On Raspberry Pi similar test code in Python works fine with PS3 - detected it immediately.

I have five other cameras of different models, none works with this code: three behave same as PS3, others complain about pixel format not supported. This might mean that the problem is not necessary with the PS3 driver.

Someone suggested to install Video4Linux - made no difference.

What else could be done? Or perhaps something wrong is with the code?