Identify and Measure precisely Objects distance | with Deep Learning and Intel RealSense

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 มิ.ย. 2021
  • Source code and files: pysource.com/2021/06/24/ident...
    This tutorial will teach you how to accurately detect the distance of Multiple Objects by using Opencv, Python, Deep Learning and the Intel RealSense d435i depth camera.
    ➤ Full Video courses:
    Object Detection: pysource.com/object-detection...
    ➤ Follow me on:
    Instagram: / pysource7
    LinkedIn: / pysource
    ➤ For business inquiries:
    pysource.com/contact
    #opencv #intelrealsense #distance
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 103

  • @xinwenzhang4150
    @xinwenzhang4150 2 ปีที่แล้ว

    A really wonderful video, I got a lot from video. Thanks!!

  • @md.ashrafulalam1401
    @md.ashrafulalam1401 ปีที่แล้ว

    I just love your videos and explanation :)

  • @sermadreda399
    @sermadreda399 ปีที่แล้ว

    Great video ,thank you for sharing

  • @MatheusSilva-qm3ph
    @MatheusSilva-qm3ph 3 ปีที่แล้ว

    I like this program......👍👏

  • @labradoodlesilver3756
    @labradoodlesilver3756 ปีที่แล้ว +1

    I'm gona use this for FRC

  • @marosmartin7762
    @marosmartin7762 3 ปีที่แล้ว

    Great video!

  • @murtazasworkshop
    @murtazasworkshop 3 ปีที่แล้ว +8

    Nice Example

    • @pysource-com
      @pysource-com  3 ปีที่แล้ว

      Thank you

    • @ayushroy6208
      @ayushroy6208 2 ปีที่แล้ว

      TH-camr acknowledge another fellow TH-camr.... Nice work.... Kep growing both

    • @davisonyeoguzoro9232
      @davisonyeoguzoro9232 ปีที่แล้ว

      2 kings 👏🏽

  • @myhofficiel4612
    @myhofficiel4612 ปีที่แล้ว

    very useful video that explains efficiently how does this work

  • @5zigen371
    @5zigen371 ปีที่แล้ว +1

    Hello Sir,
    I'm trying to send through http the depth video flux (my idea is to send RGB + depth flux to another machine which process everything) but when i try to send it, as every value is on a uint16 i have to convert it to uint8 if i want to send something otherwise i receive a cut value (only the first 8 bit from 0 to 255 and the others bit from 65536 to 256 or cut) so have you ever try to do something like this?

  • @wahswolf88
    @wahswolf88 2 ปีที่แล้ว

    Excellent video, got me up to a basic understanding fast.

    • @wahswolf88
      @wahswolf88 2 ปีที่แล้ว

      Buying the complete courses was an easy decision.

  • @AiPhile
    @AiPhile 3 ปีที่แล้ว +3

    That's great sir. ♥️
    I have also measured the distance from object to camera 📷 using simple webcam, just by detecting face and estimated distance.

    • @pysource-com
      @pysource-com  3 ปีที่แล้ว +1

      Good workaround. If you have a face actually by detecting the size of the iris you can get an accurate distance detection.

    • @AiPhile
      @AiPhile 3 ปีที่แล้ว +1

      @@pysource-com thank you so much sir ♥️. I will try to that as well.
      I must appreciate your efforts first, I learned a lot from this channel,

  • @bitsecosmos
    @bitsecosmos ปีที่แล้ว

    Great video! I would like to know how to use the mask extracted from Yolact to measure wear on a metallic surface, can you help me on this path?

  • @niranjansujay8487
    @niranjansujay8487 2 ปีที่แล้ว

    Hi @pysource, I have some doubts is it possible to get all the three parameters of an object in real-time similar to how you got distance information, I want to know the height, width, and thickness(length) of a detected object in 3d space using an intel realsense camera. Can you help me with this? currently, I am using YOLOv3/4/5 for object detection (I mean I know all the three) so ever you're okay with the W*H*L information.

  • @trongatbui967
    @trongatbui967 ปีที่แล้ว

    Thank you very much. May I ask how to accelarate the program with CUDA/CUDNN on Ubuntu? It seem that I cannot run the makrcnn detection in GPU although my laptop has an GPU.
    Hope to see you answer

  • @mohamadn6116
    @mohamadn6116 2 ปีที่แล้ว +1

    Thanks for the video. I like your channel a lot! 2 questions please: 1) How can I measure the size of an object using a D455, and 2) How would I measure the distance between two objects/points in 3D space? Thanks!

    • @camdennagg6419
      @camdennagg6419 2 ปีที่แล้ว

      you can try using the pixel distance between the two and scaling that

    • @camdennagg6419
      @camdennagg6419 2 ปีที่แล้ว

      and then use trig to find the actual distance since you know the depth of both objects

  • @rashidabbasi6035
    @rashidabbasi6035 3 ปีที่แล้ว

    please some model you run , like liDar based detection, tracking, segmentation, and compression ..please make video on this , i am looking forward ....

  • @BharathKumarThota-eg8jc
    @BharathKumarThota-eg8jc 10 หลายเดือนก่อน

    Great Contents, can you let me know how to increase the speed of the detections or frames. i have cuda installed in my laptop and for yolo its working fine . But for this i am facing issue.

  • @hassanyoussef2960
    @hassanyoussef2960 3 หลายเดือนก่อน

    i´m seaking you guidence please. I just started with lidar and point cloud. i want to use them to locate object from a shelf( or for a exaple from a supermarket shelf) and grab them with a robot. what are the steps that i need to perform a such task. I need from the camera the location of the Object and the i have to pass this information to the robot... right?

  • @gulagprescription9993
    @gulagprescription9993 8 หลายเดือนก่อน

    Cool

  • @somusundram1823
    @somusundram1823 3 ปีที่แล้ว +1

    Nice one. Just curios. Have you tried to measure the object size using mask-rcnn? Will it able to detect shape of an object (For example : In my case i am interested to know whether it can detect card boxes , like the one from couriers)
    I never worked in mask-rcnn due to time constraint. I have used depth image of RealSense to find object shapes but i rather like to have a reliable method like rcnn or YoLo to do it on various condition.

    • @pysource-com
      @pysource-com  3 ปีที่แล้ว +2

      If you train properly mask-rcnn it will get the shape of the Object.
      If you know the distance and the shape you can then also calculate the area and size of the object with a good accuracy.

    • @mohamadn6116
      @mohamadn6116 2 ปีที่แล้ว

      @@pysource-com Can you please elaborate more how to do that? If we know the distance and assuming the shape is a rectangle, how can I calculate the size of the rectangle?

    • @user-qh5wj2cf5c
      @user-qh5wj2cf5c 2 ปีที่แล้ว

      @@mohamadn6116 Good question. I explore it as well and still haven't found a method to find the size of the object when the distance to it is known. Maybe someone knows?

  • @mertolojis
    @mertolojis 3 ปีที่แล้ว

    How can I use the distance algorithm with my own detection algorithm?

  • @muhammadtalhaejaz4115
    @muhammadtalhaejaz4115 ปีที่แล้ว

    can you tell me what version of opencv you used?

  • @enesschebbaki1226
    @enesschebbaki1226 6 หลายเดือนก่อน

    is it possible to achieve the same result by using depth display and not RGB (colour stream) as in this case?

  • @hassanyoussef2960
    @hassanyoussef2960 6 หลายเดือนก่อน

    hi thanks for the great explanation. i´m having problem with frozen_interface_graph_coco.pb for some how it´s not been read by my computer and i can´t open it, so when i want to write mrcnn = maskRCNN i´m getting error. what do you recommend me to do?

  • @AndreiHirata
    @AndreiHirata 2 ปีที่แล้ว

    Whats is the best camera for do a ArSarndBOX?

  • @user-gh6wt4wf5k
    @user-gh6wt4wf5k 2 ปีที่แล้ว

    If I use intel SR300 can get same result?
    Or I should change other library

  • @kyteng
    @kyteng 2 ปีที่แล้ว

    Great video for distance measure.
    Is this possible to implement the same concept and use the Intel RealSense Depth Camera to check the smoothness/flatness for flat surfaces such as floor/ wall??

  • @pritammalusare7451
    @pritammalusare7451 2 ปีที่แล้ว

    hey Pysource
    thank you for these video. I want to implement same project on raspberry pi but real sense camera is much expensive. any other way??🙂

  • @user-pt1qf3ur4k
    @user-pt1qf3ur4k 2 ปีที่แล้ว

    Can i manage to make some contents realsense camera with "Unreal Engine" ? I've figured out it can be created with Unity, but there's is no information with UE4 :)

  • @sy2532
    @sy2532 8 หลายเดือนก่อน

    Can you show how to use CUDA libraries for OpenCV for this project?

  • @user-qs1ne9qb3o
    @user-qs1ne9qb3o ปีที่แล้ว

    How to get the IMU readings from the inbuilt IMU in D455

  • @redhwanalgabri7281
    @redhwanalgabri7281 ปีที่แล้ว

    How to measure the accuracy of distance from the object to the camera?

  • @petersobotta3601
    @petersobotta3601 3 ปีที่แล้ว

    Will this work on a Jetson Nano? .. any chance of a tutorial on that if it does? Great Channel, keep up the awesome work!

    • @pysource-com
      @pysource-com  3 ปีที่แล้ว

      Nope, you will need at least a Jetson Xavier to make this work, plus you will need a lighter segmentation algorithm.
      On jetson nano I would go with YOLO l realsense + Int(instead of Mask rcnn)

    • @petersobotta3601
      @petersobotta3601 3 ปีที่แล้ว

      ​@@pysource-com​ Shame, the Nano is a great device for giving most of your CV tutorial stuff a try. Thanks for the reply👍

  • @richubini2129
    @richubini2129 ปีที่แล้ว

    what if the rgb frame and the depth frame is having different resolution

  • @user-te5lu7oe6c
    @user-te5lu7oe6c 3 ปีที่แล้ว

    hello
    Its a great project.
    Can you please, illustrate which cv2 library or any other technique should I use to make the center stable and the depth accurate ? or a hint to figure out by my self.
    Thank you Sir.

    • @pysource-com
      @pysource-com  3 ปีที่แล้ว +1

      There are different approaches we could use, I'll give you a couple of tips:
      - either you try taking a bigger area instead of just 1 point at the center. You could take more points (like an area of 10x10 so 100 points) and get the average of them
      - or you should implement this with Object Tracking so that the bounding box would be stable following the object.

    • @user-te5lu7oe6c
      @user-te5lu7oe6c 3 ปีที่แล้ว

      Thank you so much

  • @namnguyenhoai8852
    @namnguyenhoai8852 2 ปีที่แล้ว +1

    why depth map is distance object to camera

  • @Fools00
    @Fools00 2 ปีที่แล้ว

    sir, thank you for your great video.
    and i have a question.
    can i apply the same code which you linked, for use Intel® RealSense™ Depth Camera SR305?

    • @pysource-com
      @pysource-com  2 ปีที่แล้ว

      I haven't personally tested that camera but most likely it should work with the same code

  • @jazzysehgal7543
    @jazzysehgal7543 ปีที่แล้ว

    hello,
    from realsense_camera import *
    for some reason this import don't work with my pyrealsense2 package

  • @user-ir6vi8vf5k
    @user-ir6vi8vf5k ปีที่แล้ว

    Can I run this on a Raspberry Pi or a Beaglebone by any chance?

  • @ShivangiKeshri-nb7wr
    @ShivangiKeshri-nb7wr ปีที่แล้ว

    i am not able to get the confirmation email link from your website and because of that i am not able to download the file that made to run this? please resolve this issue

  • @jordilopez9587
    @jordilopez9587 2 ปีที่แล้ว

    Hello Sergio it is posible this or code with Lidar R2000

  • @danielbell7483
    @danielbell7483 3 ปีที่แล้ว

    Great video. How would I measure the distance between two objects/points in 3D space?

    • @camdennagg6419
      @camdennagg6419 2 ปีที่แล้ว

      you can try using the pixel distance between the two and scaling that

    • @camdennagg6419
      @camdennagg6419 2 ปีที่แล้ว

      and then use trig to find the actual distance since you know the depth of both objects

    • @danielbell7483
      @danielbell7483 2 ปีที่แล้ว

      Thanks @@camdennagg6419 . In the end I used functions .get_depth_frame() and .get_distance() (in x and y) on aligned frames, then used trig.

    • @camdennagg6419
      @camdennagg6419 2 ปีที่แล้ว

      @@danielbell7483eyy nice job. It's nice when something works out haha.

  • @sohampadhye5408
    @sohampadhye5408 ปีที่แล้ว

    Can this work on D455?

  • @user-di4bu8hg3d
    @user-di4bu8hg3d 2 ปีที่แล้ว +1

    hi, how do I get frames from a file *.bag recorded with realsense??

  • @MuhammadBilal-jp5ye
    @MuhammadBilal-jp5ye 2 ปีที่แล้ว

    Great video , can we use the same technique using Pi camera?

    • @pysource-com
      @pysource-com  2 ปีที่แล้ว

      Nope, you need a Depth camera for this

  • @YigalBZ
    @YigalBZ 3 ปีที่แล้ว

    If I use a simple camera instead of the RealSense, can I still assess the distance with the following assumptions: 1) The camera location is fixed. 2) the object I am detecting is pre-known? I would think that in this case, the size of detected module can be translated into distance.

    • @pysource-com
      @pysource-com  3 ปีที่แล้ว +1

      Yes, a good way will be to use the Aruco marker.
      you can check this other video th-cam.com/video/lbgl2u6KrDU/w-d-xo.html
      you will learn how to get the size of the object and you can adapt it to take the distance

    • @YigalBZ
      @YigalBZ 3 ปีที่แล้ว

      @@pysource-com Thanks ! Such a simple solution.

  • @VirtualEducationLYF-dd1lh
    @VirtualEducationLYF-dd1lh 3 หลายเดือนก่อน

    i want to run this code in my laptop webcam what i do ,please tell

  • @talhaejaz7651
    @talhaejaz7651 ปีที่แล้ว

    From where I can find the files not the code?

  • @ZhifanSong
    @ZhifanSong ปีที่แล้ว

    i used both my personal and institution email account and i didnt receive any email so i cant download the files. is there a solution?

  • @jonparker8832
    @jonparker8832 2 ปีที่แล้ว +1

    im getting this error when i try to run
    C:\Users\Acer\AppData\Local\Microsoft\WindowsApps\python3.9.exe C:/test/measure_object_distance.py
    Loading Intel Realsense Camera
    Traceback (most recent call last):
    File "C:\test\measure_object_distance.py", line 7, in
    rs = RealsenseCamera()
    File "C:\test
    ealsense_camera.py", line 17, in __init__
    self.pipeline.start(config)
    RuntimeError: Couldn't resolve requests
    can someone help?

    • @rodrigodomingues8491
      @rodrigodomingues8491 2 ปีที่แล้ว +1

      Hi, I also got the same error and fixed it by changing the resolution of the camera in the realsense_camera.py
      config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)
      config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
      hope this helps

  • @liavbarnoy1237
    @liavbarnoy1237 2 ปีที่แล้ว

    Great video helped me a lot
    but I have trouble with installing pyrealsense2
    error: no matching distribution found for pyrealsense2
    I am using ubunto
    please help fix it

    • @pysource-com
      @pysource-com  2 ปีที่แล้ว

      I recommend to use python 3.8. And it should be on a Desktop computer, not Nvidia Jetsons or RAspberry as it's not available with pip install for them.

  • @rashidabbasi6035
    @rashidabbasi6035 3 ปีที่แล้ว

    Dear can you use Lidar camera to do this please ...

    • @pysource-com
      @pysource-com  3 ปีที่แล้ว

      I might do that with LIDAR in the future

    • @Jay1n9
      @Jay1n9 2 ปีที่แล้ว

      yes definetly, I tried it on Intel realsense L515

  • @aaryadeb893
    @aaryadeb893 2 ปีที่แล้ว

    How could we train the MaskRCNN on custom pictures or dataset

    • @pysource-com
      @pysource-com  2 ปีที่แล้ว +1

      you can do that by following this tutorial th-cam.com/video/WuvY0wJDl0k/w-d-xo.html

    • @chiryvan7095
      @chiryvan7095 2 ปีที่แล้ว

      @@pysource-com hi, thank you for your great video. How is the .h5 format model used in this project.

  • @TravelwithRasel.
    @TravelwithRasel. 2 หลายเดือนก่อน

    hi, can not download the code file

  • @hussamhaij6238
    @hussamhaij6238 2 ปีที่แล้ว

    Can these files be used for Intel realsense L515?

    • @pysource-com
      @pysource-com  2 ปีที่แล้ว

      They should work, as the library is the same for all the intel realsense cameras

    • @Jay1n9
      @Jay1n9 2 ปีที่แล้ว

      yes it works

  • @garceling
    @garceling 3 ปีที่แล้ว

    Can this work on the raspberry Pi too

    • @pysource-com
      @pysource-com  3 ปีที่แล้ว +1

      Nope, raspberry pi is too weak to handle object segmentation.
      On raspberry pi you could alternatively use Mobilenet object detection + Intel Realsense

    • @garceling
      @garceling 3 ปีที่แล้ว

      @@pysource-com any chance on releasing a tutorial on how to do this. LMAO i am stuck :( Thank you

  • @vishalrawat953
    @vishalrawat953 ปีที่แล้ว

    Bro i m not able to download source code

  • @olalekanisola8763
    @olalekanisola8763 3 ปีที่แล้ว +1

    Great tutorial, I tried running
    from realsense_camera import *
    rs = RealsenseCamera()
    but I get an error
    Traceback (most recent call last):
    File "C:/Users/owner/PycharmProjects/Yolo/yolo.py", line 4, in
    rs = RealsenseCamera()
    File "C:\Users\owner\PycharmProjects\Yolo
    ealsense_camera.py", line 19, in __init__
    self.pipeline.start(config)
    RuntimeError: Couldn't resolve requests

    • @user-mk5xs6tl8o
      @user-mk5xs6tl8o 3 ปีที่แล้ว +2

      realsense_camera.py Line 13
      config.enable_stream(rs.stream.color, 1280, 720, rs.format.bgr8, 30)
      config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 30)
      Replace them as below,
      config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)
      config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)

    • @olalekanisola8763
      @olalekanisola8763 3 ปีที่แล้ว

      ​@@user-mk5xs6tl8o wow, thank you so much @@user-mk5xs6tl8o, it works

    • @Jay1n9
      @Jay1n9 2 ปีที่แล้ว

      thanks

    • @jonparker8832
      @jonparker8832 2 ปีที่แล้ว +1

      how do you solve cant see the reply

    • @sean9734
      @sean9734 2 ปีที่แล้ว

      @@jonparker8832 HI, adjust resolution in following to (640, 480). This solved the problem in my case.
      config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)
      config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)

  • @jaeyounglee574
    @jaeyounglee574 2 ปีที่แล้ว

    Your example is not working. below is just working. What is difference? My enviroment is jupyter notebook of windows 10 with anaconda.
    --------------------------------------
    # Setup:
    pipe = rs.pipeline()
    cfg = rs.config()
    #cfg.enable_device_from_file("../object_detection.bag") 기존예제코드
    config = rs.config() # 추가한 코드
    config.enable_record_to_file('test.bag') # 추가한 코드
    profile = pipe.start(cfg)
    # Skip 5 first frames to give the Auto-Exposure time to adjust
    for x in range(5):
    pipe.wait_for_frames()

    # Store next frameset for later processing:
    frameset = pipe.wait_for_frames()
    color_frame = frameset.get_color_frame()
    depth_frame = frameset.get_depth_frame()
    # Cleanup:
    pipe.stop()
    print("Frames Captured")
    -----------------------------------