Coder Social home page Coder Social logo

thehapyone / nanocamera Goto Github PK

View Code? Open in Web Editor NEW
123.0 2.0 20.0 100 KB

A simple to use camera interface for the Jetson Nano for working with USB and CSI cameras in Python.

License: MIT License

Python 100.00%
jetson jetson-nano nvidia camera python csi-cameras camera-interface usb-cameras

nanocamera's People

Contributors

thehapyone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nanocamera's Issues

I can't get the RTSP stream to work

I'd like to stream my Jetson Nano's CSI camera over my network. The nanocamera program works and has very high quality feedback, but I'm having trouble with the RTSP example.

If I execute the RTSP example where I've changed my rtsp_location to the ip of my Jetson Nano, I get the following error:

<....>line 25, in <module> cv2.imshow("Video Frame", frame) cv2.error: OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/highgui/src/window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'

I'm not really sure what's happening with the opencv error. Very general.

Any pointers? I'm also completely new to RTSP streaming. Is there anything outside of the RTSP example I need to do other than changing

Getting warnings while trying to read rtsp url

I am getting the below warnings while trying to use the library. I am using it on JetsonNX.

[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module rtspsrc4 reported: Could not open resource for reading and writing.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

Any idea on resolving them

Illegal instruction (core dumped)

After successfully installing your application on my Jetson Nano 2GB whenever I attempt to import the application I get this result: Illegal instruction (core dumped)

  • OS: Ubuntu 18.04 (Jetpack 4.5)
  • Device: Jetson Nano 2GB

CSI camera - snapshot issue

Hello,

I have a project which is the following:
On a jeston Nano, I have a CSI camera. I want to take one picture every 5s from this cam , and then evaluate this picture in a tensorflow model.
The tensorflow part is working without problem if I use pictures on the disk.
The problem is to get one picture every 5 seconds.

I just create this simple piece of code:

cam=nano.Camera(flip=0, width=640, height=480, fps=30)

while True:	
	image = cam.read()
	cv2.imshow("image",image)
	cv2.waitKey(5000)

	if cv2.waitKey(1) & 0xFF == ord(' '):
		break
cap.release()
cv2.destroyAllWindows()

The problem is that, the delay between 2 pictures is really longer than 5s, it seems that the system is laging.
And when I'm sending the picture to the model, it seems that the evaluation is done correctly. Only the display in cv2.imshow seems to have a problem.
Any idea on this issue?

Thanks

CSI Camera Never Ready

Describe the bug
CSI Camera never ready. Tested with the python example and always shows CSI Camera Ready? - False

To Reproduce

import cv2
#from nanocamera.NanoCam import Camera
import nanocamera as nano

if __name__ == '__main__':
    # Create the Camera instance
    camera = nano.Camera(flip=0, width=1280, height=800, fps=30)
    print('CSI Camera ready? - ', camera.isReady())
    while camera.isReady():
        try:
            # read the camera image
            frame = camera.read()
            # display the frame
            cv2.imshow("Video Frame", frame)
            if cv2.waitKey(25) & 0xFF == ord('q'):
                break
        except KeyboardInterrupt:
            break

    # close the camera instance
    camera.release()

    # remove camera object
    del camera

Desktop (please complete the following information):
Standard Jetson Nano SDK - Jetpack 4.4

Additional context
CSI Camera works fine using the nvgstcapture-1.0 command

Thread safe handling

HI .
Thanks for your work.

I have 3 threads that will consume the nanocamera read() method. to grab a frame

Is there known problem? also threadsafe is handled in library?

please advise.

NanoCamera issue with USB IMX219

Bug Description
I have been using your nanocamera repository for interfacing my USB camera(Arducam IMX219) with Jetson nano. I checked if my OpenCV is correctly installed. It is correctly installed.

To Reproduce
Steps to reproduce the behavior:

  1. Run and install setup.py
  2. go inside examples and run USB_camera .py. It shows an error.

Expected behavior

  1. Load the USB camera with the Jetson Nano
  2. It will read the camera image
  3. Display the camera frame

Screenshots
Screenshot from 2021-04-18 18-50-20 (1)

Desktop (please complete the following information):

  • OS: Jetson Nano Developer Kit-jp451

Camera does not initialyse with python 3.7.5

Hello,

I m able to initialize the camera when using python 3.6 but it's not working with python 3.7

The error code I get from camera.hasError(), is :

1 = Error: Could not initialize camera.

>>> import nanocamera as nano
>>> camera=nano.Camera(debug=True)
Traceback (most recent call last):
  File "/home/seller/.local/lib/python3.7/site-packages/nanocamera/NanoCam.py", line 163, in __open_csi
    raise RuntimeError()
RuntimeError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/seller/.local/lib/python3.7/site-packages/nanocamera/NanoCam.py", line 47, in __init__
    self.open()
  File "/home/seller/.local/lib/python3.7/site-packages/nanocamera/NanoCam.py", line 122, in open
    self.__open_csi()
  File "/home/seller/.local/lib/python3.7/site-packages/nanocamera/NanoCam.py", line 168, in __open_csi
    raise RuntimeError('Error: Could not initialize CSI camera.')
RuntimeError: Error: Could not initialize CSI camera.


usb cam can't adjust resolution

For the same USB camera, the following code is helpful to adjust the resolution. But the nanocamera can't.

capture = cv2.VideoCapture(3)

if capture.isOpened():
    capture.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
    capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.