I need to convert between OpenCV Mat image and Leptonica Pix image formats in C++. This is being used for binarization of 8bit gray images.
To convert pix to Mat add these line in @loot code before calling pix8toMat.
Pix *8bitPix = pixConvert1To8(NULL, pixt, 255, 0);
Now send this 8bitPix to mat conversion. [it works for binary image]