|
| 1 | +--- |
| 2 | +title: "GSoC '25 Week 10 Update by Shubham Singh" |
| 3 | +excerpt: "Successfully implemented action block export functionality." |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-08-15" |
| 6 | +slug: "2025-08-15-gsoc-25-firepheonix-week10" |
| 7 | +author: "@/constants/MarkdownFiles/authors/shubham-singh.md" |
| 8 | +tags: |
| 9 | + - gsoc25 |
| 10 | + - sugarlabs |
| 11 | + - week09 |
| 12 | + - firepheonix |
| 13 | +image: "assets/Images/GSOC.webp" |
| 14 | +--- |
| 15 | + |
| 16 | +<!-- markdownlint-disable --> |
| 17 | + |
| 18 | +# Week 10 Progress Report by Shubham Singh |
| 19 | + |
| 20 | +**Project:** [Color Sensor for Music Blocks](https://github.com/sugarlabs/musicblocks/issues/4537) |
| 21 | +**Mentors:** [Devin Ulibarri](https://github.com/pikurasa), [Walter Bender](https://github.com/walterbender) |
| 22 | +**Reporting Period:** 2025-07-05 – 2025-08-15 |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Goals for This Week |
| 27 | + |
| 28 | +- Make the color detection and output more accurate. |
| 29 | +- Deal with issue related to block length detection errors. |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## This Week's Achievements |
| 34 | + |
| 35 | +1. **Made color detection and Action Blocks export very accurate** |
| 36 | + - So, it ignores very small durations (lower that ~350ms) while travelling from left to right, making the color detection very accurate. |
| 37 | + |
| 38 | +  |
| 39 | + |
| 40 | +  |
| 41 | + |
| 42 | +2. **Fixed image overflow issues** |
| 43 | + - Earlier, when the image either was too small or if it was overflowing on the lego widgets canvas, the lego widget would expand it by either adding more rows or contract it by removing some. |
| 44 | + - But now, it's configured to take blank (green) those rows if the image falls shorter in height, and ignore those rows if it overflows. Now the widget handles each case better |
| 45 | + |
| 46 | +  |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Challenges & How I Overcame Them |
| 51 | + |
| 52 | +- **Challenge:** Achieving accurate color detection while avoiding false positives from very small color segments or noise in the image. The system was detecting tiny color variations that didn't represent actual LEGO blocks, leading to incorrect musical note generation. |
| 53 | + **Solution:** Implemented a duration threshold filter that ignores color segments shorter than ~350ms when scanning from left to right. This eliminated noise while preserving legitimate LEGO block detection, significantly improving the accuracy of both color detection and action block export. |
| 54 | + |
| 55 | +- **Challenge:** Handling varying image sizes and aspect ratios that would either overflow the LEGO widget canvas or leave empty space, causing the widget to behave unpredictably by adding or removing rows automatically. |
| 56 | + **Solution:** Redesigned the image handling logic to maintain consistent widget dimensions regardless of input image size. For images shorter than the canvas height, empty rows are filled with blank (green) spaces. For images that overflow, excess rows are simply ignored rather than forcing widget expansion. |
| 57 | + |
| 58 | +- **Challenge:** Ensuring the block length detection algorithm worked consistently across different image resolutions and LEGO block arrangements without producing duration calculation errors. |
| 59 | + **Solution:** Refined the mathematical algorithms for measuring block lengths by implementing relative positioning instead of absolute pixel measurements. This approach maintains accuracy regardless of image scale or resolution. |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +## Key Learnings |
| 64 | + |
| 65 | +- **Threshold-Based Filtering:** Implementing duration thresholds for color detection dramatically improves accuracy in computer vision applications. Small noise elements that pass initial detection can be effectively filtered out using time-based or size-based thresholds, leading to more reliable length-wise pattern recognition. |
| 66 | + |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## Next Week's Roadmap |
| 71 | + |
| 72 | +- Add support for other instruments |
| 73 | +- Add new SVGs for Image and Webcam |
| 74 | +- Auto arrange the pitches according to their order just like in the phrase maker. |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Resources & References |
| 79 | + |
| 80 | +- **Music Blocks Documentation:** https://github.com/sugarlabs/musicblocks/tree/master/documentation |
| 81 | +- **LEGO Blocks Notation System Video:** https://youtu.be/LOfrCPf3XJU?feature=shared |
| 82 | +- **Devin's CMK'24 Blog:** https://medium.com/@sugarlabs/reflections-from-constructing-modern-knowledge-2024-1ce7d60fbb1c |
| 83 | +- **Music Blocks Phrase Maker Source Code:** Referenced for action block formatting standards |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## Acknowledgments |
| 88 | + |
| 89 | +Thank you to my mentors [Walter Bender](https://github.com/walterbender) and [Devin Ulibarri](https://github.com/pikurasa) for invaluable guidance throughout this development phase. Special appreciation for their feedback during the live demonstration and their continued support in refining the project's technical implementation. |
| 90 | + |
| 91 | +--- |
0 commit comments