1

From the following:

http://picamera.readthedocs.org/en/release-1.10/api_array.html?highlight=sad[1]

In PiMotionAnalysis, "The data-type of the array is an (x, y, sad) structure where x and y are signed 1-byte values, and sad is an unsigned 2-byte value representing the sum of absolute differences of the block." What does x and y represent?

  • I believe it is the x and y value of the macro block (row and column) counting left and down from the top left. – Steve Robillard Nov 27 '15 at 4:37
  • Why signed then? And I do get positive and negative values. The example of PiMotionAnalysis uses the sqrt of the sum of squares of x and y. I'm puzzled because I would use only sad as the difference between each frame, why x and y before? What do they represent? I only have questions... – rmarques Nov 27 '15 at 7:57
1

I think I may have cracked it! Oh what good 3 hours of sleep do to us.

x and y may be the displacement vector of a given macroblock in his coordinate. I found this because when printing a['x'] and moving a sheet of paper along the camera x axis in one direction showed a matrix with mostly positive values and when moving to the other direction the signs changed.

I think I can work with this.

  • Oh dear! My apologies - I didn't write that piece of documentation very well - I'll revisit it before the next release! – Dave Jones Nov 27 '15 at 22:37
  • And just to confirm, yes it is indeed the vector displacement – Dave Jones Nov 27 '15 at 22:37
  • Thank you! I'm having a lot of fun swiping in front of the camera and getting commands executed while recording. It's amazing what the Pi is capable of. – rmarques Nov 28 '15 at 0:48
  • Have a look at these for some more ideas of playing with the analysis classes (I'm intending to get them into the docs for the next release when I get a spare second, but those are becoming extremely rare at the moment!) – Dave Jones Nov 28 '15 at 10:25
  • Will check them in detail this week, I'm very grateful. – rmarques Nov 29 '15 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.