Ask Your Question

Trying to use MultiBandBlender in Java

asked 2020-11-26 01:57:16 -0500

seva gravatar image

I'm trying to utilize MultiBandBlender, but it seems there's no Java binding available. I've tried recompiling OpenCV 4.5 with BUILD_opencv_stitching=ON, but this did not result in MultiBandBlender to be included in opencv-450.jar.

I've searched far and wide, and can't seem to figure out whether: 1. It's possible to use MultiBandBlender with Java. 2. If yes, how to achieve it.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2020-11-26 02:57:24 -0500

berak gravatar image

weird as it is, currently there are no java bindings for the stitching module at all !

you could try to mend that by adding "java" to the CmakeLists.txt file, so it says:

WRAP python java)

in the last line, then rerun cmake && make && make install

please try & report back !

edit flag offensive delete link more


Thanks for the quick answer @berak. I have followed your direction, but now the build fails with this.

seva gravatar imageseva ( 2020-11-26 04:28:06 -0500 )edit

unfortunately now, this looks unrelated to stitching or java (and i have no idea about AVX or clamdblas on apple ...)

berak gravatar imageberak ( 2020-11-26 04:41:18 -0500 )edit

@berak, I confirm that it is only the addition of "java" to WRAP that leads to this error. I have matched the logs of a successful build (without WRAP java), and an unsuccessful build (with WRAP java). The logs around the error are almost identical. They both show the same errors re AVX (which is disabled), and clambas. They both then show:

Built target opencv_core

But at this point, the "WRAP java" variant exits with *** [all] Error 2.

Looking higher in the log, I see this. Perhaps this is what's leading the build to exit with Error 2. Trying to figure out how to resolve this problem.

seva gravatar imageseva ( 2020-11-26 06:03:02 -0500 )edit

I have tried to patch the build to make it work with WRAP java. I ended up excluding in modules/java/jar/, which led me past the javac error. The build went through to the JNI compilation stage at 99%, which failed with this. It is definitely strange that "WRAP java" is missing from the stitching module. It's either that way on purpose, or by mistake. Looking at git blame, it seems "WRAP java" was never explicitly supported for the stitching module. In either case, since nobody is encountering these errors (since "WARP java" is not enabled), I'm guessing it'll be like this for a while longer. Thanks for your help @berak!

seva gravatar imageseva ( 2020-11-26 09:18:27 -0500 )edit

It is definitely strange that "WRAP java" is missing from the stitching module.

no, not that strange. and to be honest, i've been cheating on you a little, using you as a canary ;).

it was obviously excluded because of some problems, e.g. those you encountered...

if you really can get it to work, maybe you should make a github pr with your changes, so other java users can profit from it, too !!

berak gravatar imageberak ( 2020-11-26 10:06:50 -0500 )edit

please feel encouraged to open an issue on github, requesting java bindings for the module (or the parts you need at least)

crackwitz gravatar imagecrackwitz ( 2020-11-26 10:08:09 -0500 )edit

@berak and @crackwitz, I've posted an issue (with my workaround for a successful build) here.

seva gravatar imageseva ( 2020-11-27 05:53:40 -0500 )edit

Question Tools

1 follower


Asked: 2020-11-26 01:57:16 -0500

Seen: 23 times

Last updated: Nov 26 '20