{"id":745,"date":"2019-05-03T00:22:31","date_gmt":"2019-05-02T15:22:31","guid":{"rendered":"https:\/\/ahnbk.com\/?p=745"},"modified":"2019-05-03T00:22:32","modified_gmt":"2019-05-02T15:22:32","slug":"jetson-nano%ec%97%90%ec%84%9c-opencv-4-1-with-cuda-%eb%b9%8c%eb%93%9c","status":"publish","type":"post","link":"https:\/\/ahnbk.com\/?p=745","title":{"rendered":"Jetson Nano\uc5d0\uc11c OpenCV 4.1 with CUDA \ube4c\ub4dc"},"content":{"rendered":"\n<p>\uc601\uc0c1\ucc98\ub9ac\uc5d0 \ub9ce\uc774 \uc0ac\uc6a9\ub418\ub294 OpenCV\ub97c Jetson Nano\uc5d0\uc11c\ub3c4 \uc0ac\uc6a9 \uac00\ub2a5\ud558\ub2e4. \ube4c\ub4dc \uacfc\uc815\uc740 PC\uc5d0\uc11c\uc640 \ub3d9\uc77c\ud558\ub098 \ud50c\ub7ab\ud3fc\uc758 \ud2b9\uc131 \uc0c1 \uba87\uac00\uc9c0 \ub2e4\ub978 \ubd80\ubd84\uc774 \uc788\ub2e4. \uae30\ubcf8\uc73c\ub85c \uc124\uce58\ub418\uc5b4 \uc788\ub294 \ud328\ud0a4\uc9c0\ub97c \uc0ac\uc6a9\ud574\ub3c4 \ub418\uc9c0\ub9cc, CUDA\ub97c \ud65c\uc6a9\ud558\uae30 \uc704\ud574\uc120 \ube4c\ub4dc \uacfc\uc815\uc744 \ud1b5\ud574 \uc124\uce58\ud558\uc5ec\uc57c \ud55c\ub2e4.<\/p>\n\n\n\n<p>L4T\uc5d0\ub294 cuda10.0\uc774 \uc774\ubbf8 \uc124\uce58\ub418\uc5b4 \uc788\ub2e4.<\/p>\n\n\n\n<p>OpenCV github \ub808\ud3ec\uc9c0\ud1a0\ub9ac\uc5d0\uc11c \uc18c\uc2a4\ub97c \ub2e4\uc6b4\ub85c\ub4dc\ud55c\ub2e4.<\/p>\n\n\n\n<ul><li><a href=\"https:\/\/github.com\/opencv\/opencv\">https:\/\/github.com\/opencv\/opencv<\/a><\/li><li><a href=\"https:\/\/github.com\/opencv\/opencv_contrib\">https:\/\/github.com\/opencv\/opencv_contrib<\/a><\/li><\/ul>\n\n\n\n<p>\ud604\uc7ac \ub9b4\ub9ac\uc988\ub41c \ucd5c\uc2e0 \ubc84\uc804\uc740 4.1.0\uc774\ub2e4.<\/p>\n\n\n\n<p>\uba3c\uc800 cmake\ub97c \uc124\uce58\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt install cmake<\/code><\/pre>\n\n\n\n<p>\ub2e4\uc6b4\ub85c\ub4dc\ud55c \uc555\ucd95\ud30c\uc77c (opencv-4.1.0.tar.gz, opencv_contrib-4.1.0.tar.gz) \uc744 \ud480\uace0,  \ub2e4\uc74c\uacfc \uac19\uc774 cmake\ub97c \uc774\uc6a9\ud574 \ube4c\ub4dc \ud30c\uc77c\uc744 \uc0dd\uc131\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cd opencv-4.1.0\n$ mkdir build\n$ cd build\n$ cmake -DOPENCV_EXTRA_MODULES_PATH=..\/..\/opencv_contrib-4.1.0\/modules -DWITH_CUDA=ON -DCUDA_FAST_MATH=1 -DBUILD_EXAMPLES=ON  -DBUILD_opencv_python3=ON -DPYTHON3_INCLUDE_DIR2=\/usr\/include\/python3.6m -DPYTHON3_NUMPY_INCLUDE_DIRS=\/usr\/lib\/python3\/dist-packages\/numpy\/core\/include -DCUDA_ARCH_BIN=\"5.3\" -DCUDA_ARCH_PTX=\"\"  -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF ..<\/code><\/pre>\n\n\n\n<p>\uac01\uc885 \uc758\uc874 \ud328\ud0a4\uc9c0\ub4e4\uc744 \uccb4\ud06c\ud558\uace0 \uc815\uc0c1\uc801\uc73c\ub85c \uc885\ub8cc\ub418\uba74 \ub2e4\uc74c\uacfc \uac19\uc740 \uacb0\uacfc\ub97c \ubcf4\uc5ec\uc900\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- General configuration for OpenCV 4.1.0 =====================================\n--   Version control:               unknown\n-- \n--   Extra modules:\n--     Location (extra):            \/home\/byeongkyu\/Downloads\/opencv_contrib-4.1.0\/modules\n--     Version control (extra):     unknown\n-- \n--   Platform:\n--     Timestamp:                   2019-05-02T04:43:14Z\n--     Host:                        Linux 4.9.140-tegra aarch64\n--     CMake:                       3.10.2\n--     CMake generator:             Unix Makefiles\n--     CMake build tool:            \/usr\/bin\/make\n--     Configuration:               Release\n-- \n--   CPU\/HW features:\n--     Baseline:                    NEON FP16\n--       required:                  NEON\n--       disabled:                  VFPV3\n-- \n--   C\/C++:\n--     Built as dynamic libs?:      YES\n--     C++ Compiler:                \/usr\/bin\/c++  (ver 7.4.0)\n--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG\n--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG\n--     C Compiler:                  \/usr\/bin\/cc\n--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG\n--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG\n--     Linker flags (Release):      -Wl,--gc-sections  \n--     Linker flags (Debug):        -Wl,--gc-sections  \n--     ccache:                      NO\n--     Precompiled headers:         YES\n--     Extra dependencies:          m pthread cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L\/usr\/local\/cuda\/lib64 -L\/usr\/lib\/aarch64-linux-gnu\n--     3rdparty dependencies:\n-- \n--   OpenCV modules:\n--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 quality reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto\n--     Disabled:                    world\n--     Disabled by dependency:      -\n--     Unavailable:                 cnn_3dobj cvv freetype hdf java js matlab ovis python3 sfm viz\n--     Applications:                tests perf_tests examples apps\n--     Documentation:               NO\n--     Non-free algorithms:         NO\n-- \n--   GUI: \n--     GTK+:                        NO\n--     VTK support:                 NO\n-- \n--   Media I\/O: \n--     ZLib:                        \/usr\/lib\/aarch64-linux-gnu\/libz.so (ver 1.2.11)\n--     JPEG:                        libjpeg-turbo (ver 2.0.2-62)\n--     WEBP:                        build (ver encoder: 0x020e)\n--     PNG:                         build (ver 1.6.36)\n--     TIFF:                        build (ver 42 - 4.0.10)\n--     JPEG 2000:                   build (ver 1.900.1)\n--     OpenEXR:                     build (ver 1.7.1)\n--     HDR:                         YES\n--     SUNRASTER:                   YES\n--     PXM:                         YES\n--     PFM:                         YES\n-- \n--   Video I\/O:\n--     DC1394:                      NO\n--     FFMPEG:                      NO\n--       avcodec:                   NO\n--       avformat:                  NO\n--       avutil:                    NO\n--       swscale:                   NO\n--       avresample:                NO\n--     GStreamer:                   YES (1.14.1)\n--     v4l\/v4l2:                    YES (linux\/videodev2.h)\n-- \n--   Parallel framework:            pthreads\n-- \n--   Trace:                         YES (built-in)\n-- \n--   Other third-party libraries:\n--     Lapack:                      NO\n--     Eigen:                       YES (ver 3.3.4)\n--     Custom HAL:                  YES (carotene (ver 0.0.1))\n--     Protobuf:                    build (3.5.1)\n-- \n--   NVIDIA CUDA:                   YES (ver 10.0, CUFFT CUBLAS FAST_MATH)\n--     NVIDIA GPU arch:             53\n--     NVIDIA PTX archs:\n-- \n--   OpenCL:                        YES (no extra features)\n--     Include path:                \/home\/byeongkyu\/Downloads\/opencv-4.1.0\/3rdparty\/include\/opencl\/1.2\n--     Link libraries:              Dynamic load\n-- \n--   Python 2:\n--     Interpreter:                 \/usr\/bin\/python2.7 (ver 2.7.15)\n--     Libraries:                   \/usr\/lib\/aarch64-linux-gnu\/libpython2.7.so (ver 2.7.15rc1)\n--     numpy:                       \/usr\/lib\/python2.7\/dist-packages\/numpy\/core\/include (ver 1.13.3)\n--     install path:                lib\/python2.7\/dist-packages\/cv2\/python-2.7\n-- \n--   Python 3:\n--     Interpreter:                 \/usr\/bin\/python3 (ver 3.6.7)\n--     Libraries:                   \/usr\/lib\/aarch64-linux-gnu\/libpython3.6m.so (ver 3.6.7)\n--     numpy:                       \/usr\/lib\/python3\/dist-packages\/numpy\/core\/include (ver )\n--     install path:                lib\/python3.6\/dist-packages\/cv2\/python-3.6\n-- \n--   Python (for build):            \/usr\/bin\/python3\n--\n--   Java:                          \n--     ant:                         NO\n--     JNI:                         NO\n--     Java wrappers:               NO\n--     Java tests:                  NO\n-- \n--   Install to:                    \/usr\/local\n-- -----------------------------------------------------------------\n-- \n-- Configuring done\n-- Generating done\n-- Build files have been written to: \/home\/byeongkyu\/Downloads\/opencv-4.1.0\/build<\/code><\/pre>\n\n\n\n<p>\ube4c\ub4dc \uc911 \ub7a8 \ubd80\uc871\uc73c\ub85c \uc778\ud55c \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud558\ubbc0\ub85c, swap \ud30c\ud2f0\uc158\uc744 \uc0dd\uc131\ud558\uc5ec \uc774\ub97c \ubcf4\uc644\ud558\ub3c4\ub85d \ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo fallocate -l 4.0G \/swapfile\n$ sudo chmod 600 \/swapfile\n$ sudo mkswap \/swapfile\n$ sudo swapon \/swapfile\n\n\ubd80\ud305\uc2dc\ub9c8\ub2e4 \ub9c8\uc6b4\ud2b8 \ud558\ub3c4\ub85d \ub2e4\uc74c\uc758 \ud30c\uc77c \uc218\uc815\n$ sudo vi \/etc\/fstab\n\n\ub77c\uc778 \ucd94\uac00\n\/swapfile none swap 0 0<\/code><\/pre>\n\n\n\n<p>\uc790, \uc774\uc81c \ube4c\ub4dc\ub97c \uc2dc\uc791\ud574\ubcf4\uba74&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ make -j1<\/code><\/pre>\n\n\n\n<p>\ucf54\uc5b4 4\uac1c\ub97c \uc801\uadf9 \ud65c\uc6a9\ud558\uba74 \uc88b\uaca0\uc73c\ub098, \ub7a8\uc774 4\uae30\uac00 \ubc16\uc5d0 \uc5c6\ub294 \uad00\uacc4\ub85c \ub7a8 \ubd80\uc871\uacfc \uac19\uc740 \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud558\uac70\ub098 \uc544\uc608 \uba48\ucdb0\ubc84\ub9ac\ub294 \ubd88\uc0c1\uc0ac\uac00 \ubc1c\uc0dd\ud55c\ub2e4.  \ub530\ub77c\uc11c \uc4f0\ub808\ub4dc 1\uac1c\ub85c \ube4c\ub4dc \uc2dc\uc791! \ucef4\ud30c\uc77c \uc2dc\uac04\uc774 \uc5b4\ub9c8\uc5b4\ub9c8\ud558\uac8c \uac78\ub9ac\uace0 \ubc29\uc5f4\ud310\uc774 \uc5c4\uccad\ub098\uac8c \ub728\uac70\uc6cc\uc9c0\ubbc0\ub85c \uc870\uc2ec.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img data-attachment-id=\"754\" data-permalink=\"https:\/\/ahnbk.com\/?attachment_id=754\" data-orig-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/05\/system_monitor.png?fit=702%2C839&amp;ssl=1\" data-orig-size=\"702,839\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"system_monitor\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/05\/system_monitor.png?fit=702%2C839&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/05\/system_monitor.png?fit=525%2C627&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/05\/system_monitor.png?resize=348%2C415&#038;ssl=1\" alt=\"\" class=\"wp-image-754\" width=\"348\" height=\"415\" data-recalc-dims=\"1\" \/><\/figure><\/div>\n\n\n\n<p>\ube4c\ub4dc\uac00 \uc644\ub8cc\ub418\uba74, \uc644\ub8cc\ub41c \ud30c\uc77c\ub4e4\uc744 \uc124\uce58\ud55c\ub2e4. \uc124\uce58 \uacbd\ub85c\ub294 \/usr\/local \uc774\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo make install<\/code><\/pre>\n\n\n\n<p>\uc774\uc81c \uc81c\ub300\ub85c \uc124\uce58\ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud574\ubcf8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ opencv_version \n4.1.0\n\n$ python3\n>>> import cv2\n>>> cv2\n&lt;module 'cv2' from '\/usr\/local\/lib\/python3.6\/dist-packages\/cv2\/python-3.6\/cv2.cpython-36m-aarch64-linux-gnu.so'>\n>>> cv2.__version__\n'4.1.0'<\/code><\/pre>\n\n\n\n<p>\uc77c\ub2e8 \uc124\uce58\ub294 \uc5ec\uae30\uae4c\uc9c0!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc601\uc0c1\ucc98\ub9ac\uc5d0 \ub9ce\uc774 \uc0ac\uc6a9\ub418\ub294 OpenCV\ub97c Jetson Nano\uc5d0\uc11c\ub3c4 \uc0ac\uc6a9 \uac00\ub2a5\ud558\ub2e4. \ube4c\ub4dc \uacfc\uc815\uc740 PC\uc5d0\uc11c\uc640 \ub3d9\uc77c\ud558\ub098 \ud50c\ub7ab\ud3fc\uc758 \ud2b9\uc131 \uc0c1 \uba87\uac00\uc9c0 \ub2e4\ub978 \ubd80\ubd84\uc774 \uc788\ub2e4. \uae30\ubcf8\uc73c\ub85c \uc124\uce58\ub418\uc5b4 \uc788\ub294 \ud328\ud0a4\uc9c0\ub97c \uc0ac\uc6a9\ud574\ub3c4 \ub418\uc9c0\ub9cc, CUDA\ub97c \ud65c\uc6a9\ud558\uae30 \uc704\ud574\uc120 \ube4c\ub4dc \uacfc\uc815\uc744 \ud1b5\ud574 \uc124\uce58\ud558\uc5ec\uc57c \ud55c\ub2e4. L4T\uc5d0\ub294 cuda10.0\uc774 \uc774\ubbf8 \uc124\uce58\ub418\uc5b4 \uc788\ub2e4. OpenCV github \ub808\ud3ec\uc9c0\ud1a0\ub9ac\uc5d0\uc11c \uc18c\uc2a4\ub97c \ub2e4\uc6b4\ub85c\ub4dc\ud55c\ub2e4. https:\/\/github.com\/opencv\/opencv https:\/\/github.com\/opencv\/opencv_contrib \ud604\uc7ac \ub9b4\ub9ac\uc988\ub41c \ucd5c\uc2e0 \ubc84\uc804\uc740 4.1.0\uc774\ub2e4. \uba3c\uc800 cmake\ub97c \uc124\uce58\ud55c\ub2e4. \ub2e4\uc6b4\ub85c\ub4dc\ud55c \uc555\ucd95\ud30c\uc77c &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ahnbk.com\/?p=745\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Jetson Nano\uc5d0\uc11c OpenCV 4.1 with CUDA \ube4c\ub4dc&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[114],"tags":[115,147,163,127],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXSW-c1","jetpack-related-posts":[],"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/745"}],"collection":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=745"}],"version-history":[{"count":6,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/745\/revisions"}],"predecessor-version":[{"id":755,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/745\/revisions\/755"}],"wp:attachment":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}