Control Camera with Scratch

Is it possible to control the camera using Scratch? Thanks!

It should be possible to control the camera with scratch but it would require some scripts to be written for it. You can also try modifying out existing scratch library since that would be a whole lot easier.


Maybe you can clarify what you’re trying to do, it sounds interesting. We haven’t integrated anything with the camera and scratch yet, but think it would be awesome. What would you like to be able to do with the camera in Scratch?

I am also interested in using the camera via Scratch. Are there currently functions that would make it easy for 4th-6th graders to take pictures and/or video?

More advanced: Also is there the ability to access basic information about what the camera is viewing? For example if the picture is primarily green do something? From a practical perspective I’m thinking if the kid holds up a green card in front of the camera it tells the robot to do something, if they hold up red it does something else.

Right now, the only thing currently possible is to take a picture and save it to disk.

Scratch isn’t appropriate for any type of picture manipulation but a Python script running in parallel could detect the main colour and send a broadcast back to Scratch. But Scratch itself has no capabilities that I know of that could handle that.

Agreeing with CleoQc here. Scratch now has a function for the GoPiGo that takes a picture and saves it to disk, you can see that here on our Github repo; here’s a picture with the command.

What you’re describing with the camera in a more advanced project is technically possible, but Scratch isn’t a good programming language to do this in. This requires something more powerful that does vision processing; you would be able to do this in Python or C, but not Scratch. We don’t have any good examples of how to do this with the GoPiGo though.

Hope that helps!

Thanks Cleo and John. Those answers were exactly what I needed.

Our pleasure! Please let us know what you end up doing with this in the classroom, we’re always hoping to make the experience for educators better!