QImageEncoderSettings AndroidCamImageEncoderControl::imageSettings() const { QImageEncoderSettings imageEncoderSettings; if(!m_imageSettings.isEmpty()) { switch(m_imageSettings.at(0)) { case 256: imageEncoderSettings.setCodec(QLatin1String("JPEG")); break; case 17: imageEncoderSettings.setCodec(QLatin1String("NV21")); break; case 4: imageEncoderSettings.setCodec(QLatin1String("RGB_565")); break; case 20: imageEncoderSettings.setCodec(QLatin1String("YUY2")); break; default: imageEncoderSettings.setCodec(QLatin1String("JPEG")); break; } imageEncoderSettings.setResolution(QSize(m_imageSettings.at(1),m_imageSettings.at(2))); } else { imageEncoderSettings.setCodec(QLatin1String("JPEG")); imageEncoderSettings.setResolution(QSize(QtCameraJni::getSupportedImageResolutions().at(0),QtCameraJni::getSupportedImageResolutions().at(1))); } return imageEncoderSettings; }
QImageEncoderSettings S60ImageEncoderControl::imageSettings() const { // Update setting values from session QImageEncoderSettings settings; settings.setCodec(m_session->settings()->imageCodec()); settings.setResolution(m_session->settings()->imageResolution()); settings.setQuality(m_session->settings()->imageQuality()); return settings; }
void FSWebCam::setCamera(const QByteArray &cameraDevice) { delete camera; delete imageCapture; if (cameraDevice.isEmpty()){ camera = new QCamera; }else{ camera = new QCamera(cameraDevice); } imageCapture = new QCameraImageCapture(camera); QImageEncoderSettings imageSettings = imageCapture->encodingSettings(); qDebug() << imageCapture->supportedResolutions(); qDebug() << imageSettings.resolution(); //QImageEncoderSettings imageSettings; #ifdef LINUX #else imageSettings.setCodec("image/jpeg"); imageSettings.setResolution(1280, 960); #endif imageCapture->setEncodingSettings(imageSettings); camera->setViewfinder(FSController::getInstance()->controlPanel->ui->viewfinder ); FSController::getInstance()->controlPanel->ui->cameraLabel->setStyleSheet("border-style: solid; border-color: black; border-width: 3px 1px 3px 1px;"); FSController::getInstance()->controlPanel->ui->cameraLabel->setText(""); camera->setCaptureMode(QCamera::CaptureStillImage); //connect(imageCapture, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(readyForCapture(bool))); connect(imageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(processCapturedImage(int,QImage))); connect(imageCapture, SIGNAL(imageSaved(int,QString)), this, SLOT(imageSaved(int,QString))); camera->start(); QStringList res = imageCapture->supportedImageCodecs(); //QList<QSize> res = imageCapture->supportedResolutions(); //QSize r; QString r; foreach(r,res){ qDebug() << "Supported Resolutions:"<<r; } qDebug() << "set camera:" << cameraDevice; }
void MiCamara::on_capture_triggered() { imgcap->setCaptureDestination(QCameraImageCapture::CaptureToFile); QImageEncoderSettings imageSettings; imageSettings.setCodec("image/jpeg"); imageSettings.setResolution(1600, 1200); imgcap->setEncodingSettings(imageSettings); cam->setCaptureMode(QCamera::CaptureStillImage); cam->start(); cam->searchAndLock(); QString location; QFileDialog fldao(this); fldao.setWindowTitle("Guardar captura"); fldao.setAcceptMode(QFileDialog::AcceptSave); fldao.setFileMode(QFileDialog::AnyFile); fldao.setNameFilter("JPEG (*.jpeg)"); fldao.setNameFilterDetailsVisible(true); if (fldao.exec() == QDialog::Rejected) { cam->unlock(); return; } location = fldao.selectedFiles().first(); imgcap->capture(location); cam->unlock(); }