OpenCV 2.4.13 on Jetson Nano 4GB


I need to install OpenCV 2.4.13 on my Jetson Nano - specific version is implicated by Library that I’ll be using (OSIRIS IRIS 4.1), I would like to install this obsolete version in custom folder, so It will be possible to use newer version for anything else. I’ve installed already OpenCV in version 3.4.3 using mdegans nano script . However it is not working on 2.4.13 version - I am getting similar output to attached below .log files. I’ve tried installing this manually, here’s how i did it:

it clone --depth 1 --branch
cd opencv
mkdir OpenCV-
cd OpenCV-
mkdir build
cmake -S . -B build -D CMAKE_INSTALL_PREFIX=${HOME}/opencv/OpenCV- ..

TL:DR - How to install opencv on jetson nano in custom folder

Thanks in advance!
CMakeOutput.log (58.9 KB)

1 Like

CMakeError.log (19.2 KB)

The version is old and not sure if it can be built successfully. You may modify this script for a try:
GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

  1. opencv_contrib.git does not exist for 24.13. So please remove this line:
    git clone --depth 1 --branch "$1"
  1. Not to execute sudo make install. Pleas remove:
    # avoid a sudo make install (and root owned files in ~) if $PREFIX is writable
    if [[ -w ${PREFIX} ]] ; then
        make install 2>&1 | tee -a install.log
        sudo make install 2>&1 | tee -a install.log

Please give it a try.

Hi, tried with above changes, but unfortunately, got no luck
build_log.txt (30.4 KB)

This would need other users to share experience. Generally we use OpenCV 4 release(s). Have not worked on OpenCV 2 for a while.

Seems the issue is with NPP library. Since CUDA 8.0, NPP was splitted onto 12 separate libraries.
Not sure (and unable to check), but you may try to edit cmake/FindCUDA.cmake and change for libnpp to:

set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")

Or you may rebuild a single npp library as expected by opencv-2.4.13 by relinking all of these libraries into one.

Not sure where how to do this, where can I find this file?

Could you also provide some instructions on how to rebuild npp library, relink libraries into one? This would be massively appreciated.

It seems to be more difficult than I thought…OpenCv-2.4 may rely on features from old Linux kernel versions no longer available.
You would better find a ported version of OSIRIS that could be built with opencv4.

Thanks anyway, guess I’ll be using this git repository

The dockerfile from that repository would try to build opencv-2.4.13 that would fail, and use original Osiris code targetting opencv1.

You may try the attached code adapted from GitHub - Ekberjan/Iris_Image_Matching: C++ based iris image verification code using OpenCV. (just tested it builds, not tried more) that would be ok with opencv4.
myIris.tgz (22.1 KB)

[OpenCV 4.4.0, Nvdia Jetson Nano 4GB]

I’ve tried to implement this repository, with included test images, but I have encountered significant error that I cannot pass, it is in pirProcessing.cpp → segment() function where it does not seem to be working, part of the code with debug info:

	//Start Processing
	// Locate the pupil
	detectPupil(pSrc, rPupil, minPupilDiameter, maxPupilDiameter);

	// Fill the holes in an area surrounding pupil
	cv::Mat clone_src = pSrc.clone();
	// select a ROI	
	cv::Rect mRoi = cv::Rect(rPupil.getCenter().x - 3.0 / 4.0 * maxIrisDiameter / 2.0,
		rPupil.getCenter().y - 3.0 / 4.0*maxIrisDiameter / 2.0,
		3.0 / 4.0*maxIrisDiameter,
		3.0 / 4.0*maxIrisDiameter);
	std::cout << "mRoi: " << mRoi.size() << std::endl;
	std::cout << "clone_src: " << clone_src.size() << std::endl;

	cv::Mat clone_src2 = clone_src(mRoi).clone(); // this is source of error
	fillWhiteHoles(clone_src2, clone_src2);
	catch (const std::exception& e)
		std::cout << e.what();

My output is as follows:

Start processing ... 

mRoi: 210, [210 x 210]
clone_src: [640 x 480]
OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/core/src/matrix.cpp:466: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'
1           0
Cannot normalize image because contours are not correctly computed/loaded

End processing. 

To clarify - I’ve been using included images - “1.jpg” and “2.jpg”, with default Gabor filter and image points, is there any chance you might know the answer?

Thanks in advance.

Maybe you’re not using the opencv build that you think. You may further investigate this. Use opencv function cv::getBuildInformation() for details about the running version.
Be sure you’re building iris against correct opencv build and run with the same.

Unfortunately, for this repository to work properly OpenCV 3.1.0 is required, which I cannot seem to install -

Seems you’re not following the adviced way.
Wish you good luck but wouldn’t advise further…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.