Passing image to QPixMap not as path in QT

asked May 28 '13

Nermeen gravatar image

updated May 28 '13

Is there a way to pass an image as a name not as a path to Qpixmap in QT(C++),, for example i have the following code in which the processed image should be displayed using Qpixmap label but when i tried that i have to save it and then to pass it to Qpixmap to be displayed,,, but it's not an efficient way so could anybody help me please i'm new to Qt and have no experience..

    void MainWindow::on_pushButton_3_clicked()
{
    cv::Mat hsv_img, seg_img,infected_area, hsv_infected,seg_input,hsv_seg;
    Mat filter_img,hsv;

    cv::Mat input_image = imread(this->file_name.toAscii().data());
    medianBlur(input_image,filter_img,7);
    cvtColor(filter_img, hsv, CV_BGR2HSV);
    hsvSeg(filter_img,hsv, hsv_img, seg_img,14.0,0.0,117.0,255.0,133.0,179.0);//call hsv segmentation function to segment leaf
    cvtColor(seg_img, hsv_seg, CV_BGR2HSV);
    hsvSeg(seg_img,hsv_seg, hsv_infected, infected_area,0.09*255,0.01*255,0.1*255,0.14*255,1.0*255,1.0*255);//call hsv segmentation to segment infected areas
    imwrite( "C:/Image.jpg", filter_img );

    this->ui->ImageView_2->setPixmap(QPixmap("C:/Image.jpg"));
Preview: (hide)

Comments

where's the relation to opencv ?

berak gravatar imageberak (May 28 '13)edit

sorry if it is not allowed to post it here,,, but it's opencv code integrated with qt

Nermeen gravatar imageNermeen (May 28 '13)edit

hey, no prob, just explain ;)

berak gravatar imageberak (May 28 '13)edit

yea, nice update ;)

berak gravatar imageberak (May 28 '13)edit

:) so, no solution :\

Nermeen gravatar imageNermeen (May 28 '13)edit

sorry, no (i'm not into Qt). but now it's obvious , that you're seeking for an in memory solution to translate between cv::Mat and QPixmap

berak gravatar imageberak (May 28 '13)edit

it's Ok thank u anyway :)

Nermeen gravatar imageNermeen (May 28 '13)edit