<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Talha Farooq on Medium]]></title>
        <description><![CDATA[Stories by Talha Farooq on Medium]]></description>
        <link>https://medium.com/@talhafarooq4?source=rss-5ec27633ddcd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*uOXZi1V3GxK-DNpW</url>
            <title>Stories by Talha Farooq on Medium</title>
            <link>https://medium.com/@talhafarooq4?source=rss-5ec27633ddcd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 08:34:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@talhafarooq4/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setting up Jetson TX1/TX2 for onboard processing with Opencv 3 + and opencv-contrib module and…]]></title>
            <link>https://medium.com/@talhafarooq4/setting-up-jetson-tx1-tx2-for-onboard-processing-with-opencv-3-and-opencv-contrib-module-and-e078a5fa275b?source=rss-5ec27633ddcd------2</link>
            <guid isPermaLink="false">https://medium.com/p/e078a5fa275b</guid>
            <category><![CDATA[jetson-tx2]]></category>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[onboarding-process]]></category>
            <category><![CDATA[jetson-tx1]]></category>
            <category><![CDATA[opencv]]></category>
            <dc:creator><![CDATA[Talha Farooq]]></dc:creator>
            <pubDate>Sat, 05 Oct 2019 14:26:44 GMT</pubDate>
            <atom:updated>2019-10-05T14:29:11.183Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h3>Setting up Jetson TX1/TX2 for onboard processing with Opencv 3 + and opencv-contrib module with CUDA enabled</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5F39GKu4uIYwtZ68b3zoLA.png" /></figure><p>Setting up a microprocessor, especially ARM based, is a complex task especially if you are not a regular Linux user. There are two main steps required for setup:<br>• Install Jetpack 3.0 to Ubuntu 16.04 machine to flash software onto Jetson TX1<br>• Flash <a href="http://ardupilot.org/dev/docs/apsync-intro.html">APSync image</a> to Jetson TX1 board (Important step for onboard processing as this enables Wifi access point/UART/Mavlink data logging )</p><p>There is a complete guide on “<a href="http://ardupilot.org/dev/docs/companion-computer-nvidia-tx1.html">How to install Jetpack and flash APSYNC image to your TX1</a>” available on ArduPilot forum. The following modules were selected for installation on Jetson TX1.<br>1. Linux for target host (i.e. Jetson TX1)<br>2. Multimedia API package<br>3. Opencv for tegra (later on we installed opencv 3.4.2)<br>4. Visionworks Pack (Not essential if require then install it)<br>5. Cuda Toolkit</p><p>Similarly, we also want the screen sharing tool for on board processing and live feed as in our main image processing algorithm we are supposed to mark an object which we want to track (an initial requirement) so we installed TeamViewer. Here a thing to be noted is though <strong>TeamViewer gets install </strong>and provides live screen sharing but it is not recommended as <strong>TeamViewer officially do not support</strong> their software for ARM architecture so when you reboot your Jetson TX1 it will cause trouble like in our case we faced blinking of display, missing of terminal, missing of taskbar etc. So, these were the issues in screen sharing so we came across a solution of Linux built-in screen sharing tool “Remote Control” through VNC (virtual network connection). We were using a 3G usb wingle on Jetson Tx1 to connect it to the ground computer (you can use local host if range is not a issue or internet connection protocol if range is concern).</p><p>In order to run our algorithm, we require opencv 3.4.2 with opencv-contrib module.<br>Opencv is library for real time computer vision used mainly for real-time applications and supported by various programing languages python, C++, Java. The library has more than 2500 advanced calculations, which incorporates a far-reaching set of both great and cutting-edge computer vision and AI calculations. The opencv for tegra supported by official Nvidia was of version 2.4 so we need to install opencv 3.4.2 with openv-contrib.<br>Here it should be noted that some pip modules aren’t supposed to be directly installed on ARM architecture as they aren’t supported for this so in order to install this, we have to build it manually using cmake and make. A guide to installation is available online but in chunks on different websites.</p><p>The below guide is made from with the help of various links but mainly <a href="https://medium.com/@manivannan_data/install-opencv-and-tensorflow-on-jetson-tx1-and-jetson-tx2-bb4586aa396b">this</a> and <a href="https://elinux.org/Jetson_TX1">elinux.org</a></p><p><em>My Jetson:<br>Jetson version : TX1 <br>OS Version : Ubuntu 16.04<br>Cuda : 8.0<br>Install OpenCV Version : 3.4.2</em><br> We are using Jetson TX1 and it has only 16 gb internal storage. Once you install Cuda on Jetson TX1, it has only 5–6 gb of space. But the required space to install opencv on jetson tx1 is min 3 gb. So i have to move the installing process for opencv to an external SD card. If your SD card has ext files system, then you can follow the installing opencv steps. Otherwise you can make your SD card to ext file format. The Jetson TX2 has 32 gb space, so an external sd card may not be needed. But if you use an external SD card, please change your SD card file type as ext not fat. — <a href="https://medium.com/@manivannan_data/install-opencv-and-tensorflow-on-jetson-tx1-and-jetson-tx2-bb4586aa396b">medium.com</a></p><p>Create test.txt<br>$ echo “hello” &gt;&gt; test.txt<br>$ cd &lt; go to your sd card &gt;<br>$ ln -s ~/test.txt test.txt<br><em>(If error comes, you can change your SD card file type)</em></p><h4>Installing necessary dependencies for building opencv</h4><p>Note: Compiling OpenCV from source will give you NVIDIA’s CUDA GPU optimizations but not NVIDIA’s ARM NEON CPU optimizations that are only available in the closed-source prebuilt OpenCV4Tegra packages.</p><pre>sudo apt-add-repository universe<br>sudo apt-get update</pre><p>Installing other depending libraries</p><pre># Some general development libraries<br>sudo apt-get -y install build-essential make cmake cmake-curses-gui g++<br># libav video input/output development libraries<br>sudo apt-get -y install libavformat-dev libavutil-dev libswscale-dev<br># Video4Linux camera development libraries<br>sudo apt-get -y install libv4l-dev<br># Eigen3 math development libraries<br>sudo apt-get -y install libeigen3-dev<br># OpenGL development libraries (to allow creating graphical windows)<br>sudo apt-get -y install libglew1.6-dev<br># GTK development libraries (to allow creating graphical windows)<br>sudo apt-get -y install libgtk2.0-dev</pre><p>If Python support is not installed</p><pre>$ sudo apt-get install python3-dev python3-pip python3-tk<br>$ sudo pip3 install numpy$ sudo apt-get install python-dev python-pip python-tk<br>$ sudo pip2 install numpy</pre><p>Before downloading and building opencv-3.4.2 there is need of some modifications according to <a href="https://devtalk.nvidia.com/default/topic/1007290/jetson-tx2/building-opencv-with-opengl-support-/post/5141945/#5141945">this post</a> but now it is resolved you can check this for your satisfaction, in order to fix OpenGL related compilation problems . More specifically, I’d modify /usr/local/cuda/include/cuda_gl_interop.h and fix the symbolic link of libGL.so.</p><pre>cd /usr/lib/aarch64-linux-gnu/<br>$ sudo ln -sf tegra/libGL.so libGL.so<br>$ sudo vim /usr/local/cuda/include/cuda_gl_interop.h</pre><p>On line 62–68 should look like this</p><pre>//#if defined(__arm__) || defined(__aarch64__)<br>//#ifndef GL_VERSION<br>//#error Please include the appropriate gl headers before including cuda_gl_interop.h<br>//#endif<br>//#else<br> #include &lt;GL/gl.h&gt;<br>//#endif</pre><p>(OPTIONAL) Install Gstreamer for IP cameras specially if you think you will use this otherwise this is not essential</p><pre># (Optional) Gstreamer development libraries (for Network IP camera input)<br>sudo apt-get install libgstreamer1.0 libgstreamer1.0-dev libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev</pre><p>Change version which you want to install or download the zip file from opencv for Python <a href="https://github.com/skvark/opencv-python">website</a> .</p><pre>VERSION=3.4.4 <br>cd ~/Downloads #Or your SD Card Path<br>rm ${VERSION}.zip<br>wget <a href="https://github.com/opencv/opencv/archive/$%7BVERSION%7D.zip">https://github.com/opencv/opencv/archive/${VERSION}.zip</a></pre><p>Unzip the source files</p><pre>unzip ${VERSION}.zip<br>mv opencv-${VERSION} ~/<br>cd ~/opencv-${VERSION}<br>mkdir build<br>cd build</pre><p>Before building opencv we will install “opencv-contrib-module” though you can run cmake multiple times to add more settings, such as adding the contrib modules or using TBB and fast math for better performance at potential loss of some accuracy.</p><p>Before isntalling opencv-contrib module make sure that the algorithm you want from opencv-contrib module available in which version like CSRT algorithm available in opencv 3.4.2.</p><p>Here it should be noted that <strong>opencv and opencv-contrib version should be same </strong>like in our case both versions were <strong>3.4.2</strong> otherwise it will make trouble while installing or in development process.</p><p>Choose version of your requirements and both opencv and opencv-contrib should be same</p><pre>cd ~/Downloads<br>rm ${VERSION}.zip<br>wget <a href="https://github.com/opencv/opencv_contrib/archive/$%7BVERSION%7D.zip">https://github.com/opencv/opencv_contrib/archive/${VERSION}.zip</a></pre><p>Unzip opencv-contrib module</p><pre>unzip ${VERSION}.zip<br>mv opencv_contrib-${VERSION} ~/<br>cd ~/opencv-${VERSION}/build</pre><p><strong>Note: </strong>Build opencv (CUDA_ARCH_BIN=”6.2&quot; for TX2, or “5.3” for TX1)</p><pre>$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \<br>        -D WITH_CUDA=ON -D CUDA_ARCH_BIN=&quot;5.3&quot; -D CUDA_ARCH_PTX=&quot;&quot; \<br>        -D WITH_CUBLAS=ON -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON \<br>        -D ENABLE_NEON=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF \<br>        -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF \<br>        -D WITH_QT=ON -D WITH_OPENGL=ON \<br>-DOPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-${VERSION}/modules ..</pre><p>After finishing build all your specification will appear on screen with opencv and opencv-cntrib version and all other extra modules like fmpeg and gstreamer etc.</p><p>If you want to customize any more of the build settings such as whether to support Firewire cameras or Qt GUI, it is easiest to use the curses interactive version of CMake from here on:</p><pre>ccmake ..</pre><p>Now you should be ready to build OpenCV and then install it. Unfortunately, OpenCV is currently experiencing a problem with CMake where installing the built libraries (that normally takes a few seconds) re-compiles the whole OpenCV (that normally takes close to an hour). So to save time, instead of running “make -j4 ; make install”, we will build &amp; install OpenCV using a single command.</p><p>To build the OpenCV library using 4 Tegra CPU cores (takes around 40 minutes on Tegra K1):</p><p>make -j4 for 4 cores and make-j8 for 8 cores processor.</p><pre>make -j4 </pre><pre>sudo make install</pre><p>To verify the installation:</p><pre>$ ls /usr/local/lib/python3.5/dist-packages/cv2.*<br>/usr/local/lib/python3.5/dist-packages/cv2.cpython-35m-aarch64-linux-gnu.so<br>$ ls /usr/local/lib/python2.7/dist-packages/cv2.*<br>/use/local/lib/python2.7/dist-packages/cv2.so<br>$ python3 -c &#39;import cv2; print(cv2.__version__)&#39;<br>3.4.2<br>$ python2 -c &#39;import cv2; print(cv2.__version__)&#39;<br>3.4.2</pre><p>Now you have successfully installed opencv with opencv contrib module on Jetson TX1. If you want to use Jetson TX1 on drone you may require additional libraries like dronekit and Mavlink for communication purposes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e078a5fa275b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>