ScratchData LogoScratchData
Back to imfh's profile

Adaptive Scanner

IMimfh•Created May 23, 2019
Adaptive Scanner
96
84
770 views
View on Scratch

Instructions

Welcome the Adaptive Image Scanner! This project adapts to images to help it scan with higher speed. Optional: https://turbowarp.org/#312305395 (I think this is faster than @griffpatch's scanner, depending on the detail in the image. griffpatch's scanner only scans about 54.8% of the screen, so it's a bit hard to tell. https://scratch.mit.edu/projects/678512904/ ) Modes: Backdrops: Choose from a selection of backdrops to scan. Add your own to the Images sprite! Some images are more complicated than others and take longer to scan. In general, the simpler images with fewer colors (such as the baseball field) are quickest. Camera: Take a picture of yourself or something cool. When using the camera or a new image, try starting out with a higher resolution (lower quality) to allow the project to learn the colors of your environment. Library: View and import saved scans. You can also export images in BMP format! To view the BMP export, you can paste the base64 text in your browser bar. Settings: Reset Colors: This button resets the color list so the scanner has to adapt to images all over again. Draw Size/Transparency: You can adjust these to make a sort of blur effect on images. For more information on how it all works, look down below at the notes. #image #camera #scanner #fast

Description

Thanks to NASA for the space image! https://www.nasa.gov/image-feature/hubble-sees-brilliant-tapestry-of-stars The Canyon image is from @Maximouse's scanner. I haven't saved any adaption for it. How it works: To scan the image, this project goes over each pixel in the image. To find the color of this pixel, I try every possible color with the touching color block until a match is found. To make the project adapt, each time it figures out the color of a pixel, it moves the color to the front of a Colors list so it will be tried first next time. You may notice that the quality of images is somewhat decreased with some odd splotches of color. I believe this is due to the low color resolution (14 bit?) of the touching color block. I tested the scanner with adaptation disabled and the results were the same. The BMP export: This project can export files in a BMP format. To do that, it creates a file in hex format containing the image width, height, file size, and 24-bit color map. Scroll to the bottom for some websites with more info. The Color Map export: If you want to export an image for use in your project, this format is fairly easy to use. The hex export starts with the digits "434D" or CM in ASCII. The 5th digit represents the resolution. The actual width can be gotten from floor(480 / resolution) and height floor(360 / resolution). Starting with the 6th digit is the color map. Every 6 digits represents 1 pixel from left to right bottom to top. To convert the 6 hex digits into an actual color, convert it to decimal and multiply by 16. Something like [16 * join 0x (color hex)] will do the trick. The resulting color can be used in the pen block, touching color, etc. Known bugs: - If you don't triple click a base64 export, part of it can be cut off at a /. - Resolution 1 photos can be cut off when viewing the BMP base64 export with a browser. - Larger images don't save reliably on mobile. - The Library can be made to do multiple things at once causing some interesting corrupted images... - Images don't draw as quickly as possible; enabling turbo mode makes it faster. Helpful sources about BMP files: https://en.wikipedia.org/wiki/BMP_file_format http://www.ece.ualberta.ca/~elliott/ee552/studentAppNotes/2003_w/misc/bmp_file_format/bmp_file_format.htm Helpful hex file tools: https://tomeko.net/online_tools/hex_to_file.php https://hexed.it/

Project Details

Project ID312305395
CreatedMay 23, 2019
Last ModifiedMay 14, 2023
SharedJuly 25, 2020
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root