[Interest] QCamera resolution problem

"Alexander CarĂ´t" alexander_carot at gmx.net
Thu Jul 19 23:27:04 CEST 2018


Hello all,

I have a problem with setting the resolution of external USB-webcam on OSX. 

I initialize my cam like this:


void soundjack::startVideo(int index){
  QCameraViewfinderSettings cameraSettings;
  QSize resolution(640,480);
  cameraSettings.setResolution(resolution); 

  camera = new QCamera(availableCameras[index]);  
  camera->setCaptureMode(QCamera::CaptureStillImage);
  camera->setViewfinderSettings(cameraSettings);    
 
  imageCapture = new QCameraImageCapture(camera);
    
  camera->setViewfinder(ui->viewfinder);
  connect(imageCapture, &QCameraImageCapture::imageCaptured, this, &soundjack::processImage);

  camera->start();
} 

and I stop my cam like this:

void soundjack::stopVideo(){
  camera->stop();

  delete camera;
  delete imageCapture;
}


When I am running this code on my MacBook Pro withe the inbuilt Facetime cam everything works out fine. However, with two external USB-webcams on the same machine I have the following problem:

When I initialize the cam the first time all is working fine but when stopping it or changing to the inbuilt cam and then relaunching it for the second time the resolution is set to 1280 x 720 instead of 640 x 480. 

Stopping it again or changing to the inbuilt cam and then launching it for the third time leads to the desired 640 x 480.

In other words: Every other attempt works.

Can anyone help how to get rid of this problem ?

Thanks in advance,
best

Alex


--
http://www.carot.de
Email : Alexander at Carot.de
Tel.: +49 (0)177 5719797



More information about the Interest mailing list