Thanks Scott. I kept working on it and now have even more questions:
If I understand correctly, the lut evaluation happens in file rls_m0.c line 330:
@LDRB r1, [r2, r5] // load lut val@
r5 contains an index made from the red-minus-green and blue-minus-green pixel values in the code above line 330.
Is this really the relevant code? I’m confused because I tried changing the code in rls_m0.c, but it didn’t seem to have an effect on the way Pixy recognizes objects. Concretely, I tried changing line 234 from @SUBS r3, r4@ to @ADDS r3, r4@ and line 323 from @SUBS r6, r5@ to @ADDS r6, r5@, with the goal to change the color space that the lut cares about from a hue-only space to a luminace-only space. I compiled everything as described here: http://cmucam.org/boards/9/topics/3191. However, despite the changes in rls_m0.c, teaching Pixy new color signatures worked just as usual. I also tried some other changes to rls_m0.c, with the same lack of effects. If this isn’t the place where the lut is evaluated, where is it then? It would be great if you could point me directly to the lines of code.
I made another confusing observation when I changed colorlut.cpp. As a test, I messed with ColorLUT::add. When I did this, I couldn’t assign signatures in Pixymon anymore – the signature assignment was broken, as expected from my crude changes to the code. Confusingly, however, I could still teach Pixy new signatures when I used the hardware button on the Pixy board, rather than Pixymon. That worked just as if I hadn’t changed the firmware. To check if I was modifying the right code, I used cprintf in ColorLUT::add to print a confirmation to Pixymon. The confusing thing is that the confirmation was always printed when I tried teaching a new signature, no matter whether I did it through Pixymon or using the Pixy hardware button. So my modified ColorLUT::add code was executed in both cases, but didn’t actually seem to affect the m_lut when I used the Pixy hardware button.
So, in summary, I have the following questions:
Where (line of code) is m_lut evaluated to assign a signature to a freshly sampled image pixel?
What happens when I use Pixymon rather than Pixy’s hardware button to teach signatures? Is different image processing code used when Pixy is connected to Pixymon?
My first-pass idea for implementing luminance-based object detection is to simply change the definitions @u = red-green@ and @v = blue-green@ to @u = red+green@ and @v = blue+green@. It might not be perfect but the simplest approach I can think of. Could you point me to the functions I have to change to make that happen? I thought all I need to change is some parts of colorlut.cpp and the m_lut evaluation in rls_m0.c, but what I tried (see above) didn’t work. I’m sure it would be easy for someone familiar with the code to give me an outline of what I have to do, and save me days or weeks of trial and error.
Thanks,
Matt