A bizarre twist: I found that the problem goes away if I remove from the project a small file for converting between QImages and IPLImages (used in OpenCV)
The file, which i found online, does not do anything that seems like it should be relevant to QFileDialog, here is the header:
#ifndef QTIPL_H
#define QTIPL_H
#include <QImage>
#include <highgui.h>
IplImage qtToCv
(QImage* qImage
);
QImage cvToQt
(IplImage
* iplImage
);
#endif // QTIPL_H
#ifndef QTIPL_H
#define QTIPL_H
#include <QImage>
#include <highgui.h>
IplImage qtToCv(QImage* qImage);
QImage cvToQt(IplImage* iplImage);
#endif // QTIPL_H
To copy to clipboard, switch view to plain text mode
and cpp:
#include "qtIPL.h"
IplImage qtToCv
(QImage* qImage
){
IplImage* cvImage;
cvImage = cvCreateImageHeader(cvSize(qImage->width(), qImage->height()), IPL_DEPTH_8U, 4);
cvImage->imageData = (char*)qImage->bits();
IplImage* colorImage = cvCreateImage( cvGetSize(cvImage), 8, 3 );
cvConvertImage( cvImage, colorImage, 0 );
return *colorImage;
}
QImage cvToQt
(IplImage
* iplImage
) {
if(!cvSaveImage("tmpImg.bmp", iplImage)) printf("Could not save: tmpImg.bmp in cvToQt");
}
#include "qtIPL.h"
IplImage qtToCv(QImage* qImage)
{
IplImage* cvImage;
cvImage = cvCreateImageHeader(cvSize(qImage->width(), qImage->height()), IPL_DEPTH_8U, 4);
cvImage->imageData = (char*)qImage->bits();
IplImage* colorImage = cvCreateImage( cvGetSize(cvImage), 8, 3 );
cvConvertImage( cvImage, colorImage, 0 );
return *colorImage;
}
QImage cvToQt(IplImage* iplImage)
{
if(!cvSaveImage("tmpImg.bmp", iplImage)) printf("Could not save: tmpImg.bmp in cvToQt");
QImage img("tmpImg.bmp");
}
To copy to clipboard, switch view to plain text mode
if anyone sees something wrong with this (or can recommend a similar way to convert between these two image formats) please let me know
Bookmarks