Items with no label
3335 Discussions

Detect approaching things

DCunn2
Beginner
1,911 Views

I'm trying to make a Warning System which tells the User that there is something coming in the direction to the Camera.

So if something or somebody is approaching and only 1-2 meters in front, i want to tell it the User. Camera direction is rear facing.

Now i don't really now how to implement this. May you please give me ideas on how i could do this ?

Thanks in advance,

David

0 Kudos
9 Replies
MartyG
Honored Contributor III
437 Views

This reminds me of a project called SAW that some Intel employees were doing with RealSense a couple of years ago. It was designed for vision-impaired users. Vibration pads were attached to parts of the body, and when something approached a certain point of the body, the appropriate pad vibrated to warn the wearer of imminent collision.

https://software.intel.com/en-us/spatial-awareness-wearable Spatial Awareness Wearable | Intel® Software

Edit: I dug out the link to a long piece I wrote to the SAW team at the time, offering them my thoughts on the subject.

https://software.intel.com/en-us/forums/realsense-saw/topic/593558 SAW - my first thoughts

0 Kudos
DCunn2
Beginner
437 Views

Thanks for the quick responses !

This project looks really promising. I will take a look at it. Thank you Marty!

0 Kudos
jb455
Valued Contributor II
437 Views

A simple way would be to average out all the depth values for each frame and track when the average distance starts decreasing.

If you want to make it more complex you could use face/hand/person/blob tracking so only the tracked areas of the image are used for the depth calculations.

0 Kudos
DCunn2
Beginner
437 Views

I forgot to mention that the User is moving, so i guess the tracking would be to complex.

Taking out the average depth sounds good. Can you give me an insight on how i could do this?

I'm developing with Unity and C# . I guess i need to do this in the DrawImages method.

0 Kudos
jb455
Valued Contributor II
437 Views

Use https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?acquireaccess_pxcimage.html AcquireAccess on the depth image, then https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?toshortarray_imagedata_pxcmimage.html ToShortArray on the outputted image data, then finally just sum up all the values in that array (you may want to exclude zeroes) and divide by the number of elements, and check if the result is bigger or smaller than last time. (Also don't forget to use https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?acquireaccess_pxcimage.html ReleaseAccess to avoid memory leaks)

0 Kudos
MKank1
Novice
437 Views

If I am using C++ is there another method to use instead of "ToshortArray" or will it work if I manually create an array to hold the data?

0 Kudos
jb455
Valued Contributor II
437 Views

I believe you either need to alter the values the pointers are directing you to directly or use memcpy in C++. You can find some examples http://https//www.google.co.uk/search?q=realsense+memcpy&rlz=1C1MSNA_enGB635GB635&oq=realsense+memcpy&aqs=chrome..69i57.2629j0j7&sourceid=chrome&ie=UTF-8# q=realsense+memcpy+site:software.intel.com here.

0 Kudos
MKank1
Novice
437 Views

Yup, i will have a go thanks. Also could you see if there is a problem with the link you just posted? It gives me a "Site cannot be reached" error.

0 Kudos
jb455
Valued Contributor II
437 Views

Yeah, not sure what's happened there. I just googled "realsense memcpy site:software.intel.com" (no quotes)!

0 Kudos
Reply