espressif / esp-dl

Espressif deep-learning library for AIoT applications
MIT License
539 stars 117 forks source link

Detect movement only (AIV-399) #7

Closed wdouglas1999 closed 2 years ago

wdouglas1999 commented 5 years ago

Good day, I use a PIR sensor to detect movement , but i receive many false triggers. I would like to know if there is a way to use your code to be able to compare consecutive images to confirm movement. I do not require facial recognition. Is there any library I could use with documentation available? Thank you.

XiaochaoGONG commented 4 years ago

Hi sorry for late responding. Did you find the solution ? For motion detection, you can use a very simple method that compare two consecutive images to find the region.

wdouglas1999 commented 4 years ago

Hi, thank you for your reply. No, I did not find a solution. Do you have any example I may use? Thank you.

XiaochaoGONG commented 4 years ago

Not now, but in recent days, we will give a simple example.

xgarb commented 4 years ago

Could you keep looking for movement for a set time to see if it's not a false trigger? Something like this where the device is woken by a PIR input and then checks 3 seconds later to see if the input is still triggering. You could do it in a loop and exit if the PIR goes low. You need a sensor that doesn't keep the input high too long after movement is detected.

 unsigned long timer_millis = millis();
  while (millis() - timer_millis < 3000) { //Test for movement for 3 seconds after warning
    if (digitalRead(PIR_PIN)) { // If still movement...
      do_something();
    }
 }

(full example: https://robotzero.one/ttgo-security-camera-pir/ )

Or did you want to check for the presence of a face after movement is detected? There's code here that might help: https://robotzero.one/unlock-door-face-detection-sonoff/

yehangyang commented 2 years ago

Hi @wdouglas1999,

Is your problem solved?

wdouglas1999 commented 2 years ago

Hi, I have not yet solved this issue due to time constraints. However I have seen an Arduino based project focusing on this type of movement detection using various methods. I was looking for something I could use in IDF environment though. This is the link to the project I mentioned. https://eloquentarduino.github.io/2020/01/motion-detection-with-esp32-cam-only-arduino-version/

yehangyang commented 2 years ago

Hi @wdouglas1999,

Please check this API get_moving_point_number() in ESP-DL.

I hope this can meet your requirement.

wdouglas1999 commented 2 years ago

Very interesting, I will look into it for sure. Thank you.

yehangyang commented 2 years ago

Hi @wdouglas1999 ,

We'll provide an example in ESP-WHO later.

BenDix62 commented 4 months ago

Hey, I am looking into detecting movement as well. The Function get_moving_point_number() is very well explained, but I dont seem to find where the source code is. Can someone point me into the right direction? Thank you in advance