Discuss Scratch

Scrachrulz
Scratcher
42 posts

video color sensing

Scratch can currently sense video motion, which I think is actually more difficult to sense than color on the current frame. The block would probably be located in the stage and might look something like:
(video color at x: ( ) y: ( ))
and set the value of the “color” to the same value that pen color uses (0-200, both maximums being red). One more thing adding on to this would be basically the same thing I just said but with shade rather than color. One problem these could have is that if put in an “if: then” block with an equals block like example:
if <(video color at x: (45) y: (-36)) = (190)> then
then it would try to sense only that one color and would be very unreliable. To fix this, you would simply make the sensing block have a range to sense in. Like:
<<(video color at x: (45) y: (-36)) > (185)> and <(video color at x: (45) y: (-36)) < (195)>>

Overall, this block would help with a lot of video things by making them more reliable. For example, I'm currently attempting to make a camera-based drum-set. If I tell the drum to play only when there is motion on it, they all will play rather uncontrollably due to the fact that motion from the rest of your body is interfering. To fix this, I could have it sense the color of a drumstick and only play when there is motion, AND is touching the drumstick's color. Of course, this rouses yet another problem: not everyone has drumsticks. To fix this, I would have a calibration process at the beginning where there is a cross-hair or something in the center, and you put whatever you will be hitting the drums with so it is touching it. It senses the color at 0, 0 and sets the variable it will be using for color to that.

Last edited by Scrachrulz (Aug. 17, 2013 15:02:11)


forever

wait until <[things in my sight v] contains [a need]>
set [need v] to [seen]
program a solution
set [need v] to [filled]

end
eaglgenes101
New to Scratch
100+ posts

video color sensing

I have a similar idea here:
http://scratch.mit.edu/discuss/topic/13490/

Powered by DjangoBB