ScratchData LogoScratchData
Back to sly_i's profile

❄️Freeze Photo❄️

SLsly_i•Created October 1, 2023
❄️Freeze Photo❄️
31
25
297 views
View on Scratch

Instructions

Freezes/pause camera temporary to allow for a clear scan that is undistorted by movement. Usage: Allow web cam, Tap or space to scan. Press 1 to render in grayscale with clones Press 2 to render in color with clones Press 3 to render stored RLE with no clones Press 4 to render in color negative with clones Tap to unpause and reduce the resolution and tap to scan at full resolution (Full resolution scan is slow and may fail on mobile/Chromebooks Countdown timer TTS is estimate #pause #camera #freeze #photo #selfie

Description

Multi-clone scan where each clone, scans a small section of the screen. 45 clones do a 3 pass scan on 8 line chucks, temporary blocking the UI thread of the scratch runtime thus freezes the webcam, as the clone scan block is in a "run without refresh" mode. The UI thread including webcam render loop in the scratch runtime cant refresh/unpause until the whole screen is scanned. Normally coders try to avoid blocking the UI thread but when webcam has no pause method, we must create odd workarounds. The Webcam freezes frame, but even the UI variables dont update during the scan, so we cant show a progress bar. Used a dynamic TTS countdown timer to provide a non-visual estimate of the scan progress, as we can't update a costume or draw with pen when the UI is locked during scan. This method scans and prints screen in 5 seconds at Resolution 2 or Scans and prints screen in 12 seconds at Resolution 1. 50% faster than @griffpatch blue line scanner but 40% slower than "scanner with some optimizations" but those scanners both exhibit visual tearing and blurring due to movement, as the webcam is not static with no API to pause the webcam. This method is only useful in very specific circumstances. The clone render doesnt update the screen until the full screen has been drawn. Greyscale RLE has about 1/3 of the draw move count of the full color image RLE. This is kinda the opposite of @griffpatch blue line scanner where you want the screen to update, putting up as comparison project https://scratch.mit.edu/projects/899359159 Pausing in Pixel Mirror project uses an non blocking alternative method useful for other scenarios eg: https://scratch.mit.edu/projects/849453154 Stopping TTS once started can only done with a "Stop All" so need to recreate clones again for render. The render is also UI blocking so nothing is rendered until the whole buffer is drawn in a instant, again not optimal. #pause #camera #freeze #photo #selfie #all @geotale and @griffpatch for the original 5 pass binary scan method but reduced to 3 pass

Project Details

Project ID901412148
CreatedOctober 1, 2023
Last ModifiedJuly 29, 2024
SharedOctober 1, 2023
Visibilityvisible
CommentsAllowed