I took a few minutes and created a simple md_get_pixel_val() function (patch file attached - PM me if you'd like a version compiled for a particular camera / firmware version).
Here's a little test script I used to draw a small target box on the screen and report the six pixel values :
--[[
@title Pixel Value Test
]]
screenwidth=360
screenheight=240
if ( get_mode() == false ) then
set_record(1)
while ( get_mode() == false ) do
sleep(100)
end
end
sleep(2000)
repeat
row = screenheight/3
col = screenwidth/2
press("shoot_half")
repeat sleep(100) until get_shooting() == true
y = md_get_pixel_val(1,col,row)
u = md_get_pixel_val(0,col,row)
v = md_get_pixel_val(2,col,row)
r = md_get_pixel_val(3,col,row)
g = md_get_pixel_val(4,col,row)
b = md_get_pixel_val(5,col,row)
for i=1, 50, 1 do
draw_string( 10, ((screenheight/3)*2) , string.format("Y:%d U:%d V:%d R:%d G:%d B:%d",y,u,v,r,g,b) , 258, 263)
draw_rect( col-6, row-6, col+6,row+6, 263, 3)
sleep(100)
end
draw_clear()
release("shoot_half")
repeat sleep(100) until get_shooting() == false
until (false)
It seems to respond to color changes although its hard to get a clean R, G, B separation.
@philmoz : if you can spare a couple of minutes, would you check for me to see if I correctly interpreted the pixel code you put into motion_detect.c ? TIA ..
Next step is to see if I can extend the script to locate a colored object against a neutral background.