Installing OpenCV4 on Jetson TX1

I ran a text detection program which uses EAST model on TX1 kit. I encountered the problem of readnet module.
Lab5@tegra-ubuntu:~/Desktop/SEM_VII/TermProject$ python text_detection.py --image lebron_james.jpg --east frozen_east_text_detection.pb
[INFO] loading EAST text detector…
Traceback (most recent call last):
File “text_detection.py”, line 49, in
net = cv2.dnn.readNet(args[“east”])
AttributeError: ‘module’ object has no attribute ‘readNet’
Lab5@tegra-ubuntu:~/Desktop/SEM_VII/TermProject$

I read solution to it of upgrading OpenCV to OpenCV (Version : 4).
To do the needful I followed this particular site:
https://www.pyimagesearch.com/2018/08/15/how-to-install-opencv-4-on-ubuntu/

During the step of cmake I encountered the following error:

(cv) Lab5@tegra-ubuntu:~/opencv-4.0.0/build$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/Lab5/opencv-4.0.0/cmake \ -D WITH_CUDA=ON -D CUDA_ARCH_BIN=“5.3” -D CUDA_ARCH_PTX="" -D WITH_CUBLAS=ON -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON -D ENABLE_NEON=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D WITH_QT=ON -D WITH_OPENGL=ON …
CMake Warning at cmake/OpenCVUtils.cmake:611 (message):
Unexpected option: ENABLE_FAST_MATH (=ON)

Condition: IF ((;CV_GCC;AND;(;X86;OR;X86_64;);))
Call Stack (most recent call first):
CMakeLists.txt:327 (OCV_OPTION)

– Looking for ccache - not found
– Found ZLIB: /usr/lib/aarch64-linux-gnu/libz.so (found suitable version “1.2.11”, minimum required is “1.2.3”)
– Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
– Found ZLIB: /usr/lib/aarch64-linux-gnu/libz.so (found version “1.2.11”)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
By not providing “FindQt5Core.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “Qt5Core”, but
CMake did not find one.

Could not find a package configuration file provided by “Qt5Core” with any
of the following names:

Qt5CoreConfig.cmake
qt5core-config.cmake

Add the installation prefix of “Qt5Core” to CMAKE_PREFIX_PATH or set
“Qt5Core_DIR” to a directory containing one of the above files. If
“Qt5Core” provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:635 (include)

qmake: could not exec ‘/usr/lib/aarch64-linux-gnu/qt4/bin/qmake’: No such file or directory
CMake Error at /usr/share/cmake-3.10/Modules/FindQt4.cmake:1320 (message):
Found unsuitable Qt version “” from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
CMakeLists.txt:635 (include)

[b]
– Configuring incomplete, errors occurred!
See also “/home/Lab5/opencv-4.0.0/build/CMakeFiles/CMakeOutput.log”.
See also “/home/Lab5/opencv-4.0.0/build/CMakeFiles/CMakeError.log”.
/b Lab5@tegra-ubuntu:~/opencv-4.0.0/build$

Please help me to resolve this isuues as soon as possible.

Also I tried to install opencv using following commands:

sudo apt update
python --version
python3 --version
sudo apt install python3-opencv
python3
	import cv2
	cv2.__version__

New Terminal

sudo apt upate
sudo apt install python3-pip
pip3 --version 
pip3 install opencv-python
python3
	import cv2
	cv2.__version__

As soon as I execute:

pip3 install opencv-python

I encountered the following error:

Lab5@tegra-ubuntu:~ <b> sudo apt update </b> [sudo] password for Lab5: Get:1 file:/var/cuda-repo-10-0-local-10.0.326 InRelease Ign:1 file:/var/cuda-repo-10-0-local-10.0.326 InRelease Get:2 file:/var/visionworks-repo InRelease Ign:2 file:/var/visionworks-repo InRelease Get:3 file:/var/visionworks-sfm-repo InRelease Ign:3 file:/var/visionworks-sfm-repo InRelease Get:4 file:/var/visionworks-tracking-repo InRelease Ign:4 file:/var/visionworks-tracking-repo InRelease Get:5 file:/var/cuda-repo-10-0-local-10.0.326 Release [574 B] Get:6 file:/var/visionworks-repo Release [1,999 B] Get:5 file:/var/cuda-repo-10-0-local-10.0.326 Release [574 B] Get:7 file:/var/visionworks-sfm-repo Release [2,003 B] Get:6 file:/var/visionworks-repo Release [1,999 B] Get:7 file:/var/visionworks-sfm-repo Release [2,003 B] Get:8 file:/var/visionworks-tracking-repo Release [2,008 B] Get:8 file:/var/visionworks-tracking-repo Release [2,008 B] Hit:10 http://ports.ubuntu.com/ubuntu-ports bionic InRelease Hit:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease Hit:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease Hit:15 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease Reading package lists... Done Building dependency tree Reading state information... Done 34 packages can be upgraded. Run 'apt list --upgradable' to see them. Lab5@tegra-ubuntu:~ sudo apt install python3-pip
Reading package lists… Done
Building dependency tree
Reading state information… Done
python3-pip is already the newest version (9.0.1-2.3~ubuntu1.18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 34 not upgraded.
Lab5@tegra-ubuntu:~ pip3 --version pip 19.3 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6) Lab5@tegra-ubuntu:~ pip3 install opencv-python
ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none)
ERROR: No matching distribution found for opencv-python

Please help me resolve this issue.

Is QT5 installed?

Try

sudo apt-get install qt5-default