Image-sequencer: A new Overlay subpart module

Created on 27 May 2019  Â·  14Comments  Â·  Source: publiclab/image-sequencer

Our current overlay module works perfectly for complete Images but in some cases we just want part of the Image to be overlaid. Like over at image-sequencer-app we are trying to overlay one warped image onto another but that does not work correctly since the area around the warped image is black.
I think we can create a subpart-overlay module which can take the coordinates of the object in the image to overlay and can overlay just that.
The problem this boils down to is making a function which will determine whether a given point is inside the quadrilateral defined by the 4 input points.
I would love to hear your thoughts in this @publiclab/is-reviewers
cc @jywarren

Most helpful comment

Sure! Great work!

All 14 comments

https://user-images.githubusercontent.com/25617855/58384650-d4802000-8001-11e9-9497-397ffc203a7d.jpeg

Actually I made it work for that specific use case using a custom overlay module but this is still something we might wanna have. It may come in handy, Don't you think?

Sure can you just write out the additional fix you're proposing? Thanks!

On Mon, May 27, 2019, 2:09 PM Varun Gupta notifications@github.com wrote:

Actually I made it work for that specific use case using a custom overlay
module but this is still something we might wanna have. It may come in
handy, Don't you think?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/image-sequencer/issues/1080?email_source=notifications&email_token=AAAF6J7ICIYUHR5YJPEMTTDPXQPUXA5CNFSM4HPYFJH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWKJV6Q#issuecomment-496278266,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAF6J4ZKZKY3QQ27BXW2BLPXQPUXANCNFSM4HPYFJHQ
.

Sure! I am thinking of using morphological operations to determine the boundary of the object in the image and then only overlay the pixels inside the boundary! Maybe someone over at the soc team can pick this up, the challenge here is that we cannot conventional methods since those with increase the runtime by a factor of image width!! I think exploring the morphological operations route is well worth it! :smile:

using morphological operations to determine the boundary of the object in the image and then only overlay the pixels inside the boundary

This would be an optimization, right? Are we all the way there with correct final bounding box in the un-optimized mode, first? But yes, once we have the basic version working, an optimization would be great!

Hi @tech4GT could you explain this a bit more, I would like to work on this!

Hi @blurry-x-face
So it's been a while but as far as I remember this module was supposed to overlay a part of the image onto another. For instance, say I give the module the four corner points of a quadrilateral, I then want only the image inside this quadrilateral to be overlaid. The challenge, as I explained earlier is to determine which pixel is inside the quadrilateral and which one is not. I did try to come up with a solution but that was infeasible due to the complexity being O(height*width*width) which would take forever to complete.

@tech4GT how about if we crop and then overlay, wouldn't that work?

We could create a meta module using crop, rotate and overlay to achieve that!

Yeah that's the challenging part, how do we crop an arbitrary quadrilateral out of the image using just the four corner points.

I'll try and make something and let you know if anything works out, thanks!

@tech4GT I was able to make this, this runs in O(n^2) and also uses web assembly so its fast!

Screenshot from 2020-02-01 16-37-15

If this looks good I can open a PR for it!

Sure! Great work!

Thanks! :smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jywarren picture jywarren  Â·  3Comments

keshav234156 picture keshav234156  Â·  4Comments

Divy123 picture Divy123  Â·  5Comments

kindanduseful picture kindanduseful  Â·  5Comments

vaibhavmatta picture vaibhavmatta  Â·  4Comments