fehlfarbe / python-aruco

Python wrappers for ArUco library
Other
67 stars 16 forks source link

Does the wrapper support the feature fractal markers #33

Open AndreV84 opened 5 years ago

AndreV84 commented 5 years ago

it is rather a question or feature request than an issue. Thank you for understanding.

fehlfarbe commented 5 years ago

I updated the Python wrapper to aruco 3.1.2 which supports fractal markers. Can you try the branch 3.1.2? It's not uploaded to pip yet.

AndreV84 commented 5 years ago

Setting it up! Thank you for pointing out!

On Fri, May 24, 2019 at 1:35 PM fehlfarbe notifications@github.com wrote:

I updated the Python wrapper to aruco 3.1.2 which supports fractal markers. Can you try the branch 3.1.2 https://github.com/fehlfarbe/python-aruco/tree/aruco-3.1.2? It's not uploaded to pip yet.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fehlfarbe/python-aruco/issues/33?email_source=notifications&email_token=AD45YWNY32POHDOE2NQHHZ3PW7VIXA5CNFSM4HPMHNB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWFLUOQ#issuecomment-495630906, or mute the thread https://github.com/notifications/unsubscribe-auth/AD45YWKLNHUIVHNM776EGKTPW7VIXANCNFSM4HPMHNBQ .

AndreV84 commented 5 years ago

I am trying to install it but getting errors

sudo apt-get install swig3.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
swig3.0 is already the newest version (3.0.12-1).
The following package was automatically installed and is no longer required:
  libsdl-ttf2.0-0
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.

Traceback (most recent call last): File "setup.py", line 13, in <module> shutil.copy("./py3/aruco.py", ".") File "/home/nvidia/venv/lib/python3.6/shutil.py", line 241, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "/home/nvidia/venv/lib/python3.6/shutil.py", line 120, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: './py3/aruco.py'

fehlfarbe commented 5 years ago

Did you run ./swigbuild.sh? That creates the missing directories and files

AndreV84 commented 5 years ago

got through with: apt install libeigen3-dev

AndreV84 commented 5 years ago

python3 ./fractal.py Traceback (most recent call last): File "./fractal.py", line 5, in import aruco ModuleNotFoundError: No module named 'aruco'

fehlfarbe commented 5 years ago

did you run sudo python3 setup.py install after swigbuild?

AndreV84 commented 5 years ago

python Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import cv2 import cv2.aruco import aruco Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'aruco'

does swigbuild need swig or swig3.0 in case of python 3?

AndreV84 commented 5 years ago

it seems that it installed aruco to system wide python instead of the one that I am using in the virtualenv (venv) nvidia@nvidia:~/python-aruco-aruco-3.1.2$ sudo python3 setup.py install running install

AndreV84 commented 5 years ago

after I installed it system wide it fails with: python3 fractal.py Traceback (most recent call last): File "fractal.py", line 5, in import cv2.aruco ModuleNotFoundError: No module named 'cv2.aruco'

AndreV84 commented 5 years ago

with python2 it fails with: python fractal.py Traceback (most recent call last): File "fractal.py", line 10, in detector = cv2.aruco.FractalDetector() AttributeError: 'module' object has no attribute 'FractalDetector'

AndreV84 commented 5 years ago

probably the opencv-contrib doesn't have the fractal detector?

fehlfarbe commented 5 years ago

You don't have to import cv2.aruco just use import aruco and detector = aruco.FractalDetector() and so on

AndreV84 commented 5 years ago

trying again: Ubuntu 18.04 with opencv 4.0.1, aruco 3.6.1 Python 3.6.7

git clone --single-branch --branch aruco-3.1.2 https://github.com/fehlfarbe/python-aruco.git

~/opencv-4.1.0/python-aruco/example$ python3 fractal.py Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/aruco.py", line 14, in swig_import_helper return importlib.import_module(mname) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 658, in _load_unlocked File "", line 571, in module_from_spec File "", line 922, in create_module File "", line 219, in _call_with_frames_removed ImportError: /usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/_aruco.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "fractal.py", line 5, in import aruco File "/usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/aruco.py", line 17, in _aruco = swig_import_helper() File "/usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/aruco.py", line 16, in swig_import_helper return importlib.import_module('_aruco') File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: /usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/_aruco.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6 Segmentation fault (core dumped)

AndreV84 commented 5 years ago

python Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import cv2 import aruco Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/aruco-3.1.2.0-py2.7-linux-x86_64.egg/aruco.py", line 17, in _aruco = swig_import_helper() File "/usr/local/lib/python2.7/dist-packages/aruco-3.1.2.0-py2.7-linux-x86_64.egg/aruco.py", line 16, in swig_import_helper return importlib.import_module('_aruco') File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) ImportError: /usr/local/lib/python2.7/dist-packages/aruco-3.1.2.0-py2.7-linux-x86_64.egg/_aruco.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6

AndreV84 commented 5 years ago

python3 Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import cv2 import aruco Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/aruco.py", line 14, in swig_import_helper return importlib.import_module(mname) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 658, in _load_unlocked File "", line 571, in module_from_spec File "", line 922, in create_module File "", line 219, in _call_with_frames_removed ImportError: /usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/_aruco.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/aruco.py", line 17, in _aruco = swig_import_helper() File "/usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/aruco.py", line 16, in swig_import_helper return importlib.import_module('_aruco') File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: /usr/local/lib/python3.6/dist-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg/_aruco.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6

AndreV84 commented 5 years ago

did you try it with python 3.6?

fehlfarbe commented 5 years ago

Yes, I tried with python 3.6 I also did a fresh docker install for Ubuntu 18.04:

(created this Dockerfile in python-aruco directory and executed docker build .)

FROM ubuntu:18.04
SHELL ["/bin/bash", "-c"]

# Replace 1000 with your user / group id
RUN apt-get update && apt-get install -y sudo apt-utils

