Using OpenCV To Catch A Hungry Thief

Rory, the star of the show

[Scott] has a neat little closet in his carport that acts as a shelter and rest area for their outdoor cat, Rory. She has a bed and food and water, so when she’s outside on an adventure she has a place to eat and drink and nap in case her humans aren’t available to let her back in. However, [Scott] recently noticed that they seemed to be going through a lot of food, and they couldn’t figure out where it was going. Kitty wasn’t growing a potbelly, so something else was eating the food.

So [Scott] rolled up his sleeves and hacked together an OpenCV project with a FLIR Boson to try and catch the thief. To reduce the amount of footage to go through, the system would only capture video when it detected movement or a large change in the scene. It would then take snapshots, timestamp them, and optionally record a feed of the video. [Scott] originally started writing the system in Python, but it couldn’t keep up and was causing frames to be dropped when motion was detected. Eventually, he re-wrote the prototype in C++ which of course resulted in much better performance!

It didn’t take long to nab the thief — actually, thieves! It seemed quite a few different local animals had discovered Rory’s shelter and were helping themselves to her food. How rude! The first night detected a few different visitors. First, Rory’s local “boyfriend” stopped by to have a snack. Then within half an hour, an opossum (or possibly a small raccoon?) scarfed down what food was left. And within fifteen minutes of that visitor, a raccoon stopped by and was disappointed all the food was gone. Then, early in the morning. Rory arrives and is aghast that all her food is missing — again!

Rory’s “boyfriend” is the first thief to drop by

After analyzing all the footage, the solution, for now, is to feed Rory wet food twice a day and put just a little bit of kibble in her closet bowl in the morning for her to snack on throughout the day. In the future, [Scott] might use an RFID door to keep others out (though raccoons can be very smart and might be able to rip the door open), or possibly even something as simple as a magnetic collar and a Hall effect sensor to open the door or dispense food. Either way, the important thing is Rory is a happy cat and OpenCV rocks!

17 thoughts on “Using OpenCV To Catch A Hungry Thief

  1. I had to battle raccoons once trying to keep them out of food I was putting out for a stray cat I was trying to rescue. I finally figured out racoons can’t really jump gaps like a cat and can’t climb a pole if you wrap it in smooth metal. So my solution was to put the food on a platform with a sheet metal skirt on a pole and then rig up a way for anything wanting to get to the platform having to jump a three foot gap. I watched a recording of the coons trying to figure it out, but I finally beat them at the game.

    1. My outdoor boy cuddles up with the raccoons once it get cold. I make sure there is enough food for him and a bit extra, and it works ok. He also hunts (he is still kind of feral,and has no real interest in moving inside, after two years) so it all works out. His raccoon buddies are pretty chill, and help protect the space from the neighbors dog (70KG or so of untrained, junkyard dog) that roams free, so if he’s happy, I go with it.

      Fortunately, the squirrels don’t much care for cat kibble.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.