Programming a Pi to Deter Cats: Part 9

Good Morning from my Robotics Lab! This is Shadow 8472, and today, I feel like I’m progressing in a non-linear fashion. Let’s get started!

Last week, I cleaned up my code by moving the bits I still wanted over from one .py file to another. My goal for this week was to distinguish between objects moving in the foreground and a stationary, but adaptive background.

My progress this week doesn’t feel quite so linear. I got about half way to my stated goal on my own while working with a premade background subtraction function, and ended up getting stuck on trying to find a way to monitor my own progress. I’d like to first see my foreground, preferably in color, then I’d like to see my present background so I can hopefully understand the algorithm better.

I went into the workshop for a little help, and things really went in a lot of odd directions after that. We spent a while chasing oddball, but not quite false, leads a couple big bugs. We downloaded and installed an IDE called Spyder3.

As an aside, I would just like to say, that IDE’s are both a curse and a blessing. They are a pain to get working correctly, especially if you’re working with anything outside the core language. But they make development easier, and they are a lot easier to use than a command line for new programmers, once again provided someone who knows what they are doing is setting it up or the programmer has ample amounts of both luck and determination.

Spyder took a lot of hassle to generate a few nuggets of debug gold, and it still is misbehaving. I plan on just using it as a nicer environment for coding, but I intend to use the command line for testing unless I need a closer look at my program’s state when it fails.

One of my big breakthroughs this week was finally realizing a mismatch between a list of list of lists and a list of lists (a 3D array and a 2D array). It looks like one of those bugs I had was about an improper use of a blur function. My current understanding is that it outputs a “color” frame even if it gets a grayscale input.

I eventually arrived at a grayscale, background-subtracted image with poorly defined edges. It seems to have a hard time with my purple shirt against another background.

My goal for next week is to stabilize the background subtraction with a smooth edges algorithm, and hopefully be able to draw boxes around objects.

Final Question: did you or would you rather learn programming with an IDE or with a command line?

Leave a Reply