got error "jpeg_mem_loader: unsupported pixel size"
cclim opened this issue · 0 comments
I capture a frame from webcam using this line of code:
webcam.Read(&frame)
and then convert it into grayscale using these lines of code:
grayImg := gocv.NewMat()
gocv.CvtColor(frame, &grayImg, gocv.ColorBGRToGray)
and then convert the grayscale Mat into JPG using this line of code:
jpgFrame, err := gocv.IMEncodeWithParams(gocv.JPEGFileExt, grayImg, []int{gocv.IMWriteJpegQuality, 100})
and then try to recognize the JPG using this line of code:
encodings, err := rec.Recognize(jpgFrame.GetBytes())
apparently it gives an error as per issue title.
checking here and there, I found in this repo (file jpeg_mem_loader.cc lines 50-53) as follow:
if (cinfo.output_components != 3) {
jpeg_destroy_decompress(&cinfo);
throw dlib::image_load_error("jpeg_mem_loader: unsupported pixel size");
}
as far as I know, for grayscale image, the output_components will be 1. Does it mean that Recognize function can only be used in non-grayscale JPG image? is it expected like that?