<iframe width="560" height="315" src="https://www.youtube.com/embed/3jMAW00ypwk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>Using color detection
Using background subtraction
- Use motion to control the pattern on screen.
- Randomly generated dots on the screen, using class to create object. Make movements according to the motion.
- for dots that are within a certain distance, draw a line between them, transparency according to the distance.
- Background subtraction, set learing time to 0 as to find difference between each frame. Change threshold to
- Object detection:
- Color object detection: chose a color interval to detect. (similar to SensingMachine class content)
- background subtraction with learning
- increase the threshold value gradually, then recorde the value when there's one blob, as Min.
- increase the threshold value gradually, then recorde the value when there's two blob, as Max.
- use the average of Min and Max as the threshold value
- closer: bigger, more blurry/transparency
- further: smaller, more blurry/transparency
The math is used to achieve the goal of perceively visual effect in 3D place on a 2D screen.
relation between distance and visual scale
We assume that the maximum depth is
the original radius of the drop is
the perceively radius of the drop after moving forward is
the coodinate of depth is
Then we have the math relationships:
Then we have:
We need to add a 3D concept - vanish point (thanks Fanyi pointed out!) to achive the effect of 3D movements. And the key is to calculate the ratio of speed between real depth speed and perceive 2D speed.
In the previous part we get the ratio of scale, which is
After we do the derivation, we get:
- /Users/yongkunli/Desktop/OpenFramework/apps/myApps/myBGsub
- frame offset tracking, works and committed
- /Users/yongkunli/Desktop/OpenFramework/apps/SensingMachines/SM01_YongkunLI
- regular rain drops, works and committed.
- simple control works
- flip the camera
- resize the animation & camera
- rebounce effect
- auto correction
- make an app to generate colors
- try autocorrection algrithm