Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the Real-time acquisition of Video Image by using OpenCV3.1 in TX1

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to analyze real-time video images captured by TX1 using OpenCV3.1. The content is concise and easy to understand, which can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Embedded platform (Target): Jeston TX1

OpenCV: OpenCV3.1

Camera: USB 800W camera

1 preface

The OpenCV installed by Jetpack3.0 is that OpenCV2.4.13,OpenCV2.4.13 does not support USB cameras well. The Jetpack updated by NVIDIA will solve the problem of poor support for USB cameras. Until the official solution, a temporary solution is to compile the OpenCV3.1 yourself.

2 download OpenCV3

URL: http://www.opencv.org/releases.html

Click Sources to download the source code:

3 install the dependency library # Some general development librariessudo apt-get install-y build-essential make cmake cmake-curses-gui galleys # libav video input/output development librariessudo apt-get install-y libavformat-dev libavutil-dev libswscale-dev# Video4Linux camera development librariessudo apt-get install-y libv4l-dev# Eigen3 math development librariessudo apt-get install-y libeigen3-dev# OpenGL development libraries (to allow creating graphical windows) sudo apt-get install-y libglew1.6-dev# GTK development libraries (to allow creating graphical windows) sudo apt-get install-y Libgtk2.0-dev4 compiles and installs OpenCV3cd ~ mkdir srccd srcunzip ~ / Downloads/opencv-3.1.0.zipcd opencv-3.1.0mkdir buildcd buildcmake-DWITH_CUDA=ON-DCUDA_ARCH_BIN= "5.3"-DCUDA_ARCH_PTX= "- DBUILD_TESTS=OFF-DBUILD_PERF_TESTS=OFF-DCUDA_FAST_MATH=ON-DCMAKE_INSTALL_PREFIX=/home/ubuntu/opencv-3.1.0.. make-J4 install5 runs hog routine 5.1 compiles and runs routine cd ~ / src / opencv-3.1.0/samples/gpug++-o hog-I / home/ubuntu/opencv-3.1.0/include-O2-g-Wall hog.cpp-L / home/ubuntu/opencv-3.1.0/lib-lopencv_core-lopencv_imgproc-lopencv_ flann-lopencv_ imgcodecs-lopencv_videoio-lopencv_highgui-lopencv_ml-lopencv_video-lopencv_objdetect-lopencv_photo-lopencv_features2d-lopencv_calib3d-lopencv_stitching-lopencv_videostab-lopencv_shape-lopencv _ cudaobjdetect-lopencv_cudawarping-lopencv_cudaimgprocexport LD_LIBRARY_PATH=/home/ubuntu/opencv-3.1.0/lib:$LD_LIBRARY_PATH./hog-- camera 0

Export LD_LIBRARY_PATH=/home/ubuntu/opencv-3.1.0/lib:$LD_LIBRARY_PATH: add LIBARARY, this is only a temporary addition, permanently add environment variables that can be put into ~ / .bashrc, and use source ~ / .bashrc to "activate" the setting.

. / hog-camera 0: the last parameter 0 means to use / dev/video0 device. If the TX1 is plugged into the onboard CSI camera and then the USB camera, this 0 should be changed to 1. You can check which video devices are available at ls / dev/ | grep video*,.

5.2 run result

6 write a simple camera capture program 6.1 code as follows # include # include using namespace cv; using namespace std; int main (int argc, char** argv) {VideoCapture cap ("nvcamerasrc! Video/x-raw (memory:NVMM), width= (int) 1280, height= (int) 720 format = (string) I420, framerate= (fraction) 24 Lexi! Nvvidconv flip-method=2! Video/x-raw, format= (string) BGRx! Videoconvert! Video/x-raw, format= (string) BGR! Appsink "); if (! cap.isOpened ()) {cout frame; imshow (" original ", frame); / / waitKey (1); if (waitKey (30) > = 0) break;} return 0;} 6.2 run result

PS: the image is a little white because of the sunshine. Excuse me.

7 problems that may be encountered

In make, we may encounter the following error:

Solution: need to modify a source code, in graphcuts.cpp will

# if! defined (HAVE_CUDA) | | defined (CUDA_DISABLER)

Change to:

# if! defined (HAVE_CUDA) | | defined (CUDA_DISABLER) | | (CUDART_VERSION > = 8000)

As shown in the following figure:

The above content is how to analyze how TX1 uses OpenCV3.1 to capture video images in real time. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report