Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to distort an image with 4 corner points (perspective distortion) #299

Closed
jywarren opened this issue Jun 27, 2018 · 11 comments
Closed

Comments

@jywarren
Copy link
Member

jywarren commented Jun 27, 2018

https://github.com/publiclab/Leaflet.DistortableImage allows distortion of images using 4 points, in the browser.

(https://github.com/jywarren/webgl-distort produces a distorted image and could be integrated as a webgl-only module -- see #64)

We could implement this kind of "drag four corners" interface as an HTML UI, backed with a distortion library.

This issue would have 3 parts:

  1. implement a module with 8 parameters -- relative pixel location change as x, y for each corner
  2. an HTML UI to accomplish this, similar to Leaflet.DistortableImage, shown below
  3. a module building on the above which allows distorting one image over another to "align" them -- so just using another image as a background (passed in similar to the blend module)

screen shot 2018-06-27 at 4 15 19 pm

See this demo: https://publiclab.github.io/Leaflet.DistortableImage/examples/select

This would be helpful in getting 2 images which aren't an exact overlay match to line up, so that they can be used to generate NDVI: https://publiclab.org/notes/warren/12-24-2010/ndvi-test-lima-peru

Update

This probably should use this module:

https://github.com/jywarren/webgl-distort

Or some variant of it. And to work in node, it'll depend on #216, webgl for node.

The UI could start with just a set of pixel coordinate parameters. We could later try to refactor in a more complete HTML UI as in Leaflet.DistortableImage as a follow-up!

@pahenry
Copy link

pahenry commented Jun 28, 2018

It would be helpful for alignment purposes if the opacity of the top layer could be reduced while adjusting the alignment.

@jywarren
Copy link
Member Author

jywarren commented Jun 28, 2018 via email

@Divy123
Copy link
Member

Divy123 commented Jan 5, 2019

Can I please work on this issue?

@jywarren
Copy link
Member Author

jywarren commented Jan 5, 2019 via email

@Divy123
Copy link
Member

Divy123 commented Jan 26, 2019

@jywarren can you please provide some more details into it .
I went through https://github.com/publiclab/Leaflet.DistortableImage and was not able to judge the working .
Can you please provide some insights?

@publiclab publiclab deleted a comment from gitmate bot Feb 16, 2019
@publiclab publiclab deleted a comment from gitmate bot Feb 16, 2019
@jywarren
Copy link
Member Author

Added some insights in an update above; this'll depend on #216 -- I think we should try to make a minimal module first based on webgl-distort, which wouldn't need to try to integrate the whole Leaflet codebase. Make sense?

@jywarren
Copy link
Member Author

We'll need to refactor webgl-distort to not interact with the HTML DOM, so restructuring it to work with an Image object instead of an image element, in this line:

https://github.com/jywarren/webgl-distort/blob/3e0f5a2c0bf5a7f7d00dec6b8e1f960f40cf4e06/dist/webgl-distort.js#L41

We should be able to support the original usage too, but make a new core module that can be used within image-sequencer. What do you think?

@aashna27
Copy link

aashna27 commented Apr 3, 2019

@jywarren Can you provide use case or any more information , as I was thinking of doing this. Any information about your expectations

@jywarren
Copy link
Member Author

jywarren commented Apr 5, 2019 via email

@aashna27
Copy link

aashna27 commented Apr 6, 2019

Yeah it helps, I was thinking of adding this to my proposal but for now I had left it as I didn't have information, so if you could please go through my proposal and let me know your review it would be really great,
https://publiclab.org/notes/aashnaaashna/04-03-2019/soc-proposal-image-sequencer?_=1554388031

@jywarren
Copy link
Member Author

I'm going to close this now, as it's working, including in Node! #216 #1021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants