Add getPixelDataFromMedia function for image color detection #4804
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new function to extract pixel data from media elements, enabling color detection functionality for uploaded images and webcam feeds.
Changes Made
getPixelDataFromMedia()function to SensorsBlocks.jsgetPixelData()currently only works with turtle-drawn content on overlayCanvasPurpose
This function is part of my preparation for the GSoC "Color sensor for Music Blocks" project. The goal is to extend color detection capabilities beyond turtle graphics to work with:
Technical Details
The function uses canvas context to draw and extract pixel data from media elements, making it compatible with various image sources.
Testing
Context
This is part of splitting PR #4784 into smaller, focused pull requests as requested by @walterbender for easier review.
Related Commits