Hi everyone,
I want to know how to convert an image in cv::Mat type to TASImage. I have read the root document but still very fuzzy. The main issue is that being not sure of converting rgb pixel to the Double_t array. I cannot find any equation or interface (TImagePalette, TColor) to help to do the conversion easily. Look like have to lookup the rgb value in the Palette table (fColorBlue, fColorGreen,fColorRed,fPoints) to map to the Double_t value but it seems over-complicated.
Another option is that convert cvMat to png and save in a char* buffer, then set that buffer to TASImage. So i try some simple macro as below just to understand the SetImageBuffer method.
TASImage img1("cvImg.jpg");
TASImage tImg;
char *buf;
int sz;
img1.GetImageBuffer(&buf, &sz);
tImg.SetImageBuffer(&buf);// show error here: libpng error: invalid screen gamma in png_set_gamma
tImg.Draw(); // error: Error in <TASImage::Draw>: no image set
The macro throws some error about screen gamma. Do you have any suggestions?
_ROOT Version: 6.20/05
_Platform: Ubuntu16
_Compiler: cling