Connect Intel Realsense with Python and OpenCV

Ғылым және технология

This video shows code that will allow you to show images from the Intel Realsense using OpenCV and Python.
Github code: github.com/nickredsox/youtube...
0:00 Introduction
0:15 Realsense overview
1:57 Install packages
2:25 Python coding
7:46 RGB and Depth images
8:23 CV2 Colormap
10:12 Grayscale manipulation
11:11 USB Error
#intelrealsense #opencv #python

Пікірлер: 38

  • @yusufsoyceken858
    @yusufsoyceken8587 ай бұрын

    The video was a quick and clear. Thanks!

  • @tangchuankai8801
    @tangchuankai88015 ай бұрын

    aboslutely great tutorial!

  • @ericsiasiewwei5227
    @ericsiasiewwei522711 ай бұрын

    Hello Nick, nice video! I wish to ask if it is possible to use Intel Realsense camera to perform face authentification? If yes, could you recommend where will be the best source to refer?

  • @EngineeringCorner

    @EngineeringCorner

    11 ай бұрын

    While I have never done something like that I believe you could use something like opencv face recognition. Maybe a haar cascade classifier or eigenfaces? Once you get the rgb image it is in a format you can use with open cv and manipulate it however you like.

  • @joel612
    @joel61211 ай бұрын

    Hi! Firstly, thank you so much for this video! If its not too much to ask, can you kindly make a tutorial on how to setup a region of interest with the depth camera? I use a D435i and I'm trying to figure out how to make the camera detect objects in the specified roi. I use masked-rcnn for object detection and depth estimation. I'd be grateful to you for this 😅

  • @EngineeringCorner

    @EngineeringCorner

    11 ай бұрын

    While I have performed object detection with a neural network in project I have never done this exactly. If I have an OpenCV frame then I start by just taking a selection of that frame. My video Loading and Displaying Images with Matplotlib (kzread.info/dash/bejne/q6qEmKp_qZnIaNI.html ) may(?) be a good starting point for how to reference areas of an image you have but ultimately you wants to extract the rows and columns of the image for your ROI

  • @noobymcleon880
    @noobymcleon8809 ай бұрын

    Great Video! Does the min depth decrease when you increase the resolution? Trying this code now, and its seems the min depth is about 40 cm

  • @EngineeringCorner

    @EngineeringCorner

    9 ай бұрын

    I do think certain factors matter. But haven’t looked at it in a while. I would start here dev.intelrealsense.com/docs/tuning-depth-cameras-for-best-performance . 40 seems I bit high. I think my min depth was around 30cm. It is also going to be dependent on the actual depth sensor model you are using.

  • @jazzysehgal7543
    @jazzysehgal7543 Жыл бұрын

    Hey Man, are you using this on Jetson nano? because this pip pyrealsense2 install don't work with my jetson nano running 18.04 OS image. It gives the following error: ERROR: Could not find a version that satisfies the requirement pyrealsense2 (from versions: none) ERROR: No matching distribution found for pyrealsense2

  • @EngineeringCorner

    @EngineeringCorner

    Жыл бұрын

    I haven’t used the jetson nano. But it sounds like you are using a version of python that doesn’t have pyrealsense2 yet. I think pyrealsense2 only is supported from python3.6 to python 3.10 right now.

  • @jazzysehgal7543

    @jazzysehgal7543

    Жыл бұрын

    ​@@EngineeringCorner Thanks, What linux version your using 18.04? would this camera work with ROS Noetic Ninjemys ?

  • @EngineeringCorner

    @EngineeringCorner

    Жыл бұрын

    @@jazzysehgal7543 Ubuntu 22.04 and I use ros2 humble. I have a video up already on how to interface with ros2

  • @miguelangelavila7247
    @miguelangelavila7247 Жыл бұрын

    Hello, I hope you are very well, I would like to know if you have a code that can calculate the sizes of 3d objects in boxes specifically through these cameras.

  • @EngineeringCorner

    @EngineeringCorner

    Жыл бұрын

    I don’t have specific code to do that. Depending on your specific application it can e a tricky problem. If your application looks at a constant space you might be able to use solvepnp and create a calibrated volume around the area the object would be in

  • @laracuevas5433
    @laracuevas54335 ай бұрын

    hi! I am trying to install the pyrealsense2 on my VisualCode Studio with Python 3.12.0 but the following messages appear: ERROR: Could not find a version that satisfies the requirement pyrealsense2 (from versions: none) ERROR: No matching distribution found for pyrealsense2

  • @EngineeringCorner

    @EngineeringCorner

    5 ай бұрын

    It means that pyrealsense is not available for your version of python. On Pypi it says the highest version of python supported is 3.11

  • @EngineeringCorner

    @EngineeringCorner

    5 ай бұрын

    Also From reading their GitHub it seems like that release should be soon github.com/IntelRealSense/librealsense/issues/12601

  • @b-lifestyle7263
    @b-lifestyle72633 ай бұрын

    Hi! Thanks a lot for ur tutorial. I wanna ask the question. When I try to split the code into piece like this: on bash, python3 => Import pyrealsense2 as rs => rs.pipline() and it gets an error "AttributeError: module 'pyrealsense2' has no attribute 'pipline'". But I have already succeed when running on a file. What is difference between these two ways to run this code?

  • @EngineeringCorner

    @EngineeringCorner

    3 ай бұрын

    From your comment spelling. Is it pipeline not pipline?

  • @b-lifestyle7263

    @b-lifestyle7263

    2 ай бұрын

    Thanks for ur help. However, I had a problem. Hope you can check! I checked the connected USB and this is the result Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 004: ID 0000:3825 USB OPTICAL MOUSE Bus 001 Device 003: ID 2a7a:938f CASUE USB KB Bus 001 Device 002: ID 0bda:8152 Realtek Semiconductor Corp. RTL8152 Fast Ethernet Adapter Bus 001 Device 006: ID 8086:0b64 Intel Corp. Intel(R) RealSense(TM) 515 Bus 001 Device 005: ID 0bda:0161 Realtek Semiconductor Corp. Mass Storage Device Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub But I tried to run this code above and got an error: ``` pipe.start(cfg) ``` RuntimeError: No device connected So may I need to set up something else for it to work?@@EngineeringCorner

  • @EngineeringCorner

    @EngineeringCorner

    2 ай бұрын

    @@b-lifestyle7263 Tough to say exactly what it is. Does pipe.start() work without using any of the config options work? Are you able to see the camera with the realsense viewer sdk (google for the link)? Are you using pip or conda to install? There are quite a few github issues that you can start to work through that seem to have similar problems but it probably depends on your exact setup

  • @savannahpear1235
    @savannahpear12353 ай бұрын

    Hi! Thanks for the vid. I keep getting the error: ImportError: failed to enable the udev monitor, which is weird because the Realsense viewer is working. When I run it again, I get ImportError: generic_type: type "notification_category" is already registered! Any idea how to fix these issues??

  • @EngineeringCorner

    @EngineeringCorner

    3 ай бұрын

    Hmm not sure I have come across that particular error. If I come across anything will pass it on

  • @biginchi140
    @biginchi1404 ай бұрын

    Is there any method to save the stream as .bag file ive been searching for a solution I haven't found any ... would be great

  • @EngineeringCorner

    @EngineeringCorner

    4 ай бұрын

    Have never tried to do that. Not sure if you have ever come across this github.com/IntelRealSense/librealsense/issues/3671 but might be a place to start

  • @biginchi140

    @biginchi140

    4 ай бұрын

    thank you this is perfect @@EngineeringCorner

  • @user-vs1ep8kc9e
    @user-vs1ep8kc9e6 ай бұрын

    hay nick i tried this method but its not working can you help me with it?

  • @EngineeringCorner

    @EngineeringCorner

    5 ай бұрын

    Need more info about how it didn’t work

  • @Zane-pw8pw
    @Zane-pw8pw Жыл бұрын

    Wonder if I can do something similar with Unity

  • @EngineeringCorner

    @EngineeringCorner

    Жыл бұрын

    I have not tried but it looks like real sense has a Unity wrapper

  • @worakanlasudee2078
    @worakanlasudee20788 ай бұрын

    frame = pipe.wait_for_frames() RuntimeError: Frame didn't arrive within 5000

  • @EngineeringCorner

    @EngineeringCorner

    8 ай бұрын

    I have only got that error when I choose a resolution that the camera will not support. Download the Realsense SDK and see what resolutions are supported with your camera and cable

  • @ArshiyaShaheen

    @ArshiyaShaheen

    2 ай бұрын

    @@EngineeringCorner To fix this problem, how did you change the resolution?

  • @EngineeringCorner

    @EngineeringCorner

    2 ай бұрын

    @@ArshiyaShaheen The values in the cfg variable

  • @MuhammedKhalid--

    @MuhammedKhalid--

    Ай бұрын

    @@EngineeringCorner I have already used the values that my camera and cable support and still the same error. Any suggestions ?

  • @EngineeringCorner

    @EngineeringCorner

    Ай бұрын

    @@MuhammedKhalid--are you using a usb 3.0 cable? Try downloading their viewer/sdk so you can eliminate the python variable and see exactly what is supported

Келесі