GMU:Max and I, Max and Me/Johannes Schneemann: Difference between revisions

From Medien Wiki
Line 30: Line 30:
* [https://www.howmanypeopleareinspacerightnow.com/ how many people are in space right now?]
* [https://www.howmanypeopleareinspacerightnow.com/ how many people are in space right now?]
* [[Max and I, Max and Me class notebook]]
* [[Max and I, Max and Me class notebook]]
= project: color based movement tracker =
This movement tracker uses color as a marker for an object to follow. Hold the object in front of the camera an click on it to select an RGB value to track. The object color needs to be distinctly
different from the background in order for this simple approach to work. This patch yields both a bounding box and its center point to process further.
The main trick is to overlay the video display area (jit.pwindow) with a color picker (suckah) to get the color. A drop-down menu is added as a convenience function to select the input camera (e.g. an external one vs. the build-in device).
The rest is math.
[[File:color_based_movement_tracker.png|400px]]
[[:File:2021-04-23_color_based_movement_tracker_JS.maxpat]]
The following objects are used
* [https://docs.cycling74.com/max8/refpages/metro metro] - steady pulse to grab images from camera
* [https://docs.cycling74.com/max8/refpages/jit.grab jit.grab] - actually grab an image from the camera upon a bang
* [https://docs.cycling74.com/max8/refpages/prepend prepend] - put a stored message in front of any input message
* [https://docs.cycling74.com/max8/refpages/umenu umenu] - a drop-down menu with selection
* [https://docs.cycling74.com/max8/refpages/jit.pwindow jit.pwindow] - a canvas to display the image from the camera
* [https://docs.cycling74.com/max8/refpages/suckah suckah] - pick a colour from the underlying part of the screen (yields RGBA as 4-tuple of floats (0.0 .. 1.0))
* [https://docs.cycling74.com/max8/refpages/swatch swatch] - display a colour (picked)
* [https://docs.cycling74.com/max8/refpages/vexpr vexpr] - for (C-style) math operations with elements in lists
* [https://docs.cycling74.com/max8/refpages/jit.findbounds findbounds] - search values in a given range in the video matrix
* [https://docs.cycling74.com/max8/refpages/jit.lcd jit.lcd] - a canvas to draw on
* [https://docs.cycling74.com/max8/refpages/send send] & [https://docs.cycling74.com/max8/refpages/receive receive] - avoid cable mess


= project: video theremin =
= project: video theremin =