bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.57k stars 1.58k forks source link

OpenCVDemo in DeepLearningFaceDetection:error: (-215:Assertion failed) nch == 1 in function 'blobFromImages' #1458

Open bbbBBBSG opened 4 years ago

bbbBBBSG commented 4 years ago
 Caused by: java.lang.RuntimeException: OpenCV(4.3.0) /home/travis/build/javacpp-presets/opencv/cppbuild/android-arm64/opencv-4.3.0/modules/dnn/src/dnn.cpp:398: error: (-215:Assertion failed) nch == 1 in function 'blobFromImages'

        at org.bytedeco.opencv.global.opencv_dnn.blobFromImage(Native Method)

The error is on line 51

Mat blob = blobFromImage(image, 1.0, new Size(300, 300), new Scalar(104.0, 177.0, 123.0, 0), false, false, CV_32F);
saudet commented 4 years ago

Sounds like that doesn't support color images?

saudet commented 4 years ago

This error apparently means that it doesn't support images with 2 channels: https://github.com/opencv/opencv/issues/9747

Make sure your image doesn't have 2 channels, and try images with 1, 3, or 4 channels.