# OpenCV error

**URL:** <https://forums.developer.nvidia.com/t/opencv-error/178527>\
**Category:** Jetson Nano\
**Tags:** opencv, jetson-inference, python, gstreamer, camera\
**Created:** [May 20, 2021, 12:35pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527 "2021-05-20T12:35:50Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [May 20, 2021, 12:35pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/1 "2021-05-20T12:35:50Z")

</div>

Hello, I am using raspberry pi camera with Jetson nano, while I am trying the following code an error occur and could not find the exact problem, my opencv version is 4.5.1

```
import cv2
print(cv2. __version__ )
dispW=640
dispH=480
flip=4
camSet='nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(dispW)+', height='+str(dispH)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'

```

1. 

```
cam= cv2.VideoCapture(camSet)

```

2. 

```
print(cam.isOpened())

```

3. 

```
while(True):

```

4. 

```
    # Capture frame-by-frame

```

5. 

```
    ret,frame = cam.read()

```

6. 

```
    # Display the resulting frame

```

7. 

```
    cv2.imshow('frame',frame)

```

8. 

```
    if cv2.waitKey(1) == ord('q'):

```

9. 

```
        break

```

10. 

```
# When everything done, release the capture

```

11. 

```
cam.release()

```

12. 

```
cv2.destroyAllWindows() 

```

this is the error :

> 4.5.1  
> [ERROR:0] global /tmp/pip-req-build-zuuo394f/opencv/modules/videoio/src/cap.cpp (140) open VIDEOIO(CV\_IMAGES): raised OpenCV exception:
> 
> OpenCV(4.5.1) /tmp/pip-req-build-zuuo394f/opencv/modules/videoio/src/cap\_images.cpp:253: error: (-5:Bad argument) CAP\_IMAGES: can’t find starting number (in the name of file): nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method=4 ! video/x-raw, width=640, height=480, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink in function ‘icvExtractPattern’
> 
> False  
> Traceback (most recent call last):  
> File “testcamera.py”, line 20, in   
> cv2.imshow(‘frame’,frame)  
> cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-zuuo394f/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width\>0 && size.height\>0 in function ‘imshow’

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [May 21, 2021, 12:12am UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/3 "2021-05-21T00:12:03Z")

</div>

Hi,  
Please check if you can run the command and see camera preview:

```auto
$ export DISPLAY=:0
$ gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1' ! nvegltransform ! nveglglessink

```

And then try

```auto
$ gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1' ! nvvidconv flip-method=4 ! video/x-raw, width=640, height=480, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! fakesink

```

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [May 21, 2021, 1:28am UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/4 "2021-05-21T01:28:26Z")

</div>

Seems the videoCapture used the wrong backend (CV\_IMAGES).  
You would try to specify gstreamer backend with:

```auto
cam= cv2.VideoCapture(camSet, cv2.CAP_GSTREAMER)

```

If this doesn’t work, check that your opencv build has gstreamer support with:

```auto
print(cv2.getBuildInformation())

```

---

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [May 21, 2021, 12:22pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/5 "2021-05-21T12:22:25Z")

</div>

I executed this code in the terminal and the camera opened successfully:

> $ export DISPLAY=:0  
> $ gst-launch-1.0 nvarguscamerasrc ! ‘video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1’ ! nvegltransform ! nveglglessink

but this code didnot open the camera:

````auto
> $ gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1' ! nvvidconv flip-method=4 ! video/x-raw, width=640, height=480, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! fakesink
> ```

it kept showing these lines:
> Setting pipeline to PAUSED ...
> Pipeline is live and does not need PREROLL ...
> Setting pipeline to PLAYING ...
> New clock: GstSystemClock
> GST_ARGUS: Creating output stream
> CONSUMER: Waiting until producer is connected...
> GST_ARGUS: Available Sensor modes :
> GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
> 
> GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
> 
> GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
> 
> GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
> 
> GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
> 
> GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
> 
> GST_ARGUS: Running with following settings:
> Camera index = 0 
> Camera mode = 0 
> Output Stream W = 3264 H = 2464 
> seconds to Run = 0 
> Frame Rate = 21.000000 
> GST_ARGUS: Setup Complete, Starting captures for 0 seconds
> GST_ARGUS: Starting repeat capture requests.
> CONSUMER: Producer has connected; continuing.
````

---

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [May 21, 2021, 12:25pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/6 "2021-05-21T12:25:22Z")

</div>

First of all thanks for your help, I tried it but nothing changed, and this is the result of printing the build information:

> 4.5.1  
> False
> 
> General configuration for OpenCV 4.5.1 =====================================  
> Version control: 4.5.1-dirty
> 
> Platform:  
> Timestamp: 2021-01-02T12:47:39Z  
> Host: Linux 5.4.0-54-generic aarch64  
> CMake: 3.18.4  
> CMake generator: Unix Makefiles  
> CMake build tool: /bin/gmake  
> Configuration: Release
> 
> CPU/HW features:  
> Baseline: NEON FP16
> 
> C/C++:  
> Built as dynamic libs?: NO  
> C++ standard: 11  
> C++ Compiler: /opt/rh/devtoolset-9/root/usr/bin/c++ (ver 9.3.1)  
> C++ flags (Release): -Wl,-strip-all -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 -Wsuggest-override -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  
> C++ flags (Debug): -Wl,-strip-all -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 -Wsuggest-override -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  
> C Compiler: /opt/rh/devtoolset-9/root/usr/bin/cc  
> C flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG  
> C flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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  
> Linker flags (Release): -L/root/ffmpeg\_build/lib -Wl,–gc-sections -Wl,–as-needed  
> Linker flags (Debug): -L/root/ffmpeg\_build/lib -Wl,–gc-sections -Wl,–as-needed  
> ccache: YES  
> Precompiled headers: NO  
> Extra dependencies: ade Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /lib64/libpng.so /lib64/libz.so dl m pthread rt  
> 3rdparty dependencies: ittnotify libprotobuf libjpeg-turbo libwebp libtiff libopenjp2 IlmImf quirc tegra\_hal
> 
> OpenCV modules:  
> To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio  
> Disabled: world  
> Disabled by dependency: -  
> Unavailable: java python2 ts  
> Applications: -  
> Documentation: NO  
> Non-free algorithms: NO
> 
> GUI:  
> QT: YES (ver 5.15.0)  
> QT OpenGL support: NO  
> GTK+: NO  
> VTK support: NO
> 
> Media I/O:  
> ZLib: /lib64/libz.so (ver 1.2.7)  
> JPEG: libjpeg-turbo (ver 2.0.6-62)  
> WEBP: build (ver encoder: 0x020f)  
> PNG: /lib64/libpng.so (ver 1.5.13)  
> TIFF: build (ver 42 - 4.0.10)  
> JPEG 2000: build (ver 2.3.1)  
> OpenEXR: build (ver 2.3.0)  
> HDR: YES  
> SUNRASTER: YES  
> PXM: YES  
> PFM: YES
> 
> Video I/O:  
> DC1394: NO  
> FFMPEG: YES  
> avcodec: YES (58.112.103)  
> avformat: YES (58.64.100)  
> avutil: YES (56.60.100)  
> swscale: YES (5.8.100)  
> avresample: NO  
> GStreamer: NO  
> v4l/v4l2: YES (linux/videodev2.h)
> 
> Parallel framework: pthreads
> 
> Trace: YES (with Intel ITT)
> 
> Other third-party libraries:  
> Lapack: NO  
> Eigen: NO  
> Custom HAL: YES (carotene (ver 0.0.1))  
> Protobuf: build (3.5.1)
> 
> OpenCL: YES (no extra features)  
> Include path: /tmp/pip-req-build-zuuo394f/opencv/3rdparty/include/opencl/1.2  
> Link libraries: Dynamic load
> 
> Python 3:  
> Interpreter: /opt/python/cp36-cp36m/bin/python (ver 3.6.12)  
> Libraries: libpython3.6m.a (ver 3.6.12)  
> numpy: /tmp/pip-build-env-c03ewnak/overlay/lib/python3.6/site-packages/numpy/core/include (ver 1.19.3)  
> install path: python
> 
> Python (for build): /bin/python2.7
> 
> Java:  
> ant: NO  
> JNI: NO  
> Java wrappers: NO  
> Java tests: NO
> 
> ## Install to: /tmp/pip-req-build-zuuo394f/\_skbuild/linux-aarch64-3.6/cmake-install
> 
> Traceback (most recent call last):  
> File “testcamera.py”, line 20, in   
> cv2.imshow(‘frame’,frame)  
> cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-zuuo394f/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width\>0 && size.height\>0 in function ‘imshow’

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [May 21, 2021, 12:46pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/7 "2021-05-21T12:46:43Z")

</div>

> [@marwan.a.k.1997](#):
>
> but this code didnot open the camera:
> 
> ```auto
> > $ gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1' ! nvvidconv flip-method=4 ! video/x-raw, width=640, height=480, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! fakesink
> 
> ```

It looks it did successfully open the camera. Obviously, as there is no display (fakesink) you cannot see it.  
You may further check with:

```auto
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1' ! nvvidconv flip-method=4 ! video/x-raw, width=640, height=480, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! videoconvert ! xvimagesink

```

> [@marwan.a.k.1997](#):
>
> Video I/O:  
> …  
> GStreamer: NO

This may be the root cause of your problem. You would rebuild opencv with gstreamer support.  
I’d suggest to use the following script:

> **[GitHub - mdegans/nano\_build\_opencv: Build OpenCV on Nvidia Jetson Nano](https://github.com/mdegans/nano_build_opencv)**
>
> Build OpenCV on Nvidia Jetson Nano

---

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [May 21, 2021, 12:55pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/8 "2021-05-21T12:55:42Z")

</div>

sorry for the inconvenience, I am newbie to the jetson nano.  
Just want to make sure of steps before doing it, should I download the opencv.sh file and run the 2 codes mentioned in the page?

Second question is , in the following code it is written “4.4.0”, my opencv version is 4.5.1, should I change the number or it will cause failure in the script?

> ./build\_opencv.sh 4.4.0

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [May 21, 2021, 12:58pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/9 "2021-05-21T12:58:24Z")

</div>

Yes, if you want to build opencv 4.5.1, just run the script with:

```auto
./build_opencv.sh 4.5.1

```

---

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [May 21, 2021, 7:22pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/10 "2021-05-21T19:22:52Z")

</div>

I run the script but unfortunately it did not work:

> 4.4.0  
> [WARN:0] global /tmp/build\_opencv/opencv/modules/videoio/src/cap\_gstreamer.cpp (803) open OpenCV | GStreamer warning: cannot find appsink in manual pipeline  
> [WARN:0] global /tmp/build\_opencv/opencv/modules/videoio/src/cap\_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created  
> False
> 
> General configuration for OpenCV 4.4.0 =====================================  
> Version control: 4.4.0
> 
> Extra modules:  
> Location (extra): /tmp/build\_opencv/opencv\_contrib/modules  
> Version control (extra): 4.4.0
> 
> Platform:  
> Timestamp: 2021-05-21T13:12:45Z  
> Host: Linux 4.9.201-tegra aarch64  
> CMake: 3.10.2  
> CMake generator: Unix Makefiles  
> CMake build tool: /usr/bin/make  
> Configuration: RELEASE
> 
> CPU/HW features:  
> Baseline: NEON FP16  
> required: NEON  
> disabled: VFPV3
> 
> C/C++:  
> Built as dynamic libs?: YES  
> C++ standard: 11  
> C++ Compiler: /usr/bin/c++ (ver 7.5.0)  
> 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 -Wsuggest-override -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  
> 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 -Wsuggest-override -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  
> C Compiler: /usr/bin/cc  
> C flags (Release): -fsigned-char -W -Wall -Werror=return-type -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  
> C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -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  
> Linker flags (Release): -Wl,–gc-sections -Wl,–as-needed  
> Linker flags (Debug): -Wl,–gc-sections -Wl,–as-needed  
> ccache: NO  
> Precompiled headers: NO  
> Extra dependencies: m pthread cudart\_static -lpthread dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/lib64 -L/usr/lib/aarch64-linux-gnu  
> 3rdparty dependencies:
> 
> OpenCV modules:  
> To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn\_objdetect dnn\_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img\_hash imgcodecs imgproc intensity\_transform line\_descriptor ml objdetect optflow phase\_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency shape stereo stitching structured\_light superres surface\_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto  
> Disabled: world  
> Disabled by dependency: -  
> Unavailable: cnn\_3dobj cvv java js julia matlab ovis sfm ts viz  
> Applications: apps  
> Documentation: NO  
> Non-free algorithms: YES
> 
> GUI:  
> GTK+: YES (ver 3.22.30)  
> GThread : YES (ver 2.56.4)  
> GtkGlExt: NO  
> OpenGL support: NO  
> VTK support: NO
> 
> Media I/O:  
> ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)  
> JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)  
> WEBP: build (ver encoder: 0x020f)  
> PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)  
> TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)  
> JPEG 2000: build Jasper (ver 1.900.1)  
> OpenEXR: build (ver 2.3.0)  
> HDR: YES  
> SUNRASTER: YES  
> PXM: YES  
> PFM: YES
> 
> Video I/O:  
> DC1394: YES (2.2.5)  
> FFMPEG: YES  
> avcodec: YES (57.107.100)  
> avformat: YES (57.83.100)  
> avutil: YES (55.78.100)  
> swscale: YES (4.8.100)  
> avresample: YES (3.7.0)  
> GStreamer: YES (1.14.5)  
> v4l/v4l2: YES (linux/videodev2.h)
> 
> Parallel framework: pthreads
> 
> Trace: YES (with Intel ITT)
> 
> Other third-party libraries:  
> Lapack: YES (/usr/lib/aarch64-linux-gnu/liblapack.so /usr/lib/aarch64-linux-gnu/libcblas.so /usr/lib/aarch64-linux-gnu/libatlas.so)  
> Eigen: YES (ver 3.3.4)  
> Custom HAL: YES (carotene (ver 0.0.1))  
> Protobuf: build (3.5.1)
> 
> NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST\_MATH)  
> NVIDIA GPU arch: 53 62 72  
> NVIDIA PTX archs:
> 
> cuDNN: YES (ver 8.0)
> 
> OpenCL: YES (no extra features)  
> Include path: /tmp/build\_opencv/opencv/3rdparty/include/opencl/1.2  
> Link libraries: Dynamic load
> 
> Python 2:  
> Interpreter: /usr/bin/python2.7 (ver 2.7.17)  
> Libraries: /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.17)  
> numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)  
> install path: lib/python2.7/dist-packages/cv2/python-2.7
> 
> Python 3:  
> Interpreter: /usr/bin/python3 (ver 3.6.9)  
> Libraries: /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)  
> numpy: /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.19.4)  
> install path: lib/python3.6/dist-packages/cv2/python-3.6
> 
> Python (for build): /usr/bin/python2.7
> 
> Java:  
> ant: NO  
> JNI: NO  
> Java wrappers: NO  
> Java tests: NO
> 
> ## Install to: /usr/local
> 
> Traceback (most recent call last):  
> File “trycamera.py”, line 19, in   
> cv2.imshow(‘frame’,frame)  
> cv2.error: OpenCV(4.4.0) /tmp/build\_opencv/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width\>0 && size.height\>0 in function ‘imshow’

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [May 22, 2021, 3:04pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/11 "2021-05-22T15:04:36Z")

</div>

> [@marwan.a.k.1997](#):
>
> [WARN:0] global /tmp/build\_opencv/opencv/modules/videoio/src/cap\_gstreamer.cpp (803) open OpenCV | GStreamer warning: cannot find appsink in manual pipeline  
> [WARN:0] global /tmp/build\_opencv/opencv/modules/videoio/src/cap\_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

The pipeline string was probably not correct, as gstreamer failed to find appsink that should be the sink of the pipeline.  
As a result, the videoCapture failed to open, and you are reading empty frames, that cannot be displayed as say the last messages.

---

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [May 23, 2021, 11:52am UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/12 "2021-05-23T11:52:49Z")

</div>

So are there any solutions could I try?

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [May 23, 2021, 12:22pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/13 "2021-05-23T12:22:24Z")

</div>

Check your pipeline string. You may post it here.

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [May 24, 2021, 1:21am UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/14 "2021-05-24T01:21:58Z")

</div>

Hi,  
The log in [the comment](https://forums.developer.nvidia.com/t/opencv-error/178527/5) looks good. Do you check the video output?

And is your Jetson Nano with emmc or sdcard slot? The emmc storage is 16GB and is not enough for rebuilding OpenCV. The default OpenCV 4.1.1 has gstreamer enabled and should work fine.

---

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [May 30, 2021, 12:53pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/15 "2021-05-30T12:53:56Z")

</div>

Could you please explain more, how should I check it?  
P.S Sorry for the late reply

---

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [May 30, 2021, 12:54pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/16 "2021-05-30T12:54:25Z")

</div>

My jetson nano is with sd card slot

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [May 30, 2021, 5:50pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/17 "2021-05-30T17:50:58Z")

</div>

First try this pipeline that should allow to read the CSI camera into opencv:

```auto
camSet = "nvarguscamerasrc ! video/x-raw(memory:NVMM),format=NV12,width=640,height=480,framerate=30/1 ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink drop=1 "

```

and try to change from this.  
If you get stcuk, post your pipeline and error messages here.

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/honey_patouceul/32/389777_2.png) [@Honey\_Patouceul](https://forums.developer.nvidia.com/u/Honey_Patouceul)\
**Post date:** [May 30, 2021, 6:38pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/19 "2021-05-30T18:38:07Z")

</div>

Either your opencv build did not install into python3, or you have a customized python3 installation and it has been installed in a different directory than the actually looked one.

I have poor experience with python setup and may not be able to help much further.  
I can just share my own case:

```auto
# Get your python3 version
$ python3 --version
Python 3.6.9

# Find the lib that provides python bindings for opencv in your python 3.6 dist-packages.
# Note that depending on your setup you it may not be in /usr/lib/ but may also be in /usr/local/lib/
$find /usr/lib/python3.6/dist-packages/ -name 'cv2*.so' 
/usr/lib/python3.6/dist-packages/cv2.old/python-3.6/cv2.cpython-36m-aarch64-linux-gnu.so

```

---

<div class="post-metadata">

**Author:** ![marwan.a.k.1997](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/marwan.a.k.1997/32/51759_2.png) [@marwan.a.k.1997](https://forums.developer.nvidia.com/u/marwan.a.k.1997)\
**Post date:** [June 3, 2021, 11:17pm UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/20 "2021-06-03T23:17:04Z")

</div>

The problem has been solved by reformatting the sd card and installing a new image. Also, before deleting the old image I noticed that a lot of OpenCV packages were installed outside python 3.6 or python 2 folders, not sure if that was the problem.  
Thanks all for helping me out, specially @Honey_Patouceul much appreciate your help.

---

<div class="post-metadata">

**Author:** ![nadeemm](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nadeemm/32/367020_2.png) [@nadeemm](https://forums.developer.nvidia.com/u/nadeemm)\
**Post date:** [October 15, 2021, 3:36am UTC](https://forums.developer.nvidia.com/t/opencv-error/178527/22 "2021-10-15T03:36:55Z")

</div>


