Passing image to QPixMap not as path in QT

asked 2013-05-28 12:41:01 -0600

Nermeen gravatar image

updated 2013-05-28 12:47:36 -0600

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"));
edit retag flag offensive close merge delete

Comments

where's the relation to opencv ?

berak gravatar imageberak ( 2013-05-28 12:43:05 -0600 )edit

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

Nermeen gravatar imageNermeen ( 2013-05-28 12:48:46 -0600 )edit

hey, no prob, just explain ;)

berak gravatar imageberak ( 2013-05-28 12:57:35 -0600 )edit

yea, nice update ;)

berak gravatar imageberak ( 2013-05-28 13:03:59 -0600 )edit

:) so, no solution :\

Nermeen gravatar imageNermeen ( 2013-05-28 13:18:49 -0600 )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 ( 2013-05-28 14:01:16 -0600 )edit

it's Ok thank u anyway :)

Nermeen gravatar imageNermeen ( 2013-05-28 14:46:35 -0600 )edit