c++ - To display float point image in Qt -


i getting float point image in range of 0 1. tried display float image in qt using label didn't work. checked qimage formats , found qt don't support float image. trying in way..

            qvector<qrgb> colortable;             (int = 0; < 256; i++)              colortable.push_back(qrgb(i, i, i));              mat img2;             depthimg.convertto(img2, cv_8uc1);             assert(img2.iscontinuous());             qimage image = qimage((unsigned char*)(img2.data), depthimg.cols, depthimg.rows, qimage::format_indexed8);             image.setcolortable(colortable);             ui.threed->setpixmap(qpixmap::fromimage(image, qt::autocolor));             ui.threed->setscaledcontents(true);             qapp->processevents();             this->ui.threed->show(); 

here "depthimage" float point image.

 mat img2;  depthimg.convertto(img2, cv_8uc1);  assert(img2.iscontinuous());  qimage image = qimage((unsigned char*)img2.data, img2.cols, img2.rows, img2.cols*3, qimage::format_rgb888);  ui.threed->setpixmap(qpixmap::fromimage(image, qt::autocolor));  ui.threed->setscaledcontents(true);  qapp->processevents();  this->ui.threed->show(); 

after executing in both ways getting black image. can body me solve issue ?

you need scale image factor 255. can changing

depthimg.convertto(img2, cv_8uc1); 

with

depthimg.convertto(img2, cv_8uc1, 255.0); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -