tvn-cosine / tesseract.net

a .net wrapper for Tesseract
GNU General Public License v3.0
24 stars 13 forks source link

How to convert OpenCV Mat to Pix? #26

Open YunjunYang opened 5 years ago

YunjunYang commented 5 years ago

I applied 'OpenCvSharp3-AnyCPU' with tesseract.net to OCR, and I want to directly send 'Mat' to 'Pix', then set property of SetImage as following: Pix pix = cvtMat2PIX(image); // Set the input image tessBaseAPI.SetImage(pix);

The method to transfer Mat to Pix: public static Pix cvtMat2PIX(Mat imgGray) { int cols = imgGray.Cols; int rows = imgGray.Rows; Pix pix = new Pix(imgGray.Data); return pix; }

However, it's useless, anybody who can solve the issue? Tks a lot!