# install tools and libs
RUN sudo apt-get update \
&& sudo apt-get install -y git-core bash-completion \
wget build-essential cmake pkg-config libjpeg8-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran \
python2.7-dev python3-dev python-pip python3-pip swig unzip python3-numpy
RUN sudo -H pip3 install --upgrade pip

RUN whoami && pwd

# install opencv and aruco
RUN mkdir -p /home/user/src \
&& cd /home/user/src/ && wget -q -O opencv.zip https://github.com/opencv/opencv/archive/3.1.0.zip && ls -l && unzip opencv.zip \
&& cd opencv-3.1.0 && mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_STANDARD=11 -DENABLE_PRECOMPILED_HEADERS=OFF .. \
&& make -j6 \
&& sudo make install \
&& cd /home/user/src/

RUN apt install -y libeigen3-dev

RUN mkdir -p /home/user/src/python-aruco
COPY . /home/user/src/python-aruco/
RUN cd /home/user/src/python-aruco && \
    sudo pip3 install --upgrade setuptools && \
    sudo pip3 install --upgrade pip wheel cython
RUN cd /home/user/src/python-aruco && ls -lr && ./swigbuild.sh python3 && sudo ldconfig && \
ls -l *.so && python3 setup.py sdist bdist_wheel && pip3 install dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl && python3 -c "import aruco; print(aruco)" && python3 ./example/fractal.py

I'm working on a x86 system so maybe it's just not working on ARM. Maybe I can test it on Monday with my Jetson TX1.

AndreV84 commented 5 years ago

it seems that your docker file utilizes opencv 3.1. At x86_64 computer I created docker file with the content as the above and it won't work ``

AndreV84 commented 5 years ago

I did up a cloud instance with 18.04, downloaded the python-aruco, and added Dockerfile and started with docker build .

it fails, unfortunately both at local x86_64 and in cloud instances with 18.04 and clean OS Tail: `-- Installing: /usr/local/include/opencv2/flann/allocator.h -- Installing: /usr/local/include/opencv2/flann/any.h -- Installing: /usr/local/include/opencv2/flann/autotuned_index.h -- Installing: /usr/local/include/opencv2/flann/composite_index.h -- Installing: /usr/local/include/opencv2/flann/config.h -- Installing: /usr/local/include/opencv2/flann/defines.h -- Installing: /usr/local/include/opencv2/flann/dist.h -- Installing: /usr/local/include/opencv2/flann/dummy.h -- Installing: /usr/local/include/opencv2/flann/dynamic_bitset.h -- Installing: /usr/local/include/opencv2/flann/general.h -- Installing: /usr/local/include/opencv2/flann/ground_truth.h -- Installing: /usr/local/include/opencv2/flann/hdf5.h -- Installing: /usr/local/include/opencv2/flann/heap.h -- Installing: /usr/local/include/opencv2/flann/hierarchical_clustering_index.h -- Installing: /usr/local/include/opencv2/flann/index_testing.h -- Installing: /usr/local/include/opencv2/flann/kdtree_index.h -- Installing: /usr/local/include/opencv2/flann/kdtree_single_index.h -- Installing: /usr/local/include/opencv2/flann/kmeans_index.h -- Installing: /usr/local/include/opencv2/flann/linear_index.h -- Installing: /usr/local/include/opencv2/flann/logger.h -- Installing: /usr/local/include/opencv2/flann/lsh_index.h -- Installing: /usr/local/include/opencv2/flann/lsh_table.h -- Installing: /usr/local/include/opencv2/flann/matrix.h -- Installing: /usr/local/include/opencv2/flann/nn_index.h -- Installing: /usr/local/include/opencv2/flann/object_factory.h -- Installing: /usr/local/include/opencv2/flann/params.h -- Installing: /usr/local/include/opencv2/flann/random.h -- Installing: /usr/local/include/opencv2/flann/result_set.h -- Installing: /usr/local/include/opencv2/flann/sampling.h -- Installing: /usr/local/include/opencv2/flann/saving.h -- Installing: /usr/local/include/opencv2/flann/simplex_downhill.h -- Installing: /usr/local/include/opencv2/flann/timer.h -- Installing: /usr/local/lib/libopencv_imgproc.so.3.1.0 -- Installing: /usr/local/lib/libopencv_imgproc.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_imgproc.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_imgproc.so -- Installing: /usr/local/include/opencv2/imgproc.hpp -- Installing: /usr/local/include/opencv2/imgproc/imgproc.hpp -- Installing: /usr/local/include/opencv2/imgproc/imgproc_c.h -- Installing: /usr/local/include/opencv2/imgproc/types_c.h -- Installing: /usr/local/include/opencv2/imgproc/detail/distortion_model.hpp -- Installing: /usr/local/lib/libopencv_ml.so.3.1.0 -- Installing: /usr/local/lib/libopencv_ml.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_ml.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_ml.so -- Installing: /usr/local/include/opencv2/ml.hpp -- Installing: /usr/local/include/opencv2/ml/ml.hpp -- Installing: /usr/local/lib/libopencv_photo.so.3.1.0 -- Installing: /usr/local/lib/libopencv_photo.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_photo.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_photo.so -- Installing: /usr/local/include/opencv2/photo.hpp -- Installing: /usr/local/include/opencv2/photo/cuda.hpp -- Installing: /usr/local/include/opencv2/photo/photo.hpp -- Installing: /usr/local/include/opencv2/photo/photo_c.h -- Installing: /usr/local/lib/libopencv_video.so.3.1.0 -- Installing: /usr/local/lib/libopencv_video.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_video.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_video.so -- Installing: /usr/local/include/opencv2/video.hpp -- Installing: /usr/local/include/opencv2/video/background_segm.hpp -- Installing: /usr/local/include/opencv2/video/tracking.hpp -- Installing: /usr/local/include/opencv2/video/video.hpp -- Installing: /usr/local/include/opencv2/video/tracking_c.h -- Installing: /usr/local/lib/libopencv_imgcodecs.so.3.1.0 -- Installing: /usr/local/lib/libopencv_imgcodecs.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_imgcodecs.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_imgcodecs.so -- Installing: /usr/local/include/opencv2/imgcodecs.hpp -- Installing: /usr/local/include/opencv2/imgcodecs/imgcodecs.hpp -- Installing: /usr/local/include/opencv2/imgcodecs/imgcodecs_c.h -- Installing: /usr/local/include/opencv2/imgcodecs/ios.h -- Installing: /usr/local/lib/libopencv_shape.so.3.1.0 -- Installing: /usr/local/lib/libopencv_shape.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_shape.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_shape.so -- Installing: /usr/local/include/opencv2/shape.hpp -- Installing: /usr/local/include/opencv2/shape/emdL1.hpp -- Installing: /usr/local/include/opencv2/shape/hist_cost.hpp -- Installing: /usr/local/include/opencv2/shape/shape.hpp -- Installing: /usr/local/include/opencv2/shape/shape_distance.hpp -- Installing: /usr/local/include/opencv2/shape/shape_transformer.hpp -- Installing: /usr/local/lib/libopencv_videoio.so.3.1.0 -- Installing: /usr/local/lib/libopencv_videoio.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_videoio.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_videoio.so -- Installing: /usr/local/include/opencv2/videoio.hpp -- Installing: /usr/local/include/opencv2/videoio/videoio.hpp -- Installing: /usr/local/include/opencv2/videoio/cap_ios.h -- Installing: /usr/local/include/opencv2/videoio/videoio_c.h -- Installing: /usr/local/lib/libopencv_highgui.so.3.1.0 -- Installing: /usr/local/lib/libopencv_highgui.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_highgui.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_highgui.so -- Installing: /usr/local/include/opencv2/highgui.hpp -- Installing: /usr/local/include/opencv2/highgui/highgui.hpp -- Installing: /usr/local/include/opencv2/highgui/highgui_c.h -- Installing: /usr/local/lib/libopencv_objdetect.so.3.1.0 -- Installing: /usr/local/lib/libopencv_objdetect.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_objdetect.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_objdetect.so -- Installing: /usr/local/include/opencv2/objdetect.hpp -- Installing: /usr/local/include/opencv2/objdetect/detection_based_tracker.hpp -- Installing: /usr/local/include/opencv2/objdetect/objdetect.hpp -- Installing: /usr/local/include/opencv2/objdetect/objdetect_c.h -- Installing: /usr/local/lib/libopencv_superres.so.3.1.0 -- Installing: /usr/local/lib/libopencv_superres.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_superres.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_superres.so -- Installing: /usr/local/include/opencv2/superres.hpp -- Installing: /usr/local/include/opencv2/superres/optical_flow.hpp -- Installing: /usr/local/lib/libopencv_ts.a -- Installing: /usr/local/lib/libopencv_features2d.so.3.1.0 -- Installing: /usr/local/lib/libopencv_features2d.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_features2d.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_features2d.so -- Installing: /usr/local/include/opencv2/features2d.hpp -- Installing: /usr/local/include/opencv2/features2d/features2d.hpp -- Installing: /usr/local/lib/libopencv_calib3d.so.3.1.0 -- Installing: /usr/local/lib/libopencv_calib3d.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_calib3d.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_calib3d.so -- Installing: /usr/local/include/opencv2/calib3d.hpp -- Installing: /usr/local/include/opencv2/calib3d/calib3d.hpp -- Installing: /usr/local/include/opencv2/calib3d/calib3d_c.h -- Installing: /usr/local/lib/libopencv_stitching.so.3.1.0 -- Installing: /usr/local/lib/libopencv_stitching.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_stitching.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_stitching.so -- Installing: /usr/local/include/opencv2/stitching.hpp -- Installing: /usr/local/include/opencv2/stitching/warpers.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/autocalib.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/blenders.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/camera.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/exposure_compensate.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/matchers.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/motion_estimators.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/seam_finders.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/timelapsers.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/util.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/util_inl.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/warpers.hpp -- Installing: /usr/local/include/opencv2/stitching/detail/warpers_inl.hpp -- Installing: /usr/local/lib/libopencv_videostab.so.3.1.0 -- Installing: /usr/local/lib/libopencv_videostab.so.3.1 -- Set runtime path of "/usr/local/lib/libopencv_videostab.so.3.1.0" to "/usr/local/lib" -- Installing: /usr/local/lib/libopencv_videostab.so -- Installing: /usr/local/include/opencv2/videostab.hpp -- Installing: /usr/local/include/opencv2/videostab/deblurring.hpp -- Installing: /usr/local/include/opencv2/videostab/fast_marching.hpp -- Installing: /usr/local/include/opencv2/videostab/fast_marching_inl.hpp -- Installing: /usr/local/include/opencv2/videostab/frame_source.hpp -- Installing: /usr/local/include/opencv2/videostab/global_motion.hpp -- Installing: /usr/local/include/opencv2/videostab/inpainting.hpp -- Installing: /usr/local/include/opencv2/videostab/log.hpp -- Installing: /usr/local/include/opencv2/videostab/motion_core.hpp -- Installing: /usr/local/include/opencv2/videostab/motion_stabilizing.hpp -- Installing: /usr/local/include/opencv2/videostab/optical_flow.hpp -- Installing: /usr/local/include/opencv2/videostab/outlier_rejection.hpp -- Installing: /usr/local/include/opencv2/videostab/ring_buffer.hpp -- Installing: /usr/local/include/opencv2/videostab/stabilizer.hpp -- Installing: /usr/local/include/opencv2/videostab/wobble_suppression.hpp -- Installing: /usr/local/lib/python3.6/dist-packages/cv2.cpython-36m-x86_64-linux-gnu.so -- Set runtime path of "/usr/local/lib/python3.6/dist-packages/cv2.cpython-36m-x86_64-linux-gnu.so" to "/usr/local/lib" -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_eye.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_eye_tree_eyeglasses.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalcatface.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalcatface_extended.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt_tree.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_fullbody.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_lefteye_2splits.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_licence_plate_rus_16stages.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_lowerbody.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_profileface.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_righteye_2splits.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_russian_plate_number.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_smile.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_upperbody.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_frontalcatface.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_frontalface.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_profileface.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_silverware.xml -- Installing: /usr/local/bin/opencv_traincascade -- Set runtime path of "/usr/local/bin/opencv_traincascade" to "/usr/local/lib" -- Installing: /usr/local/bin/opencv_createsamples -- Set runtime path of "/usr/local/bin/opencv_createsamples" to "/usr/local/lib" -- Installing: /usr/local/bin/opencv_annotation -- Set runtime path of "/usr/local/bin/opencv_annotation" to "/usr/local/lib" Removing intermediate container 140833f31535 ---> ace676fd85e1 Step 8/12 : RUN apt install -y libeigen3-dev ---> Running in de8bcf4ad411

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists... Building dependency tree... Reading state information... Suggested packages: libeigen3-doc libmrpt-dev The following NEW packages will be installed: libeigen3-dev 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 810 kB of archives. After this operation, 7128 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libeigen3-dev all 3.3.4-4 [810 kB] debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline debconf: unable to initialize frontend: Readline debconf: (This frontend requires a controlling tty.) debconf: falling back to frontend: Teletype dpkg-preconfigure: unable to re-open stdin: Fetched 810 kB in 1s (959 kB/s) Selecting previously unselected package libeigen3-dev. (Reading database ... 44038 files and directories currently installed.) Preparing to unpack .../libeigen3-dev_3.3.4-4_all.deb ... Unpacking libeigen3-dev (3.3.4-4) ... Setting up libeigen3-dev (3.3.4-4) ... Removing intermediate container de8bcf4ad411 ---> 1688b44d4603 Step 9/12 : RUN mkdir -p /home/nvidia/src/python-aruco ---> Running in 59a6ac4dc43e Removing intermediate container 59a6ac4dc43e ---> df30c218369a Step 10/12 : COPY . /home/nvidia/src/python-aruco/ ---> aafde9f3d8c5 Step 11/12 : RUN cd /home/nvidia/src/python-aruco && sudo pip3 install --upgrade setuptools && sudo pip3 install --upgrade pip wheel cython ---> Running in df832f506862 Collecting setuptools Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB) Installing collected packages: setuptools Found existing installation: setuptools 39.0.1 Uninstalling setuptools-39.0.1: Successfully uninstalled setuptools-39.0.1 Successfully installed setuptools-41.0.1 Requirement already up-to-date: pip in /usr/local/lib/python3.6/dist-packages (19.1.1) Collecting wheel Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl Collecting cython Downloading https://files.pythonhosted.org/packages/b2/20/46a78072ecd4fda072c3791a257b03af99b64673671663067d18bc4935ec/Cython-0.29.7-cp36-cp36m-manylinux1_x86_64.whl (2.1MB) Installing collected packages: wheel, cython Found existing installation: wheel 0.30.0 Uninstalling wheel-0.30.0: Successfully uninstalled wheel-0.30.0 Successfully installed cython-0.29.7 wheel-0.33.4 Removing intermediate container df832f506862 ---> f5efde397d83 Step 12/12 : RUN cd /home/nvidia/src/python-aruco && ls -lr && ./swigbuild.sh python3 && sudo ldconfig && ls -l .so && python3 setup.py sdist bdist_wheel && pip3 install dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl && python3 -c "import aruco; print(aruco)" && python3 ./example/fractal.py ---> Running in 225e9b5a4dbc total 1316 -rwxr-xr-x 1 root root 631 May 25 07:32 swigbuild.sh drwxr-xr-x 3 root root 4096 May 25 07:32 src -rw-r--r-- 1 root root 1790 May 25 07:32 setup.py -rw-r--r-- 1 root root 62 May 25 07:32 setup.cfg -rw-r--r-- 1 root root 16643 May 25 07:32 okapi-typemaps.i -rw-r--r-- 1 root root 56242 May 25 07:32 numpy_old.i drwxr-xr-x 2 root root 4096 May 25 07:32 example -rwxr-xr-x 1 root root 1037 May 25 07:32 build_wheel.sh -rw-r--r-- 1 root root 616 May 25 07:32 aruco_wrap.h -rw-r--r-- 1 root root 1215801 May 25 07:32 aruco_wrap.cxx -rw-r--r-- 1 root root 6485 May 25 07:32 aruco.i -rw-r--r-- 1 root root 2338 May 25 07:32 README.md -rw-r--r-- 1 root root 101 May 25 07:32 MANIFEST.in -rw-r--r-- 1 root root 1522 May 25 07:32 LICENSE -rw-r--r-- 1 root root 1518 May 25 07:35 Dockerfile src/aruco/cameraparameters.h:79: Warning 362: operator= ignored src/aruco/dictionary.h:99: Warning 314: 'is' is a python keyword, renaming to '_is' src/aruco/dictionary.h:136: Warning 389: operator[] ignored (consider using %extend) src/aruco/marker.h:147: Warning 362: operator= ignored src/aruco/markerdetector.h:214: Warning 325: Nested struct not currently supported (Params ignored) src/aruco/markermap.h:64: Warning 389: operator[] ignored (consider using %extend) src/aruco/markermap.h:65: Warning 389: operator[] ignored (consider using %extend) src/aruco/timers.h:171: Warning 314: 'print' is a python keyword, renaming to '_print' src/aruco/timers.h:171: Warning 314: 'print' is a python keyword, renaming to '_print' src/aruco/cameraparameters.h:138: Warning 503: Can't wrap 'operator <<' unless renamed to a valid identifier. src/aruco/cameraparameters.h:139: Warning 503: Can't wrap 'operator >>' unless renamed to a valid identifier. src/aruco/marker.h:154: Warning 503: Can't wrap 'operator <' unless renamed to a valid identifier. src/aruco/marker.h:170: Warning 503: Can't wrap 'operator <<' unless renamed to a valid identifier. src/aruco/markerdetector.h:288: Warning 509: Overloaded method aruco::MarkerDetector::getParameters() effectively ignored, src/aruco/markerdetector.h:285: Warning 509: as it is shadowed by aruco::MarkerDetector::getParameters() const. src/aruco/cameraparameters.h:79: Warning 362: operator= ignored src/aruco/dictionary.h:99: Warning 314: 'is' is a python keyword, renaming to '_is' src/aruco/dictionary.h:136: Warning 389: operator[] ignored (consider using %extend) src/aruco/marker.h:147: Warning 362: operator= ignored src/aruco/markerdetector.h:214: Warning 325: Nested struct not currently supported (Params ignored) src/aruco/markermap.h:64: Warning 389: operator[] ignored (consider using %extend) src/aruco/markermap.h:65: Warning 389: operator[] ignored (consider using %extend) src/aruco/timers.h:171: Warning 314: 'print' is a python keyword, renaming to '_print' src/aruco/timers.h:171: Warning 314: 'print' is a python keyword, renaming to '_print' src/aruco/cameraparameters.h:138: Warning 503: Can't wrap 'operator <<' unless renamed to a valid identifier. src/aruco/cameraparameters.h:139: Warning 503: Can't wrap 'operator >>' unless renamed to a valid identifier. src/aruco/marker.h:154: Warning 503: Can't wrap 'operator <' unless renamed to a valid identifier. src/aruco/marker.h:170: Warning 503: Can't wrap 'operator <<' unless renamed to a valid identifier. src/aruco/markerdetector.h:288: Warning 509: Overloaded method aruco::MarkerDetector::getParameters() effectively ignored, src/aruco/markerdetector.h:285: Warning 509: as it is shadowed by aruco::MarkerDetector::getParameters() const. Traceback (most recent call last): File "setup.py", line 18, in license = fh.read() File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 25: ordinal not in range(128) The command '/bin/bash -c cd /home/nvidia/src/python-aruco && ls -lr && ./swigbuild.sh python3 && sudo ldconfig && ls -l .so && python3 setup.py sdist bdist_wheel && pip3 install dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl && python3 -c "import aruco; print(aruco)" && python3 ./example/fractal.py' returned a non-zero code: 1 `

AndreV84 commented 5 years ago

I installed fresh Ubuntu OS 18.04 locally and trying again. How do you install opencv to fresh os? `cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="7.2" -D CUDA_ARCH_PTX="" -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D PYTHON3_EXECUTABLE=/home/nvidia/venv/bin/python PYTHON3_NUMPY_INCLUDE_DIRS=/home/nvidia/venv/lib/python3.6/site-packages/numpy/core/include/ BUILD_opencv_python3=yes -D PYTHON_PACKAGES_PATH=~/home/nvidia/venv/lib/python3.6/site-packages/ -D PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so ..

`

fehlfarbe commented 5 years ago

Hm seems there was an encoding error in setup.py. I updated the branch. This Dockerfile should work:

FROM ubuntu:18.04
SHELL ["/bin/bash", "-c"]

# Replace 1000 with your user / group id
RUN apt-get update && apt-get install -y sudo apt-utils

# install tools and libs
RUN apt-get update \
&& apt-get install -y git-core bash-completion \
wget build-essential cmake pkg-config libjpeg8-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran \
python2.7-dev python3-dev python-pip python3-pip swig unzip python3-numpy libeigen3-dev
RUN pip3 install --upgrade pip setuptools wheel cython numpy

# install opencv and aruco
RUN mkdir -p /home/user/src \
&& cd /home/user/src/ && wget -q -O opencv.zip https://github.com/opencv/opencv/archive/3.4.6.zip && ls -l && unzip opencv.zip \
&& cd opencv-3.4.6 && mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_STANDARD=11 -DENABLE_PRECOMPILED_HEADERS=OFF .. \
&& make -j6 \
&& make install \
&& cd /home/user/src/

#RUN mkdir -p /home/user/src/python-aruco
#COPY . /home/user/src/python-aruco
RUN cd /home/user/src \
&& git clone --single-branch --branch aruco-3.1.2 https://github.com/fehlfarbe/python-aruco.git \
&& cd python-aruco \
&& ls -lr \
&& ./swigbuild.sh python3 \
&& ldconfig \
&& ls -l *.so \
&& python3 setup.py sdist bdist_wheel \
&& pip3 install dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl \
&& python3 -c "import aruco; print(aruco)" \
&& python3 ./example/fractal.py
AndreV84 commented 5 years ago

It worked with the docker file. I assume it would work with virtual-environment with opencv4.1 as well since a patch to the setup.py has been applied. Thanks!

AndreV84 commented 5 years ago

However, I am trying to reproduce the success in virtual environment with the sequence below git clone --single-branch --branch aruco-3.1.2 https://github.com/fehlfarbe/python-aruco.git \ &cd python-aruco \ ls -lr \ ./swigbuild.sh python3 \ ldconfig \ ls -l *.so \ python3 setup.py sdist bdist_wheel \ pip3 install dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl \ python3 -c "import aruco; print(aruco)" \ python3 ./example/fractal.py

Outputs seems non success: `python3 setup.py sdist bdist_wheel running sdist running egg_info creating aruco.egg-info writing aruco.egg-info/PKG-INFO writing dependency_links to aruco.egg-info/dependency_links.txt writing requirements to aruco.egg-info/requires.txt writing top-level names to aruco.egg-info/top_level.txt writing manifest file 'aruco.egg-info/SOURCES.txt' reading manifest file 'aruco.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: manifest_maker: MANIFEST.in, line 5: unknown action 'LICENSE'

writing manifest file 'aruco.egg-info/SOURCES.txt' running check creating aruco-3.1.2.0 creating aruco-3.1.2.0/aruco.egg-info creating aruco-3.1.2.0/py2 creating aruco-3.1.2.0/py3 creating aruco-3.1.2.0/src creating aruco-3.1.2.0/src/aruco creating aruco-3.1.2.0/src/aruco/fractallabelers copying files to aruco-3.1.2.0... copying LICENSE -> aruco-3.1.2.0 copying MANIFEST.in -> aruco-3.1.2.0 copying README.md -> aruco-3.1.2.0 copying aruco.py -> aruco-3.1.2.0 copying aruco_wrap.cxx -> aruco-3.1.2.0 copying aruco_wrap.h -> aruco-3.1.2.0 copying setup.cfg -> aruco-3.1.2.0 copying setup.py -> aruco-3.1.2.0 copying aruco.egg-info/PKG-INFO -> aruco-3.1.2.0/aruco.egg-info copying aruco.egg-info/SOURCES.txt -> aruco-3.1.2.0/aruco.egg-info copying aruco.egg-info/dependency_links.txt -> aruco-3.1.2.0/aruco.egg-info copying aruco.egg-info/requires.txt -> aruco-3.1.2.0/aruco.egg-info copying aruco.egg-info/top_level.txt -> aruco-3.1.2.0/aruco.egg-info copying py2/aruco.py -> aruco-3.1.2.0/py2 copying py3/aruco.py -> aruco-3.1.2.0/py3 copying src/aruco/CMakeLists.txt -> aruco-3.1.2.0/src/aruco copying src/aruco/aruco.h -> aruco-3.1.2.0/src/aruco copying src/aruco/aruco_cvversioning.h -> aruco-3.1.2.0/src/aruco copying src/aruco/aruco_export.h -> aruco-3.1.2.0/src/aruco copying src/aruco/cameraparameters.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/cameraparameters.h -> aruco-3.1.2.0/src/aruco copying src/aruco/cvdrawingutils.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/cvdrawingutils.h -> aruco-3.1.2.0/src/aruco copying src/aruco/debug.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/debug.h -> aruco-3.1.2.0/src/aruco copying src/aruco/dictionary.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/dictionary.h -> aruco-3.1.2.0/src/aruco copying src/aruco/dictionary_based.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/dictionary_based.h -> aruco-3.1.2.0/src/aruco copying src/aruco/fractaldetector.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/fractaldetector.h -> aruco-3.1.2.0/src/aruco copying src/aruco/ippe.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/ippe.h -> aruco-3.1.2.0/src/aruco copying src/aruco/levmarq.h -> aruco-3.1.2.0/src/aruco copying src/aruco/marker.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/marker.h -> aruco-3.1.2.0/src/aruco copying src/aruco/markerdetector.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/markerdetector.h -> aruco-3.1.2.0/src/aruco copying src/aruco/markerdetector_impl.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/markerdetector_impl.h -> aruco-3.1.2.0/src/aruco copying src/aruco/markerlabeler.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/markerlabeler.h -> aruco-3.1.2.0/src/aruco copying src/aruco/markermap.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/markermap.h -> aruco-3.1.2.0/src/aruco copying src/aruco/picoflann.h -> aruco-3.1.2.0/src/aruco copying src/aruco/posetracker.cpp -> aruco-3.1.2.0/src/aruco copying src/aruco/posetracker.h -> aruco-3.1.2.0/src/aruco copying src/aruco/timers.h -> aruco-3.1.2.0/src/aruco copying src/aruco/fractallabelers/fractallabeler.cpp -> aruco-3.1.2.0/src/aruco/fractallabelers copying src/aruco/fractallabelers/fractallabeler.h -> aruco-3.1.2.0/src/aruco/fractallabelers copying src/aruco/fractallabelers/fractalmarker.cpp -> aruco-3.1.2.0/src/aruco/fractallabelers copying src/aruco/fractallabelers/fractalmarker.h -> aruco-3.1.2.0/src/aruco/fractallabelers copying src/aruco/fractallabelers/fractalmarkerset.cpp -> aruco-3.1.2.0/src/aruco/fractallabelers copying src/aruco/fractallabelers/fractalmarkerset.h -> aruco-3.1.2.0/src/aruco/fractallabelers copying src/aruco/fractallabelers/fractalposetracker.cpp -> aruco-3.1.2.0/src/aruco/fractallabelers copying src/aruco/fractallabelers/fractalposetracker.h -> aruco-3.1.2.0/src/aruco/fractallabelers Writing aruco-3.1.2.0/setup.cfg creating dist Creating tar archive removing 'aruco-3.1.2.0' (and everything under it) running bdist_wheel running build running build_py copying aruco.py -> build/lib.linux-x86_64-3.6 running build_ext installing to build/bdist.linux-x86_64/wheel running install running install_lib creating build/bdist.linux-x86_64 creating build/bdist.linux-x86_64/wheel copying build/lib.linux-x86_64-3.6/aruco.py -> build/bdist.linux-x86_64/wheel copying build/lib.linux-x86_64-3.6/_aruco.cpython-36m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/wheel running install_egg_info Copying aruco.egg-info to build/bdist.linux-x86_64/wheel/aruco-3.1.2.0-py3.6.egg-info running install_scripts creating build/bdist.linux-x86_64/wheel/aruco-3.1.2.0.dist-info/WHEEL creating 'dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl' and adding 'build/bdist.linux-x86_64/wheel' to it adding '_aruco.cpython-36m-x86_64-linux-gnu.so' adding 'aruco.py' adding 'aruco-3.1.2.0.dist-info/LICENSE' adding 'aruco-3.1.2.0.dist-info/METADATA' adding 'aruco-3.1.2.0.dist-info/WHEEL' adding 'aruco-3.1.2.0.dist-info/top_level.txt' adding 'aruco-3.1.2.0.dist-info/RECORD' removing build/bdist.linux-x86_64/wheel pip3 install dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl Requirement already satisfied: aruco==3.1.2.0 from file:///home/nvidia/Templates/python-aruco/dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl in /home/nvidia/venv/lib/python3.6/site-packages (3.1.2.0) Requirement already satisfied: numpy in /home/nvidia/venv/lib/python3.6/site-packages (from aruco==3.1.2.0) (1.16.3) Requirement already satisfied: opencv-contrib-python in /home/nvidia/venv/lib/python3.6/site-packages (from aruco==3.1.2.0) (4.1.0.25) python3 -c "import aruco; print(aruco)" Traceback (most recent call last): File "/home/nvidia/Templates/python-aruco/aruco.py", line 14, in swig_import_helper return importlib.import_module(mname) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 658, in _load_unlocked File "", line 571, in module_from_spec File "", line 922, in create_module File "", line 219, in _call_with_frames_removed ImportError: /home/nvidia/Templates/python-aruco/_aruco.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/home/nvidia/Templates/python-aruco/aruco.py", line 17, in _aruco = swig_import_helper() File "/home/nvidia/Templates/python-aruco/aruco.py", line 16, in swig_import_helper return importlib.import_module('_aruco') File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: /home/nvidia/Templates/python-aruco/_aruco.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6 `

AndreV84 commented 5 years ago

any chance to patch venv installation process somehow? Thanks ` python3 setup.py install running install running bdist_egg running egg_info creating aruco.egg-info writing aruco.egg-info/PKG-INFO writing dependency_links to aruco.egg-info/dependency_links.txt writing requirements to aruco.egg-info/requires.txt writing top-level names to aruco.egg-info/top_level.txt writing manifest file 'aruco.egg-info/SOURCES.txt' reading manifest file 'aruco.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: manifest_maker: MANIFEST.in, line 5: unknown action 'LICENSE'

writing manifest file 'aruco.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py copying aruco.py -> build/lib.linux-x86_64-3.6 running build_ext creating build/bdist.linux-x86_64 creating build/bdist.linux-x86_64/egg copying build/lib.linux-x86_64-3.6/aruco.py -> build/bdist.linux-x86_64/egg copying build/lib.linux-x86_64-3.6/_aruco.cpython-36m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg byte-compiling build/bdist.linux-x86_64/egg/aruco.py to aruco.cpython-36.pyc creating stub loader for _aruco.cpython-36m-x86_64-linux-gnu.so byte-compiling build/bdist.linux-x86_64/egg/_aruco.py to _aruco.cpython-36.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO copying aruco.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying aruco.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying aruco.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying aruco.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying aruco.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt zip_safe flag not set; analyzing archive contents... pycache._aruco.cpython-36: module references file pycache.aruco.cpython-36: module references file creating dist creating 'dist/aruco-3.1.2.0-py3.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing aruco-3.1.2.0-py3.6-linux-x86_64.egg creating /home/nvidia/venv/lib/python3.6/site-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg Extracting aruco-3.1.2.0-py3.6-linux-x86_64.egg to /home/nvidia/venv/lib/python3.6/site-packages Adding aruco 3.1.2.0 to easy-install.pth file

Installed /home/nvidia/venv/lib/python3.6/site-packages/aruco-3.1.2.0-py3.6-linux-x86_64.egg Processing dependencies for aruco==3.1.2.0 Searching for opencv-contrib-python==4.1.0.25 Best match: opencv-contrib-python 4.1.0.25 Adding opencv-contrib-python 4.1.0.25 to easy-install.pth file

Using /home/nvidia/venv/lib/python3.6/site-packages Searching for numpy==1.16.3 Best match: numpy 1.16.3 Adding numpy 1.16.3 to easy-install.pth file Installing f2py script to /home/nvidia/venv/bin Installing f2py3 script to /home/nvidia/venv/bin Installing f2py3.6 script to /home/nvidia/venv/bin

Using /home/nvidia/venv/lib/python3.6/site-packages Finished processing dependencies for aruco==3.1.2.0 python3 -c "import aruco; print(aruco)" Traceback (most recent call last): File "/home/nvidia/Templates/python-aruco/aruco.py", line 14, in swig_import_helper return importlib.import_module(mname) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 658, in _load_unlocked File "", line 571, in module_from_spec File "", line 922, in create_module File "", line 219, in _call_with_frames_removed ImportError: /home/nvidia/Templates/python-aruco/_aruco.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/home/nvidia/Templates/python-aruco/aruco.py", line 17, in _aruco = swig_import_helper() File "/home/nvidia/Templates/python-aruco/aruco.py", line 16, in swig_import_helper return importlib.import_module('_aruco') File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: /home/nvidia/Templates/python-aruco/_aruco.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv8internal18WriteStructContextC1ERNS_11FileStorageERKNS6StringEiS6 `

fehlfarbe commented 5 years ago

The missing symbol is part of OpenCV. Do you have multiple OpenCV versions on your system? WriteStructContext exists in OpenCV 2.4 but seems to be removed in >= OpenCV 3.0. So maybe the library was compiled with OpenCV 2.4 but loads version 3/4?

AndreV84 commented 5 years ago

no, I have just reinstalled OS Ubuntu, then installed opencv 4.1.0 [ with aruco module from contrib], then installed aruco, then installed python aruco. And yes, second opencv 3.1 lives within contenerized environment when I execute the docker file, but that shouldn't affect execution of virtualenv based installation process

AndreV84 commented 5 years ago

with opencv 3.4 I can successfully reproduce steps at Fresh OS Ubuntu environment at cloud instance. Without use of docker. I shall do some more testings to collect more statistics. Thank you for your support.

AndreV84 commented 5 years ago

at a new cloud instance, I am repeating the steps, but with substitution of 3.4.6 to 4.1.0 That apparently results in: n file included from aruco_wrap.cxx:5504:0: src/aruco/cameraparameters.h:32:10: fatal error: opencv2/core/core.hpp: No such file or directory

include <opencv2/core/core.hpp>

Could you check if Docker file with 4.1.0 will work at your side?

AndreV84 commented 5 years ago

can get through with: apt-get install libopencv-core-dev but that possibly adds a different opencv version and stucks at another error src/aruco/markerdetector.h:44:39: fatal error: opencv2/imgproc/imgproc.hpp: No such file or directory

include <opencv2/imgproc/imgproc.hpp>

fehlfarbe commented 5 years ago

You don't need to compile aruco for python-aruco. A modified version of aruco (there are some function declarations in the header files without a definition in the cpp files) is already included in python-aruco :) I updated setup.py because OpenCV4 copies its header files to /usr/local/include/opencv4/ instead of /usr/local/include/opencv2/. So it should work now with OpenCV4.

AndreV84 commented 5 years ago

thank you for the update testing

AndreV84 commented 5 years ago

Done! `FROM ubuntu:18.04 SHELL ["/bin/bash", "-c"]

Replace 1000 with your user / group id

RUN apt-get update && apt-get install -y sudo apt-utils

install tools and libs

RUN apt-get update \ && apt-get install -y git-core bash-completion \ wget build-essential cmake pkg-config libjpeg8-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran \ python2.7-dev python3-dev python-pip python3-pip swig unzip python3-numpy libeigen3-dev RUN pip3 install --upgrade pip setuptools wheel cython numpy

install opencv and aruco

RUN mkdir -p /home/nvidia/Templates/src \ && cd /home/nvidia/Templates/src/ && wget https://github.com/opencv/opencv/archive/4.1.0.tar.gz && ls -l && tar -xvf 4.1.0.tar.gz \ && cd opencv-4.1.0 && mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_STANDARD=11 -DENABLE_PRECOMPILED_HEADERS=OFF -DPYTHON_DEFAULT_EXECUTABLE=$(which python3) .. \ && make -j16 \ && make install \ && cd /home/nvidia/Templates/src/

RUN mkdir -p /home/user/src/python-aruco

COPY . /home/user/src/python-aruco

RUN cd /home/nvidia/Templates/src \ && git clone --single-branch --branch aruco-3.1.2 https://github.com/fehlfarbe/python-aruco.git \ && cd python-aruco \ && ls -lr \ && ./swigbuild.sh python3 \ && ldconfig \ && ls -l *.so \ && python3 setup.py sdist bdist_wheel \ && ln -sf /usr/local/bin/pip3 /usr/bin/pip3 \ && pip3 install dist/aruco-3.1.2.0-cp36-cp36m-linux_x86_64.whl \ && python3 -c "import aruco; print(aruco)" \ && python3 ./example/fractal.py `

AndreV84 commented 5 years ago

May be you have insights how to split the work to multiple processors? Like to get 25fps@ 4K aruco stream to be processed on 5 CPUs?

Reference: https://devtalk.nvidia.com/default/topic/1047944/jetson-agx-xavier/implementation-of-precise-time-synchronization-between-two-xaviers-over-wlan/post/5344398/#5344398

fehlfarbe commented 5 years ago

Is only one CPU busy? OpenCV already uses multiple threads for some functions maybe you can speed up the detection if you use (multiprocessing)[https://docs.python.org/3/library/multiprocessing.html] Pool. Don't uses threads for better performance in Python because they all run on the same core (due Python's GIL).

AndreV84 commented 5 years ago

it just runs terribly slow in our case like 1-5 fps and therefore a need to accelerate arises. Could you check if installation of your design works with aarch ?

pip3 install dist/aruco-3.1.2.0-cp36-cp36m-linux_aarch64.whl 
Processing ./dist/aruco-3.1.2.0-cp36-cp36m-linux_aarch64.whl
Requirement already satisfied: numpy in /home/nvidia/venv/lib/python3.6/site-packages (from aruco==3.1.2.0) (1.16.4)
Collecting opencv-contrib-python (from aruco==3.1.2.0)
  ERROR: Could not find a version that satisfies the requirement opencv-contrib-python (from aruco==3.1.2.0) (from versions: none)
ERROR: No matching distribution found for opencv-contrib-python (from aruco==3.1.2.0)
AndreV84 commented 5 years ago

for aarch there are sudo apt-get install -y python-opencv python3-opencv

AndreV84 commented 5 years ago

we were previously using the code to process a stream with cv2.aruco Could you advise how to modify the code to test it with your wrapper please? `import sys import cv2 from cv2 import aruco aruco_dict = aruco.getPredefinedDictionary(aruco.DICT_6X6_250) parameters = aruco.DetectorParameters_create() gst = "rtspsrc location=rtsp://192.168.1.3:8554/test ! queue ! decodebin ! videoconvert ! appsink"

cap = cv2.VideoCapture(gst, cv2.CAP_GSTREAMER)

while True: ret, frame = cap.read() corners, ids, _ = aruco.detectMarkers(image=frame, dictionary=aruco_dict, parameters=parameters) if ids is not None: cv2.putText(frame, str(ids.T), (20, 70), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2) cv2.imshow('image', frame) if(cv2.waitKey(1) & 0xFF == ord('q')): break

cap.release() cv2.destroyAllWindows() `