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

Opencv support for c++ nnot found in l4t pytroch for jetpack 6.1(36.4.0) #753

Open
kabirkedia opened this issue Dec 19, 2024 · 0 comments
Open

Comments

@kabirkedia
Copy link

kabirkedia commented Dec 19, 2024

Hi @dusty-nv ,
I am building l4t-pytorch container using this link(https://hub.docker.com/r/dustynv/l4t-pytorch/tags specifically the r36.4.0 tag.
I tested with opencv, pytorcvh, torchvisiona dn torchaudio. They all work fine but the opencv support for c++ is absent.
I tried to look at your script that is there in

/tmp/opencv/build.sh

And I found out that there might be a couple of mistakes:

  1. First there might an issue with the branch of opencv-python repository
#!/usr/bin/env bash
set -ex
echo "Building opencv-python ${OPENCV_VERSION}"

bash /tmp/opencv/install_deps.sh

git clone --branch {OPENCV_VERSION} --recursive https://github.com/opencv/opencv-python /opt/opencv-python

Here, the opencv_VERISON is wrong. the opencv-python repository does not have numbering according to versions. It just has 3.x,4.x etc. https://github.com/opencv/opencv-python/branches/all
2. the cmake and make command might have been omitted out by mistake

export ENABLE_CONTRIB=1
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
export CMAKE_ARGS="\
   -DCPACK_BINARY_DEB=ON \
   -DBUILD_EXAMPLES=OFF \
   -DBUILD_opencv_python2=OFF \
   -DBUILD_opencv_python3=ON \
   -DBUILD_opencv_java=OFF \
   -DCMAKE_BUILD_TYPE=RELEASE \
   -DCMAKE_INSTALL_PREFIX=/usr/local \
   -DCUDA_ARCH_BIN=${CUDA_ARCH_BIN} \
   -DCUDA_ARCH_PTX= \
   -DCUDA_FAST_MATH=ON \
   -DCUDNN_INCLUDE_DIR=/usr/include/$(uname -i)-linux-gnu \
   -DEIGEN_INCLUDE_PATH=/usr/include/eigen3 \
   -DWITH_EIGEN=ON \
   -DENABLE_NEON=ON \
   -DOPENCV_DNN_CUDA=ON \
   -DOPENCV_ENABLE_NONFREE=ON \
   -DOPENCV_EXTRA_MODULES_PATH=/opt/opencv-python/opencv_contrib/modules \
   -DOPENCV_GENERATE_PKGCONFIG=ON \
   -DOpenGL_GL_PREFERENCE=GLVND \
   -DWITH_CUBLAS=ON \
   -DWITH_CUDA=ON \
   -DWITH_CUDNN=ON \
   -DWITH_GSTREAMER=ON \
   -DWITH_LIBV4L=ON \
   -DWITH_GTK=ON \
   -DWITH_OPENGL=OFF \
   -DWITH_OPENCL=OFF \
   -DWITH_IPP=OFF \
   -DWITH_TBB=ON \
   -DBUILD_TIFF=ON \
   -DBUILD_PERF_TESTS=OFF \
   -DBUILD_TESTS=OFF"

# I added the following code to build it again:
mkdir -p build && cd build

# Run cmake with the specified arguments
cmake ../opencv ${CMAKE_ARGS}

# Compile and install
make -j$(nproc)
make install

# Return to the root directory and remove the build directory
cd ..
rm -rf build

Please look into it. Thanks!

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

No branches or pull requests

1 participant