Does size really matter?

Not letting myself be stopped by the insufferable toe detection, I decided to check the paw size for each dog. Because as you could see in large dogs, the toe’s are larger than the area it’s trying to allocate a toe in, thus it recognizes some toes twice (especially the heel).

Nice mess of the toe detection

As you can see, the nail of the toe near 10,2 is outside the 2×2 area of the toe, just as the oval shape of the heel stretches from 2:5,2:10, clearly larger than 2×2 I’d say!

Average pressure for each paw

These are the graphs of almost every dog, where the paw size (on the y-axis in cm^2) is plotted over time (seconds). There is a large difference in paw size, as some reach maximums of around 40 cm^2, others barely reach 15. That’s less than half the size! Granted, there are 5 weight categories included in this study, ranging from below 5kg up to 50 kg, so large differences are to be expected.

But what it does mean is that choosing hardcoded, arbitrary values like 2×2 are very, very bad! Note to self: next time, try to gather this kind of info before you start to solve these problems.

Anyway, so I decided to tweak the peak detection code to try and change the size of the areas it looks for toes in.

neighborhood = generate_binary_structure(2,2)

Gives as a results: 2x2 binary structure

Funny, I thought 2,2 meant I an array that was sized 2×2. However, as I learned the other day, this probably has to do with Python indexing, so never mind. Ok let’s try:

neighborhood = generate_binary_structure(3,3)

3x3 binary structure

Hmmm, ok! I learn something new every day it seems! Fed up with not understanding what I was doing, I went to and look up what the function actually does. Turns out there’s a nice little note explaining what I was doing wrong:

generate_binary_structure can only create structuring elements with dimensions equal to 3, i.e. minimal dimensions. For larger structuring elements, that are useful e.g. for eroding large objects, one may either use iterate_structure, or create directly custom arrays with numpy functions such as numpy.ones.

So basically, if I wanted any other shape than I was currently using, I might as well make one myself! Well, then I guess it’s back to the drawing board and figure out what to put in here. I’ll keep you posted and if anyone has any suggestions: leave a comment!