void MainWindow::on_pBCapture_clicked()
{
ui->lImageCount->setText("0");
int iTotalImage = ui->sBTotalImage->value();
int iImgWidth, iImgHeight;
int count = 0;
unsigned char *pBuffer=NULL;
unsigned char *pBuffer2=NULL;
/* to get the width and height of image */
int iStatus = vc3d_GetImageSizeVr(0, &iImgWidth, &iImgHeight);
if (iStatus>0)
{
int iRemainImg = iTotalImage;
pBuffer = new unsigned char[iImgWidth*iImgHeight];
pBuffer2 = new unsigned char[iImgWidth*iImgHeight];
// Get one image (or more when in a loop)
do
{
unsigned char *pB;
if (iRemainImg%2)
{
pB=pBuffer;
}
else
{
pB=pBuffer2;
}
/* Get the one image when this function is called */
iStatus = vc3d_GetImage(0,iTotalImage,true,&iRemainImg, pB);
if (iStatus == 1)
{
count++;
ui
->lImageCount
->setText
(QString::number(count
));
loadImage(pB);
}
//delete [] pBuffer;
}while (iRemainImg>0 && iStatus>0);
}
}
void MainWindow::loadImage(unsigned char *pB)
{
ui->graphicsView->setScene(scene);
scene->clear();
ui->graphicsView->fitInView(scene->sceneRect(), Qt::KeepAspectRatio);
ui->graphicsView->update();
ui->graphicsView->viewport()->update();
ui->graphicsView->show();
}
void MainWindow::on_pBCapture_clicked()
{
ui->lImageCount->setText("0");
int iTotalImage = ui->sBTotalImage->value();
int iImgWidth, iImgHeight;
int count = 0;
unsigned char *pBuffer=NULL;
unsigned char *pBuffer2=NULL;
/* to get the width and height of image */
int iStatus = vc3d_GetImageSizeVr(0, &iImgWidth, &iImgHeight);
if (iStatus>0)
{
int iRemainImg = iTotalImage;
pBuffer = new unsigned char[iImgWidth*iImgHeight];
pBuffer2 = new unsigned char[iImgWidth*iImgHeight];
// Get one image (or more when in a loop)
do
{
unsigned char *pB;
if (iRemainImg%2)
{
pB=pBuffer;
}
else
{
pB=pBuffer2;
}
/* Get the one image when this function is called */
iStatus = vc3d_GetImage(0,iTotalImage,true,&iRemainImg, pB);
if (iStatus == 1)
{
count++;
ui->lImageCount->setText(QString::number(count));
loadImage(pB);
}
//delete [] pBuffer;
}while (iRemainImg>0 && iStatus>0);
}
}
void MainWindow::loadImage(unsigned char *pB)
{
QGraphicsScene* scene = new QGraphicsScene(this);
ui->graphicsView->setScene(scene);
QImage image = QImage(pB, 1280, 1024, QImage::Format_Indexed8);
scene->clear();
QGraphicsPixmapItem* pi = scene->addPixmap(QPixmap::fromImage(image));
ui->graphicsView->fitInView(scene->sceneRect(), Qt::KeepAspectRatio);
ui->graphicsView->update();
ui->graphicsView->viewport()->update();
ui->graphicsView->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks