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

Cannot run examples on Ubuntu in a VirtualBox #11

Open
MihailV1989 opened this issue Dec 12, 2021 · 2 comments
Open

Cannot run examples on Ubuntu in a VirtualBox #11

MihailV1989 opened this issue Dec 12, 2021 · 2 comments

Comments

@MihailV1989
Copy link

MihailV1989 commented Dec 12, 2021

Hello,

I'm trying to run the QR code detection example on a Ubuntu 20.04.3 LTS 64-bit in a VirtualBox in Win10, but it seems PyBoof is not working properly. Running the DetectQrCodeApp from demonstrations.sh works just fine. The Python scripts are ran in a venv.

Running the qrcode_detect.py example as is or with any of the example images with QR codes says that no QR codes were detected without giving any error:

(AIKIT-env) mihail@myVB:~/AIKIT/PyBoof/examples$ python qrcode_detect.py
Launching Java process
Gateway Server Started
Detected a total of 0 QR Codes

Few examples do work, like:
gradient.py
object_tracking.py (actually tested only under Win10)
threshold_image.py

Others don't, like:
detect_lines.py (window with images shows, but no line can be seen, again no errors received)

video_mosaic.py, error recieved:

Launching Java process: java_port=25333 python_port=25334
Gateway Server Started
Traceback (most recent call last):
File "video_mosaic.py", line 15, in
config_tracker.klt.toleranceFB = 10.0
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/pyboof/common.py", line 95, in getattr
return object.getattribute(self, item)
AttributeError: 'ConfigPointTracker' object has no attribute 'klt'

estimate_camera_motion.py, error received:

Launching Java process: java_port=25333 python_port=25334
Gateway Server Started
Detected 3150 features in image 0
3179 image 1
Traceback (most recent call last):
File "estimate_camera_motion.py", line 40, in
matches = associator.associate()
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/pyboof/feature.py", line 205, in associate
output.append((association.src, association.dst, association.fitScore))
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/pyboof/common.py", line 44, in getattr
return object.getattribute(self, item)
AttributeError: 'JavaWrapper' object has no attribute 'src'

match_features.py, error received:

Launching Java process: java_port=25333 python_port=25334
Gateway Server Started
Traceback (most recent call last):
File "match_features.py", line 22, in
locs0, desc0 = feature_detector.detect(image0)
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/pyboof/feature.py", line 298, in detect
descriptions = b2p_list_descF64(java_descriptions)
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/pyboof/feature.py", line 42, in b2p_list_descF64
mmap_list_TupleF64_to_python(boof_list, pylist)
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/pyboof/feature.py", line 641, in mmap_list_TupleF64_to_python
gateway.jvm.pyboof.PyBoofEntryPoint.mmap.write_List_TupleF64(java_list, num_read)
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/py4j/java_gateway.py", line 1321, in call
return_value = get_return_value(
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/py4j/protocol.py", line 326, in get_return_value
raise Py4JJavaError(
py4j.protocol.Py4JJavaError: An error occurred while calling o55.write_List_TupleF64.
: java.lang.IndexOutOfBoundsException: Index 5892 out of bounds for length 5892
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at pyboof.BoofMemoryMapped.write_List_TupleF64(BoofMemoryMapped.java:75)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.base/java.lang.Thread.run(Thread.java:833)

I tried different PyBoof versions as well: 0.39.1.post1, 0.38.0, 0.36.0.
Python 3.8.10
JDK installed from zulu17.30.15-ca-jdk17.0.1-linux_amd64.deb

I get similar success running PyBoof directly on Win10 with Python 3.9.9 and Oracle jdk-17_windows-x64. Same examples work and the ones that don't work give same error. Running the DetectQrCodeApp from demonstrations.bat works with the exception that the movie.mp4 example hangs up after just about 1 second, but I could live with this one.

I have no idea where to search for a possible problem/mistake, so any hint would be useful. The only thing I've still didn't tried is, to use Python 3.5, because the requirement is Python >=3, isn't it?

Thanks!
Mihail

P.S. Building from source fails on both Ubuntu and Win10. Small part from the output from Ubuntu:

(AIKIT-env) mihail@myVB:~/AIKIT/PyBoof$ ./setup.py build
/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/setuptools/dist.py:473: UserWarning: Normalizing '0.39.1r1' to '0.39.1.post1'
warnings.warn(
running build
running build_py
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/mihail/AIKIT/PyBoof/build.gradle'

  • What went wrong:
    Could not compile build file '/home/mihail/AIKIT/PyBoof/build.gradle'.
    startup failed:
    General error during semantic analysis: Unsupported class file major version 61

    java.lang.IllegalArgumentException: Unsupported class file major version 61
    at groovyjarjarasm.asm.ClassReader.(ClassReader.java:196)
    at groovyjarjarasm.asm.ClassReader.(ClassReader.java:177)
    at groovyjarjarasm.asm.ClassReader.(ClassReader.java:163)
    at groovyjarjarasm.asm.ClassReader.(ClassReader.java:284)
    at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
    at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
    ......

EDIT: I just found out, that the tools I actually need are the fiducial functions. So I tried to run the examples:
fiducial_square_aruco.py
fiducial_square_binary_3D.py
fiducial_square_image_3D.py

and all three are only working without intrinsics, which is of no use to me, as I need the 3D position. Otherwise I get the following error:

Launching Java process: java_port=25333 python_port=25334
Gateway Server Started
Configuring detector
Traceback (most recent call last):
File "fiducial_square_binary_3D.py", line 19, in
detector.set_intrinsic(intrinsic)
File "/home/mihail/AIKIT/AIKIT-env/lib/python3.8/site-packages/pyboof/recognition.py", line 218, in set_intrinsic
distortion = create_narrow_lens_distorter(intrinsic)
NameError: name 'create_narrow_lens_distorter' is not defined

So now I have concrete a question: when I download the Python library by entering pip3 install pyboof, do I get a binary or is it compiling it from source in the background, possibly without letting me know that there were errors like when I try to compile it manually?

@lessthanoptimal
Copy link
Owner

There are a few things going on and I'll answer the easiest questions/issues now.

  1. "when I download the Python library by entering pip3 install pyboof, do I get a binary or is it compiling"

You're getting a precompiled binary/jar

  1. "Unsupported class file major version 61"

Is caused when javac is configured to build for an earlier version of Java's byte code but a library it depends on is using a newer version. 61 is the major version for Java 17 but the build script forces it to build for Java 11 (or maybe 8, just start transitioning libraries). Did you build some other dependency locally? As long as it downloads pre-compile jars from the internet you shouldn't get that error.

  1. "NameError: name 'create_narrow_lens_distorter' is not defined"

This could be a mistake on my end. I'll look into that.

  1. Everything else

I'm a bit confused my the other error you listed. Looks like something is getting seriously mangled. I'll have some follow up questions.

@MihailV1989
Copy link
Author

Thanks for the fast reply!

  1. "Did you build some other dependency locally? As long as it downloads pre-compile jars from the internet you shouldn't get that error."

I have no experience with Java and this was the first time I have installed a JDK on Ubuntu. When I tried to build from source, I just followed the steps here:
https://github.com/lessthanoptimal/PyBoof#installing-from-source

In the Python venv there were few other libraries but they were all installed with pip without building anything from source. Now I have just created a new venv only for PyBoof while following the steps from the above link exactly. Upon compiling the first time I got almost the same error with an additional info upon starting a Gradle Daemon:

Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details

I'm attaching the whole output as a .txt as it's very long:

PyBoofBuiltError.txt

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

No branches or pull requests

2 participants