Add a mesh to image source to solve edge cases. - #8172
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8172 +/- ##
=======================================
Coverage 93.92% 93.92%
=======================================
Files 290 290
Lines 24916 24920 +4
Branches 6575 6575
=======================================
+ Hits 23402 23407 +5
+ Misses 1514 1513 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Frank Elsinga <frank@elsinga.de>
…libre-gl-js into improve-image-logic
|
Hi @HarelM, More context + video: https://github.com/mapmelabs/mapme-main/pull/3407#issuecomment-5309946759 |
|
@eminmapme can you post the video here? mapme-main is not a public repo... |
@HarelM Free-transform uses native ImageSource. On moderate quads, MapLibre’s projective warp can make the image appear to spin around the diagonal; extreme foreshortening is better after this pr, but the intermediate spin can still happen until their mesh threshold is hit. Video: https://drive.google.com/file/d/1miElPTwE5jGDVenhVsxMRrrPgHo9pvXg/view?usp=sharing |
|
@eminmapme thanks for the video! I'll look into it. |
|
@eminmapme can you check if the latest version pushed here is better? |
@HarelM It looks much better to me, thanks! Video: https://drive.google.com/file/d/1CBwI_J_pxXconmiWeBGL5L9g7_PSJsaq/view?usp=sharing |
I don't think we should combine the perspective and mesh approaches. Or, at the very least, I think there should be option to set which approach is used:
We use GL JS for viewing image data of paintings like high-resolution scans, photographs, and X-rays. Those images are not usually aligned, meaning our users need to create prealigned copies to accurately compare them. The perspective transform is the most common and effective way to (at least generally) align two images. We typically employ OpenCV's The perspective transform in the original PR is very exciting for us because we can skip prealignment; we can use the original images directly and align them on-the-fly based on the corner control points. My concern with a hybrid solution is that I as a developer can't guarantee a perspective transform will be used, and that we're under the mercy of the logic that triggers perspective versus mesh. If I could set the mode to |
|
I'm not sure this is worth the extra style spec complexity tour. |
|
I don't have time to solve this unfortunately. Adding the spec option would be my wish. But I agree it complicates things. Let me downgrade my concern to this: As a developer, I would like us to state the criteria by which the projection is selected. Perhaps a comment or docs entry along the lines of:
(GitHub isn't loading the PR changes so I can't see whether this is already in the docs.) As long as I can accurately predict when the perspective transform is used, I'm OK with this PR. |
|
This is not well documented. There's a threshold, but it uses blending to make the transition smooth. |

Launch Checklist
This refferes to an issue reported here with the latest fix to image source:
mapmelabs/maplibregl-area-transform#13
I've let AI try and solve this, so I'm not sure I fully understand the solution here...
Would be great to have someone else look at this.
@i4innovationnet @igalgh
*.bench.ts), post before/after results ofnpm run bench(the compare workflow is intest/bench/README.md).CHANGELOG.mdunder the## mainsection.Generated-By: Claude code Opus 5.0