…I’m ashamed to admit it, yes. I double checked and this is the cause. Thanks.
Still, with this test case working in Ubuntu, while not working in Manjaro, while working OK in java code that uses imread, I conclude something in my java code for generation of the wiener filter or the filter2dfreq is the cause. (I have only just switched to manjaro from ubuntu - mid December - but this “black image” problem existed on ubuntu before that).
I’m going to back to basics and strip out all my javafx code and other stuff so that I have a bare java reproduction of the out_of_focus sample.
Thanks again.
this is why I hate working alone on something. nobody to bounce ideas off of or easily show everything-everything real quick. it’s impossible to ask for or guess these little things from the outside.
well I recreated the C++ example in java, and created a fresh install of eclipse on ubuntu and found the following, bizarre (from my point of view) results.
-
on manjaro there is a system level install of opencv - a GIMP plugin seems to need it. If is a 450 build.
-
on manjaro, if I run against this sys version I can load jpegs, but my wiener filter code and the sample reproduction produce a black image
-
on manjaro if I download and build 4.5.0 or 4.5.1 and build, I cannot load jpgs in any code. The sys level opencv and these others where linked against matching SOs have the same version, but the from-source-builds link in many other SOs.
-
On ubuntu, similar happens, but I can load jpgs. The wiener code (mine and the reproduced sample) still produces black images. This happens for when using 450 or 451.
-
But … on ubuntu, when I reference the opencv_450.jar from the 450 source build but reference the 451 source built SOs, it works! I can load images and the wiener code(s) work. (I symlink the libopencv_java451.so to libopencv_java450.so to make it think the SO it needs is present)
At this point, I am going to preserve this environment permanently so that I can keep working, but happy to try our more environmental changes after a few days! it seems my code isn’t that bad after all, but something it depends on has a small and mysterious change that causes an issue.
Thanks for the help so far, and happy to help get to the root cause if I can.
In case anyone is ever interested, after much trial and error on-and-off over the year I got this to work: the culprit was wrong order parameters in a call to Imgproc.divide during PSF calculation. I had:
Scalar summa = Core.sumElems(psf);
Mat done = new Mat();
Core.divide(summa.val[0], psf, done);
and I needed:
Scalar summa = Core.sumElems(psf);
Mat done = new Mat();
Core.divide( psf, summa, done);