Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got error "jpeg_mem_loader: unsupported pixel size" #99

Open
cclim opened this issue Apr 11, 2023 · 0 comments
Open

got error "jpeg_mem_loader: unsupported pixel size" #99

cclim opened this issue Apr 11, 2023 · 0 comments

Comments

@cclim
Copy link

cclim commented Apr 11, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant