Distance detection with Depth Camera (Intel Realsense d435i) - Opencv with Python tutorial

  Рет қаралды 84,122

Pysource

Pysource

Күн бұрын

source code and files: pysource.com/2...
In this video tutorial, we will see how to detect the distance using the Intel Realsense d435I camera.
The tutorial will be divided in two steps:
1. Get the frames from the depth camera
2. Distance detection on mouseover
➤ Full Video courses:
Object Detection: pysource.com/o...
➤ Follow me on:
Instagram: / pysource7
LinkedIn: / pysource
➤ For business inquiries:
pysource.com/c...
#opencv #intelrealsense #depthcamera

Пікірлер: 123
@nguyenmanhtuan629
@nguyenmanhtuan629 3 жыл бұрын
A great video. Hope to see your tutorials on how to work with point cloud from Depth Camera.
@MikeNewham
@MikeNewham 3 жыл бұрын
Great tuition. Good command of English.. Have Pixy2 camera here - so am on the lookout for scripts for that..
@pysource-com
@pysource-com 3 жыл бұрын
Thank you for the feedback. Unfortunately I don't have any experience with the Pixy camera, and at the moment it's not part of my plans to make any script for that.
@ycdcherokee
@ycdcherokee 3 жыл бұрын
you should better normalize the depth image between 0-255 for a better vision.
@335LINZ
@335LINZ 3 жыл бұрын
@ 12:46 to "filter" out zeros i added >> if distance == 0: continue
@mediocre7520
@mediocre7520 3 жыл бұрын
Could you please explain about the IMU in the intel realsense? How to get the values using python? How to calibrate the IMU?
@granatapfel6661
@granatapfel6661 Жыл бұрын
Combined with a bounding box it's a powerful detection with class and distance
@quentinjames981
@quentinjames981 3 жыл бұрын
More about filtering for more accurate readings please!
@westparezal
@westparezal 3 жыл бұрын
use Mean of a function and threshold
@user-mh8kb5ng9f
@user-mh8kb5ng9f 6 ай бұрын
I get it succeed by following this video you presented, it is super helpful. Thanks a lot !:)
@dafech_911
@dafech_911 2 ай бұрын
Hi Sergio. Thank you for your video. I have a question for you. Currently I don't have acces to the camera, but would be the case if we go out of the 2 meters value? Which value would I get? The maximum value, a random distance, 0, null-value? Also I wanted to remark the the link that you provided for the codes is no longer available. Thank you again for your great job explaining this.
@giorcks8416
@giorcks8416 2 ай бұрын
i think you shoudl have aligned the depth information with the RGB camera
@jaeyounglee574
@jaeyounglee574 2 жыл бұрын
ModuleNotFoundError: No module named 'realsense_depth' Jupyter notebook of anaconda, does not working?
@omerfarukpaker7551
@omerfarukpaker7551 Жыл бұрын
it is a python file that you can download from his blog. That's what i did and it worked
@omerfarukpaker7551
@omerfarukpaker7551 Жыл бұрын
Thanks ever so much! This tutorial was eye opening for me! :)
@nhatpham5797
@nhatpham5797 8 ай бұрын
Hello, can I use this camera with YOLOv8?
@christopherpalazzo9788
@christopherpalazzo9788 3 жыл бұрын
This is great, but arent the depth and RGB image not aligned. Won't this will lead to incorrect readings? Thanks!
@nghiaducduong
@nghiaducduong 5 ай бұрын
Have you found solution for this
@mohsen_azimi
@mohsen_azimi 3 жыл бұрын
Thank you, I tried your method; it seems that we need to scale the depth. I tried this piece of code and compared it with RealSense Viewer: depth_scale = depth_sensor.get_depth_scale() then, distance = depth_image[point[1], point[0]] * depth_scale * 1000
@ghostriley22
@ghostriley22 3 жыл бұрын
Yes this is required for correct distance in m Also realsense api comes with a function: zDepth = depth_frame.get_distance(int(x),int(y))
@purushottamarao1209
@purushottamarao1209 3 жыл бұрын
Nice video. When I am trying to initialize the camera using Depthcamera(), I am getting an error "RuntimeError: No device connected". Could u plz help in this?. Thanks in advance
@AkshajMusic
@AkshajMusic Жыл бұрын
How can I access my camera through Pycharm?
@andriidanylov9453
@andriidanylov9453 Ай бұрын
Thank You.
@bharathgm2572
@bharathgm2572 3 жыл бұрын
can you please explain how to find distance from Depth images
@YigalBZ
@YigalBZ 3 жыл бұрын
Good and clear video, as always. Thank you. I assume Raspberry pi will be too slow for that, right? I am looking into object detection and distance analysis of that object with RPI. What would you think? Do you plan on any video on that direction?
@pysource-com
@pysource-com 3 жыл бұрын
Hi, this is mostly a product which is used for commercial projects. - Raspberry pi is in generally too slow for object detection in real time even withouth distance analysis. - The distance analysis itself doesn't require much computational power, so this camera on the raspberry pi with the same script of this video, without object deteciton will perform well. I'll suggest that you look into the Opencv AI kit which fits better your purpose. I've a video about it , I recommend to watch that one kzbin.info/www/bejne/fnmtdYt7ZbuWd7s
@YigalBZ
@YigalBZ 3 жыл бұрын
@@pysource-com Currently I get 2.9 fps with tensorflow lite on RPI 4, with general set of objects to detect. I wonder what will be the change if I have only one object to detect (yes or no). I would need 10 fps at least. Perhaps I should dedicate old laptop for that target, instead of RPI, or even consider dedicated HW. I know there are several on market, including USB accelerators for PI.
@hamzaghnaim548
@hamzaghnaim548 3 жыл бұрын
hello there Sergio, I'm a fan of your tutorials and I have used many of them in my university project, I have a question, can I actually apply the same code you implemented in this video on my laptop's webcam ?, if not, what changes may I perform to get the work done, and I'll be thankful if you helped me with a method of getting the X and Y coordinates of a tracked object, Thank you sir
@pysource-com
@pysource-com 3 жыл бұрын
Hi, this tutorial is specifically for Depth Camera intel realsense d435i, so it won't work with a normal webcam.
@srishti-ai
@srishti-ai 3 жыл бұрын
@@pysource-com Can you make a tutorial on how to use laptop's webcam to do stereo vision projects?
@pysource-com
@pysource-com 3 жыл бұрын
@@srishti-ai It's not possible to do this with laptop webcams as they don't provide depth information.
@somusundram1823
@somusundram1823 3 жыл бұрын
Good one bro. Hope to see finding size of an object via depth tutorial. This is good one but i didn't see any calibration made.
@pysource-com
@pysource-com 3 жыл бұрын
Thanks for your feedback. A project about object measurement is already on my plans and it will come in the near future
@hadizanddizari3921
@hadizanddizari3921 2 жыл бұрын
@@pysource-com Thanks, have you done this project?
@cy5018
@cy5018 3 жыл бұрын
Pretty awesome sir. Could u please make a tutorial to show how to measure the depth of a crack using stereo-vision? Thank you in advance.
@mk-xx1vj
@mk-xx1vj 2 жыл бұрын
Hi dear Sergio, Firstly tank you for everything. Can we measure the width and height of these objects at the same time?
@YazeedAlkosai
@YazeedAlkosai 2 жыл бұрын
great video, how to measure the depth of the holes of the objects is it possible to use this camera to get precise holes diameter. thanks in advance
@roberttom6849
@roberttom6849 3 жыл бұрын
A great tutorial. Thanks.
@r.iyushofficial5318
@r.iyushofficial5318 3 жыл бұрын
Awesome
@MyOkman
@MyOkman 2 жыл бұрын
man, you are awesome !
@autonomousselfdrivingnonco8334
@autonomousselfdrivingnonco8334 3 жыл бұрын
Thats awesome...what can be done if we want to detect object and create bounding box using intel camera...can u share insights
@antonpomboamarelle3430
@antonpomboamarelle3430 3 жыл бұрын
Hi Sergio, I'm getting in a few problems that I can not solve. Every time I run the code I get these messages, "NameError:name 'DepthCamera' is not defined" and the other one "AttributeError: module 'pyrealsense2' has no attribute 'pipeline'. I downloaded the source code and files before this and also I'm in the Realsense_Depth folder with python, I re-checked the code but I don't know what is wrong. Please I will appreciate any help.
@pysource-com
@pysource-com 3 жыл бұрын
you should install correctly the pyrealsense2 module released by intel. Unfortunately I noticed that not on all systems the installation is easy, especially on raspberry/jetson
@maxbretschneider6521
@maxbretschneider6521 2 жыл бұрын
Great video, thanks a lot!
@aymenbenammar1292
@aymenbenammar1292 Жыл бұрын
Impressive work! can I use my phone's camera as depth camera ?
@MrSri331
@MrSri331 2 жыл бұрын
Thanks for the video. Does it work accurately on night or with out light? And curious if it works underwater?
@onlaynstudy8811
@onlaynstudy8811 2 жыл бұрын
thank you. In the next video please show detect fire //
@wezzzzzzzz
@wezzzzzzzz 3 жыл бұрын
that's really helpful Sergio, Can you advise me on how to get the X and Y coordinates as well? :)
@pysource-com
@pysource-com 3 жыл бұрын
X and Y coordinates are there already, stored on the variable point. x = point[0] y = point[1] and if you want to display them in realtime: cv2.putText(color_frame, "x: {}, y:{}".format(point[0], point[1]), (point[0], point[1] - 45), cv2.FONT_HERSHEY_PLAIN, 2, (0, 0, 0), 2)
@wezzzzzzzz
@wezzzzzzzz 3 жыл бұрын
@@pysource-com These X and Y are concerned with the streamed fames' pixels, not with the real distance in X and Y axes with respect to the camera origin (which is shown in the realsense viewer)
@kAlqamaRao
@kAlqamaRao 3 жыл бұрын
can you please tell something about the accuracy? how accurate are the results? I want accuracy at mm level, an error of 0.01 mm can be ignored, but more than that would be harmful, can you please recommend any sensor which will give accuracy of this level
@shahonwre5604
@shahonwre5604 2 жыл бұрын
me too i want that
@kAlqamaRao
@kAlqamaRao 2 жыл бұрын
@@shahonwre5604 there's a lot of noise in the depth given by Intel depth cameras, I would recommend azure Kinect depth camera here's a comparison between the two kzbin.info/www/bejne/jGPRmqChaZmah80 comparison
@shahonwre5604
@shahonwre5604 2 жыл бұрын
@@kAlqamaRao bro can you give me your email i have something i want talk about that with you
@xinwenzhang4150
@xinwenzhang4150 2 жыл бұрын
thanks! A nice video!
@Sony-wq4hs
@Sony-wq4hs 2 жыл бұрын
We can know asic temperature for depth images
@samchang4555
@samchang4555 3 жыл бұрын
Can I know why after apply a color map for the depth frame the depth shown is in array mode?
@abderrahmenmelliti9627
@abderrahmenmelliti9627 2 жыл бұрын
So normally we don't need to do a calibration right? what if I want to detect the Aruco code using this camera which normally requires a file created after doing the calibration what i should do? do you have an idea about that? and thank you
@payman_azari
@payman_azari 2 жыл бұрын
Does any one knows what is the depth resolution of the Realsense Cams in millimeters? (I need it to precisely scan face and ears)
@DilipKumar-dc2rx
@DilipKumar-dc2rx 2 жыл бұрын
Does it mean we can use Realsense camera instead of Radar/Lidar for Self Driving Car?
@saijasijsauiassiaj
@saijasijsauiassiaj Жыл бұрын
Hi Sergio! What is the best camera for computer vision, with a price of up to 1000 dollars?
@shenghuiwang1837
@shenghuiwang1837 3 ай бұрын
when I want to download the python files I can't register the website using my google account ,is there some that have download the python files successfully ,can someone help me to download files and send to me
@shahonwre5604
@shahonwre5604 2 жыл бұрын
kinect v2(one) have error 2cm in his depth accuracy and how much many error on his camera ?
@Kupgnd
@Kupgnd Жыл бұрын
Can you please help? I don't have any errors, but PyCharm does not open the camera.
@weistrass
@weistrass 10 ай бұрын
What about the distance between two given points?
@camdennagg6419
@camdennagg6419 2 жыл бұрын
I am trying this on a raspberry pi 4. After doing all of the setup...i get an error while attempting to run the downloaded program "AttributeError: module 'pyrealsense2' has no attribute 'pipeline'" Any ideas on how to fix this?
@godataprof
@godataprof 2 жыл бұрын
How did you install the pyrealsense? Am having issues on my MacBook. Thanks.
@vanshikajain6334
@vanshikajain6334 8 ай бұрын
i am not able to download the realsense depth file
@jazzysehgal7543
@jazzysehgal7543 Жыл бұрын
Hello, import realsense_depth import * This import don't work even though the pyrealsense2 had been installed successfuly on my linux 18.04 OS image PC Also, I am trying to use this camera with a CNC based pipetting robot. A CNC machine is utilized in Manufacturing robot where it understands G-cordinates (X, Y, Z) . The robot is fully controlled in Python environment. I can manually send G-coordinates to the robot. But, How can I use this camera to have object recognition and the robot goes to that object? Please help
@urvashimesariya1263
@urvashimesariya1263 Жыл бұрын
Hello, I am not able to get frame. It gives error as runtime error: frames = self.pipeline.wait_for_frames() RuntimeError: Frame didn't arrive within 5000. Kindly please help me with this.
@haseebahmed1726
@haseebahmed1726 3 жыл бұрын
Hi, do you know how to connect 2 intel realsense cameras with open cv?
@ahmetpehlivan5494
@ahmetpehlivan5494 2 жыл бұрын
so get_depth_frame() method returns distances 🤔
@N_Yayan_S
@N_Yayan_S 3 жыл бұрын
Awesome broo, tq
@LoFi_Beatz6
@LoFi_Beatz6 Жыл бұрын
can we apply the algorithm on an image
@amruthahp5411
@amruthahp5411 2 жыл бұрын
i am getting an error like this ModuleNotFoundError: No module named 'realsense_depth'
@i1r9e9n7e
@i1r9e9n7e 2 жыл бұрын
Hi! I was using Thonny to code with python, but i really liked your interface, can you please drop the software?
@pysource-com
@pysource-com 2 жыл бұрын
I'm using pycharm
@panosgaras7544
@panosgaras7544 3 жыл бұрын
how to programm the apple harvester woth open cv
@RacecarJ0hnny
@RacecarJ0hnny Жыл бұрын
Does this work outside for greater distances?
@bluehoney9874
@bluehoney9874 Жыл бұрын
Impressive! How much is the resolution of the measurement? Can it measure the size under 1cm?
@pysource-com
@pysource-com Жыл бұрын
According to Intels benchmarks the camera is supposed to detect from 0.3 to 3m with a depth margin error at around 2%
@joseantoniogarciaortiz4161
@joseantoniogarciaortiz4161 2 жыл бұрын
Hello! Thanks for your video, I have a question: how can I modify the minimun distance of range camera in the code. I get 0.5 m, but the features camera Intel Realsense L515 can 0.25m. Thanks!
@saarb4861
@saarb4861 2 жыл бұрын
Hey Jose I'm a student using a camera for a graduation project and I got a little confused with its activation. can you help me?
@joseantoniogarciaortiz4161
@joseantoniogarciaortiz4161 2 жыл бұрын
@@saarb4861 Hey Saar, what do you need?
@saarb4861
@saarb4861 2 жыл бұрын
May I have your discord/skype something like that?
@vighneshnkp6866
@vighneshnkp6866 2 жыл бұрын
Hi. Is it possible to determine the distance of an object from the camera in 3 Dimensions? Like the objects real time x,y and z coordinates? Could you do a video on that or send me any material to get started? Thanks.
@CamilaDiCarvalho
@CamilaDiCarvalho Жыл бұрын
Hi, did you manage to?
@vighneshnkp6866
@vighneshnkp6866 Жыл бұрын
@@CamilaDiCarvalho Hi. Yes I did. Not the most accurate but it solved my then problem statement.
@keyurborad8550
@keyurborad8550 3 жыл бұрын
RuntimeError Traceback (most recent call last) in 65 while True: 66 # Get frameset of color and depth ---> 67 frames = pipeline.wait_for_frames() 68 # frames.get_depth_frame() is a 640x360 depth image 69 RuntimeError: Frame didn't arrive within 5000 how to resolve this error?
@furkandursun6990
@furkandursun6990 3 жыл бұрын
Great video, does it measure correctly under water
@somusundram1823
@somusundram1823 3 жыл бұрын
With Stereo or PCL? Most probably you need to work out with serious distortions
@sumitpatnaik7057
@sumitpatnaik7057 3 жыл бұрын
Great video isn't oak better than intellisense
@pysource-com
@pysource-com 3 жыл бұрын
Generally speaking OAK is better than Intel Realsense camera, but I wouldn't put them on the same level as: - Oak is a kit (camera + cpu + framework) - Intel Realsense is a simple camera so both have their own pros and cons, depending on the project. I'll make a comparison video about them in the future
@sumitpatnaik7057
@sumitpatnaik7057 3 жыл бұрын
@@pysource-com thanks it would be great
@84mchel
@84mchel 3 жыл бұрын
awesome vid! are there ways with this code to make a collison avoidance version?
@pysource-com
@pysource-com 3 жыл бұрын
This code is pretty basic for collison avoidance, you will need to integrate it with object detection, and depth tracking of each single object on the 3d space
@asdfds6752
@asdfds6752 3 жыл бұрын
Sergio, how do you install pyrealsense2 with pip???? I always get an error "ERROR: Could not find a version that satisfies the requirement pyrealsense2 (from versions: none) ERROR: No matching distribution found for pyrealsense2". This on Windows, but similar errors in all the platform I have ever used, e.g. Jetson Nano etc
@pysource-com
@pysource-com 3 жыл бұрын
HI, the installation with pip works well on windows, at least I tried it with python 3.7, while it might not work for all the versions. I've used realsense with Jetson nano and raspberry pi as well, and for them the installation with pip doesn't work, but it's necessary to compile the library from scratch (as raspberry and jetson have an arm cpu, and there are no compiled versions for them). i might do a video tutorial about it in the future
@asdfds6752
@asdfds6752 3 жыл бұрын
@@pysource-com Hi, i have been trying to follow most tutorials online describing how to compile that library on raspberry and jetson, but without success. A step by step guide by You would be wonderful!!!
@asdfds6752
@asdfds6752 3 жыл бұрын
@@pysource-com comunque ci tengo a dirti che sei un grandissimo!!! Grazie mille per il tuo lavoro e per le tue spiegazioni sempre chiarissime!!!!
@pysource-com
@pysource-com 3 жыл бұрын
@@asdfds6752 ti ringrazio per il feedback :)
@pukatupukatam
@pukatupukatam 2 жыл бұрын
where did you get RealSense D435i from? Cannot locate it anywhere in e-commerce sites :)
@pysource-com
@pysource-com 2 жыл бұрын
Unfortunately intel shut down their production, so that's the reason why you can't find them on sales anymore. I recommend to look for OAK D devices, which seems to be the solution taking over now
@pukatupukatam
@pukatupukatam 2 жыл бұрын
@@pysource-com thank you so much! do you reckon OAK D are better than intel?
@pukatupukatam
@pukatupukatam 2 жыл бұрын
@@pysource-com maybe a little bit more description, what I aim to do is to turn a flat surface (with projector's image) into a touchscreen using such camera, so distance could be short, but I aim to have accuracy + fast response time from device.
@kenrampingplay
@kenrampingplay Жыл бұрын
Can you use this for object detection?
@pysource-com
@pysource-com Жыл бұрын
Yes, you can use this camera of course integrating this with Object Detection methods
@balajiezhumalai3786
@balajiezhumalai3786 2 жыл бұрын
Hi, is the camera directly attached to the computer?
@pysource-com
@pysource-com 2 жыл бұрын
Yes it is
@user-od6ev1yj5f
@user-od6ev1yj5f 3 жыл бұрын
Холи щит, 1.1т просмотров за 2 дня? Невероятно
@aminfirdaus3279
@aminfirdaus3279 2 жыл бұрын
is this person detection using yolo
@jaeyounglee574
@jaeyounglee574 2 жыл бұрын
Do not use this In ubuntu, below show ModuleNotFoundError: No module named 'realsense_depth'
@reemanjumaaali9784
@reemanjumaaali9784 2 жыл бұрын
Depth camera 415 the same way????
@pysource-com
@pysource-com 2 жыл бұрын
I haven't tested it with the 415, but most likely they work the same way as they all need the pyrealsense library
@yevgeniybondar7509
@yevgeniybondar7509 2 жыл бұрын
Get an affiliate link for the camera so you can make money from the sale
@kerron_
@kerron_ 2 жыл бұрын
can you post realsense_depth.py
@user-gh6wt4wf5k
@user-gh6wt4wf5k 2 жыл бұрын
Can I use the code on SR300?
@pysource-com
@pysource-com 2 жыл бұрын
it should work on the SR300 as well
@user-gh6wt4wf5k
@user-gh6wt4wf5k 2 жыл бұрын
@@pysource-com thank you I’m find the erron,my cv2 is. break
@benr3346
@benr3346 2 жыл бұрын
que pasa sergio !
@hoangtrieuviet6507
@hoangtrieuviet6507 2 жыл бұрын
Like
C++ Tutorial for Beginners - Learn C++ in 1 Hour
1:22:56
Programming with Mosh
Рет қаралды 4 МЛН
How to make advanced image recognition bots using python
15:01
Kian Brose
Рет қаралды 1,4 МЛН
I Took a LUNCHBAR OFF A Poster 🤯 #shorts
00:17
Wian
Рет қаралды 15 МЛН
Touching Act of Kindness Brings Hope to the Homeless #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 18 МЛН
这三姐弟太会藏了!#小丑#天使#路飞#家庭#搞笑
00:24
家庭搞笑日记
Рет қаралды 119 МЛН
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 14 МЛН
Depth Camera - Computerphile
12:34
Computerphile
Рет қаралды 248 М.
Object Tracking with Opencv and Python
30:03
Pysource
Рет қаралды 609 М.
Open-source SLAM with Intel RealSense depth cameras
27:40
Intel RealSense
Рет қаралды 80 М.
How to get your robot to see in 3D! (Depth Cameras in ROS)
23:21
Articulated Robotics
Рет қаралды 64 М.
[Realsense Comparisons] D455 v.s. D435
5:04
WalkWithMe
Рет қаралды 10 М.
Connect Intel Realsense with Python and OpenCV
13:21
Engineering Corner
Рет қаралды 15 М.
Auto-Measuring with OpenCV + Python - Try It Yourself
25:17
Clayton Darwin
Рет қаралды 85 М.
Sensor Showcase | Depth Cameras
4:34
Clearpath Robotics by Rockwell Automation
Рет қаралды 17 М.
I Took a LUNCHBAR OFF A Poster 🤯 #shorts
00:17
Wian
Рет қаралды 15 МЛН