Thank you anda_skoa,
I used your first advice and it's working. 
store the image and call update() and draw in paintEvent
So this is my new code.
{
painter.
drawImage(QPoint(0,
0),currentImage
);
}
void MainWindow::ProcessingCallback(Channel &Ch, SignalInfo &Info)
{
try
{
// Update the eVision image with the acquired image data
UpdateImageConfig(*Info.Surf, EImgSrc);
// Inversion between the first and the third color component of each pixel component (EImage is BGR coded)
for(INT32 x=0; x<EImgSrc.GetWidth(); x++)
{
for(INT32 y=0; y<EImgSrc.GetHeight(); y++)
{
EC24 pixE = EImgSrc.GetPixel(x, y);
UINT8 temp = pixE.m_un8C2;
pixE.m_un8C2 = pixE.m_un8C0;
pixE.m_un8C0 = temp;
EImgSrc.SetPixel(pixE, x, y);
}
}
// Convert EImage to QImage
QImage newImage
((const uchar
*)EImgSrc.
GetGenericImagePtr(), EImgSrc.
GetWidth(), EImgSrc.
GetHeight(),
QImage::Format_RGB888);
// Display the new image
currentImage = newImage;
this->update();
}
catch (Euresys::MultiCam::Exception &e)
{
// Display the exceptions...
}
}
void MainWindow::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.drawImage(QPoint(0,0),currentImage);
}
void MainWindow::ProcessingCallback(Channel &Ch, SignalInfo &Info)
{
try
{
// Update the eVision image with the acquired image data
UpdateImageConfig(*Info.Surf, EImgSrc);
// Inversion between the first and the third color component of each pixel component (EImage is BGR coded)
for(INT32 x=0; x<EImgSrc.GetWidth(); x++)
{
for(INT32 y=0; y<EImgSrc.GetHeight(); y++)
{
EC24 pixE = EImgSrc.GetPixel(x, y);
UINT8 temp = pixE.m_un8C2;
pixE.m_un8C2 = pixE.m_un8C0;
pixE.m_un8C0 = temp;
EImgSrc.SetPixel(pixE, x, y);
}
}
// Convert EImage to QImage
QImage newImage((const uchar*)EImgSrc.GetGenericImagePtr(), EImgSrc.GetWidth(), EImgSrc.GetHeight(), QImage::Format_RGB888);
// Display the new image
currentImage = newImage;
this->update();
}
catch (Euresys::MultiCam::Exception &e)
{
// Display the exceptions...
}
}
To copy to clipboard, switch view to plain text mode
With
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "EasyMultiCam.h"
using namespace Euresys::MultiCam;
using namespace Euresys::eVision::EasyMultiCam;
{
Q_OBJECT
public:
MainWindow();
EImageC24 EImgSrc;
// ...
public slots:
void ProcessingCallback(Channel &Ch, SignalInfo &Info);
// ...
private slots:
// ...
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "EasyMultiCam.h"
using namespace Euresys::MultiCam;
using namespace Euresys::eVision::EasyMultiCam;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
EImageC24 EImgSrc;
QImage currentImage;
// ...
public slots:
void ProcessingCallback(Channel &Ch, SignalInfo &Info);
// ...
private slots:
void paintEvent(QPaintEvent *);
// ...
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
Thank you again for the efficiency of your advices.
Bye!
Bookmarks