Discuss Scratch

Firespawnx
Scratcher
1 post

How do I detect movement?

I have been trying for a while now, does anyone know how to detect which way a laptop (or device with no motion sensors) is moving with the camera instead of using a different device, or adding something like a microbit? I would love some help on this topic, and also, what does “video direction mean?”
Wolf_Link21
Scratcher
100+ posts

How do I detect movement?

I don't think so
MineTurte
Scratcher
1000+ posts

How do I detect movement?

Firespawnx wrote:

I have been trying for a while now, does anyone know how to detect which way a laptop (or device with no motion sensors) is moving with the camera instead of using a different device, or adding something like a microbit? I would love some help on this topic, and also, what does “video direction mean?”
I don't know much about the extra extensions of scratch but you could probably use some external device to try to sense motion. I know the video sensing extension does have a special block that can determine the amount of movement that your current camera is picking up (pretty sure it works with external cameras as well)

Hope this helps!

Last edited by MineTurte (March 25, 2024 23:30:53)

BigNate469
Scratcher
1000+ posts

How do I detect movement?

To detect movement using the camera is exceedingly difficult in scratch. It's already hard in other programming languages, and that's when you can get the color of pixels in an image without having to run a number of if-checks on it first to find what color is at a specific pixel. You would have to either use a computer vision algorithm to detect objects in the image and track their position, and then compare those positions, or if you just wanted to know if something is moving at all you could try to figure how blurry the image is. Both are incredibly difficult to program in scratch, although a place to start would be @griffpatch's color detection algorithm.

Powered by DjangoBB