Thanks for starting this, definitely seems like a worthwhile project. My weekend looks like it will be mostly taken up by other stuff, but I'll try to play with the patch provide some more specific comments later.
This would let you do a statistically significant number of tests, which would make it much easier to verify MD improvements and characterize the response time of different settings.
FWIW .. there is seems to be an interesting long standing race condition in this code, somewhere between where md_draw_grid() is called from from gui_script_draw() and where md_init_motion_detector() is called from a script.
Quote from: waterwingz on 26 / January / 2013, 19:01:52FWIW .. there is seems to be an interesting long standing race condition in this code, somewhere between where md_draw_grid() is called from from gui_script_draw() and where md_init_motion_detector() is called from a script.Found and fixed this. New patch file for dev trunk attached. This technically also fixes a bug in the 1.1.0 version where the grid boxes would occasionally flash "red" even though no motion had been detected. It did not cause a false trigger. If that that make it a bug fix that can be added to the stable branch I'll submit a patch for that too.
- make the draw_grid value a bit mask so you can enable/disable the grid & difference display independently (0 = both off, 1 = grid on, 2 = diff display on, 3 = both on).
To make this still obey the clipping rules set 'do_draw_rect = motion_detector->draw_grid' in the earlier clipping code and use do_draw_rect to test both cases.
I tried the difference display in the upper left corner and found it less obtrusive. If you draw this first then draw the grid on top you can push the text very close to the grid edges.
sprintf(mdbuff,"%-3d",tmp2) is more efficient as it will only ever display 3 characters (instead of 5 is the tmp2 value is 3 chars long).
One other thing I noticed is that the zebra and histogram code both treat the U & V values as signed chars (which I believe is correct); but the MD code doesn't. This could make the calculations using U & V wrong (e.g. a change from 0 to -1 would be recorded as a diff of 255, and 127 to -128 as a diff of 1).
It could also mean the RGB calculations are wrong as well.
Started by Barney Fife « 1 2 » Completed and Working Scripts
Started by knorke Creative Uses of CHDK
Started by mrShrimp LUA Scripting
Started by mellow-yellow Script Writing
Started by Kestrel1978 General Help and Assistance on using CHDK stable releases