CertifaiAI / cdle-traininglabs

Certifai Training Labs Repository using Eclipse Deeplearning4j
https://certifai.ai/
Apache License 2.0
41 stars 70 forks source link

j < nimages in function 'cv::histPrepareImages for package ai.certifai.solution.image_processing.HistogramEqualization.java #147

Closed KianYang-Lee closed 3 years ago

KianYang-Lee commented 3 years ago

Describe the bug When run, this error occurred.

opencv-4.3.0\modules\imgproc\src\histogram.cpp:160: error: (-215:Assertion failed) j < nimages in function 'cv::histPrepareImages

Screenshots image

Additional context Also noticed the outdated import line. Will open a branch to fix this when schedule is less packed.

jacklynlxq commented 3 years ago

It seems to be the problem with the dimension / number of channels.

Not sure if it'd work on your machine but I managed to eliminate the error by changing this line private IntPointer channels = new IntPointer(3); to int[] channels_arr = new int[]{0, 1, 2}; private IntPointer channels = new IntPointer(channels_arr);

in the Histogram1DJava.java file

I am not sure what is the reason behind it but you can look into the source code and maybe there's a better workaround:

Ref: https://github.com/bytedeco/javacv-examples/blob/master/OpenCV_Cookbook/src/test/java/opencv_cookbook/CalcHistTest.java

KianYang-Lee commented 3 years ago

Thanks! It works wonderfully! will update it in the patch