Hi all,
I'm playing with the SDK on Linux, but not having much luck. I want to try working with QT's own graphics libraries rather than OpenCV which is making it a little harder (especially as I'm coming from over a decade of windows VB programming).
So far I can open the camera and get/set settings, but when trying to get a frame with getImageData I think i'm filling the frame variable, but I'm having problems passing it to QImage. No matter what I do, I cannot get the frame data into an image.
This is what I have so far.
bool MainWindow:()
{
QMessageBox msgBox;
int CamNum = ui->cbCameras->currentIndex();
bool bresult = openCamera(CamNum);
if(!bresult)
{
msgBox.setText("Error connecting to camera" + QString:(CamNum));
msgBox.setStandardButtons(QMessageBox:);
msgBox.setDefaultButton(QMessageBox:);
msgBox.exec();
return false;
}
initCamera();
ui->btnConnectCamera->setText("Disconnect");
this->setWindowTitle("Sensor Temp: " + QString:(getSensorTemp()));
setImageFormat(320,240,1,IMG_Y8);
setValue(CONTROL_EXPOSURE, 33*1000, true);
startCapture();
int bufferSize = getWidth()*getHeight()*8;
unsigned char* cFrame;
cFrame = (unsigned char*)malloc(bufferSize);
while (true) {
getImageData((unsigned char*) cFrame, bufferSize, -1);
QImage image = QImage:((unsigned char*)cFrame,bufferSize,0);
ui->lblImage->setPixmap(QPixmap:(image));
ui->lblImage->show();
}
return true;
}
Any tips qould be appreciated..