Results 1 to 4 of 4

Thread: How to convert EImage into QImage and show it in a QWidget?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question How to convert EImage into QImage and show it in a QWidget?

    Hello everybody,

    I'm working on a video acquisition project with an EURESYS frame grabber (Picolo).
    I develop on Qt Creator EDI (Qt 4.8.3 based) with MS VC++ 10 compiler and I use eVision 6.7.1 library.

    There is no problems with board configuration and image acquisition.
    With OpenCV library, I can convert EImage to Mat and show it in a secondary window:

    Qt Code:
    1. void MainWindow::ProcessingCallback(Channel &Ch, SignalInfo &Info)
    2. {
    3. try
    4. {
    5. // Update the eVision image with the acquired image data
    6. UpdateImageConfig(*Info.Surf, EImgSrc);
    7.  
    8. // Convert EImage to Mat
    9. Mat cvImg(EImgSrc.GetHeight(), EImgSrc.GetWidth(), CV_8UC3, EImgSrc.GetGenericImagePtr());
    10.  
    11. // Display the new image
    12. imshow( "Display window", cvImg );
    13. }
    14. catch (Euresys::MultiCam::Exception &e)
    15. {
    16. // Display the exceptions...
    17. }
    18.  
    19. }
    To copy to clipboard, switch view to plain text mode 

    So in the same way with Qt I done the next code:
    Qt Code:
    1. void MainWindow::ProcessingCallback(Channel &Ch, SignalInfo &Info)
    2. {
    3. try
    4. {
    5. // Update the eVision image with the acquired image data
    6. UpdateImageConfig(*Info.Surf, EImgSrc);
    7.  
    8. // Convert EImage to QImage
    9. QImage imaq((const uchar*)EImgSrc.GetGenericImagePtr(), EImgSrc.GetWidth(), EImgSrc.GetHeight(), EImgSrc.GetBitsPerRow(), QImage::Format_RGB888);
    10.  
    11. // Display the new image
    12. QPainter painter(this);
    13. painter.drawImage(QPoint(0, 0), imaq);
    14. }
    15. catch (Euresys::MultiCam::Exception &e)
    16. {
    17. // Display the exceptions...
    18. }
    19. }
    To copy to clipboard, switch view to plain text mode 

    But in this case, there are no display and output show this message :
    Qt Code:
    1. QPainter::begin: Paint device returned engine == 0, type: 1
    To copy to clipboard, switch view to plain text mode 

    Could you advice me please?
    Last edited by FloFox; 14th February 2013 at 14:52.

Similar Threads

  1. IPC- char * to WCHAR* convertion?
    By Ricardo_arg in forum Qt Programming
    Replies: 3
    Last Post: 6th December 2010, 18:55
  2. Text file to PDF convertion using C++ code
    By joseph in forum General Discussion
    Replies: 2
    Last Post: 21st August 2008, 01:28
  3. Convertion between QLineEdit formated to Double
    By vcp in forum Qt Programming
    Replies: 4
    Last Post: 13th June 2008, 17:15
  4. Time convertion
    By rajeshs in forum Qt Programming
    Replies: 3
    Last Post: 5th June 2008, 11:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.