OpenCV, Python and GPU on TK1

I’m beginner on TK1. I have setup the Jetpack 2.0 and everything works fine. I have some little problem with FPS. I made a Line Detection system. It works fine with Image Files but when I tried to use this system on video, it is too slow.(1FPS). I have searched on internet for the gpu but i couldnt find anything for me.

JetPack 2.0
OpenCV 2.4.9
Python 2.7

Cuda and OpenCV4Tegra installed.

What should I do?


  1. Please maximize the performance.

  2. The latest OS shoulb be 21.5. Please try to install it with JetPack3.0.


I maximized the performance. After the CPU performance, my fps is 2. I have enabled GPU in the terminal but still same performance. So you are saying that i should install jetpack 3.0?

I didnt understand 1 thing. Does i need import any library in the code for the gpu?
import cv2like this or import cv2gpu?

I couldnt edited my comment so sorry for the spam. I tried with JetPack 3.0 but i cant setup opencv because of Cuda version. Im installing Jetpack 2.3 and OS version is 21.5. Will it be problem? I need to use GPU not CPU. :((


What error did you meet when installing OpenCV? Ideally, it should be fine to install opencv4tegra on tk1 via JetPack3.0.

May I know your use-case in details?
1. What is the input format? Image, web-camera or onboard camera?
2. What is the detection algorithm? CPU-based OpenCV, GPU-based OpenCV(cv::gup::~) or DL inference?

By the way, could you run tegrastate to profile system utilization?

sudo ./tegrastate

It is a video input. There is a video on jetson and im processing the video. It is CPU Based opencv. Some people say you have to install pycuda so you can use gpu. But the pycuda doesnt seem like to okey because these functions are interesting.

Yes i can run. But when i tun i cant see gpu datas. So i have to write diffrent code on terminal.

This lane detection system is a UdacityCar program. I tried to code that what I learned from udacity. I will try with usb camera.


1. Please enable hardware decoder. Use Visionworks or gstreamer rather than CPU decoder.

2. Some OpenCV module has GPU acceleration, please check here:
Actually, you don’t need to install pycuda to get GPU acceleration.

3. Could you paste your tegrastats resuls?
‘GR3D’ indicates GPU utilization
ubuntu@tegra-ubuntu:~$ sudo ./tegrastats
RAM 691/3995MB (lfb 613x4MB) cpu [0%,0%,0%,0%]@1734 EMC 0%@1600 AVP 40%@12 NVDEC 268 MSENC 268 GR3D 0%@998 EDP limit 1734
RAM 691/3995MB (lfb 613x4MB) cpu [1%,0%,0%,0%]@1734 EMC 0%@1600 AVP 54%@12 NVDEC 268 MSENC 268 GR3D 0%@998 EDP limit 1734

By the way, your class is ‘Self-Driving Car Engineer’?

Hi. How can i use gstreamer in file? example:
I have a and python ???

Yes some opencv module has but it is not for python. im looking for the python.

And I turned my jetson to jetpack 3.0 again. When I tried to build, it says "UNSUPPORTED GPU ARCHITECTURE compute_53
This error cause of Cuda version. I have looked this problem on internet but i couldnt find anythink.

No, im just a high school student. actually just graduated :)

And can i get your gmail sir?

I have a input video and i process the video after all im trying to show video. i can show the video but i got 1 fps. And how can I use Visionworks or gstreamer?


import cv2
#etc etc etc
camera = pickle.load(open( "camera_matrix.pkl", "rb" ))
mtx = camera['mtx']
dist = camera['dist']
camera_img_size = camera['imagesize']
cap = cv2.VideoCapture('project_video.mp4')
ret, frame =

#### there are 6-7 functions here i think. IT IS EXAMPLE!###
def process_image(frame):
     return result


    ret, frame =
    result = process_image(frame)

    cv2.imshow('frame', result)

    if cv2.waitKey(1) & 0xFF == ord('q'):


It is 1 or 2 FPS. This is my main problem, please help :(


For TK1, GPU architecture should be sm_32:

For gstreamer:

  1. Please build OpenCV from source with -D WITH_GSTREAMER=ON option.
  2. Modify OpenCV videocapture() to gstreamer command, find this topic for details:

Hello again. Now I build opencv with g_streamer as you say but now the new problem is “No module named cv2”.

I used these stepts after installed JetPack 3.0:

ls -l /usr/local/lib/python2.7/site-packages
total 2092

It says total 2092 but my command says 0.

What is the problem now?

Have you enabled gstreamer AND python2.7 ? You may check


Do you install OpenCV python wrapper?

sudo apt-get install python-opencv

I have fixed some errors but when i make -j4 i got error:

CMake Error at (message):
  Error generating file

make[2]: *** [modules/cudaoptflow/CMakeFiles/cuda_compile.dir/src/cuda/./] Error 1
make[1]: *** [modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all] Error 2
make: *** [all] Error 2

You may retry and get further. For TK1 you may limit to -j3 or only make, with -j4 you often run out of memory with 4 NVCC instances running.

still same error sir. I have seen fixed problems on internet and tried it but didnt work.

If you get the same error without -j, then it may not be an out of memory issue.
It may also be a disk space issue…building opencv requires about 4 GB of disk.
You may check your disks usage with

df -H -T

I tried on SSD still same error sir.

I installed jetpack 3.0,
after that I downloaded OpenCV 3.2

sudo apt-get install \
    libglew-dev \
    libtiff5-dev \
    zlib1g-dev \
    libjpeg-dev \
    libpng12-dev \
    libjasper-dev \
    libavcodec-dev \
    libavformat-dev \
    libavutil-dev \
    libpostproc-dev \
    libswscale-dev \
    libeigen3-dev \
    libtbb-dev \
    libgtk2.0-dev \
    pkg-config \
    libatlas3-base \
    libblas3 \
    python-dev \
    python-numpy \
    python-py \
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local/opencv-3.2.0 \
    -DCMAKE_CXX_FLAGS=-Wa,-mimplicit-it=thumb \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_python2=ON \
    -DBUILD_opencv_python3=OFF \
    -DWITH_1394=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-6.5 \
    -DCUDA_ARCH_BIN=3.2 \
    -DCUDA_ARCH_PTX=""  \
    -DOPENCV_TEST_DATA_PATH=../../../testdata/opencv_extra/testdata \
export LD_LIBRARY_PATH=/usr/local/cuda/lib
make -j3

Still same error. Interesting.


I can reproduce this ‘’ error on my environment.
The failure may cause by multithread:

I tried to use ‘make’ only, and build successfully on my tk1.
Could remove the whole release folder and build it with single thread command again?


I solved the error with use diffrent cmake code like this:


now I think I can use the gstreamer but before the installation i setup libopencv4tegra-python and when i write cv2.version it says 2.4.13, how can i turn to 3.1?

I think now this is my last problem. :D

Edit: How can i access /hdd/buildbot/slave_jetson_tk1_1/32-O4T-L4T/build\ ?