django-daguerre icon indicating copy to clipboard operation
django-daguerre copied to clipboard

Add support for seam carving

Open melinath opened this issue 12 years ago • 5 comments

Although seam carving is ostensibly supported through https://github.com/sameeptandon/python-seam-carving/blob/master/CAIS.py, the code providing it is way out of date, and the implementation itself is two years old and extremely slow. Seam carving would be great to have, once we have things like out-of-band image adjustments, but it should be done right when that time comes.

melinath avatar Mar 06 '12 18:03 melinath

I've added experimental seam carving support in the seamcarve branch. Times are given for my 1.7GHz Macbook Air, which is running a bunch of other programs at the time.

The current bottleneck is in recalculating the cost matrix; I am out of ways to make it faster. The implementation also doesn't take areas into account, which it should. I should add that the program is currently bound by the CPU on my computer. With a more powerful machine, it would presumably go faster. However, I still don't think this is a practical implementation for a website. Unless someone else can find a way to make this faster, I'm leaving it as is: an experimental branch.

Original (512x341) castle_original

450x300 (~15 seconds, 103 seams) 450x300

200x200 (~45 seconds, 453 seams) 200x200

melinath avatar May 22 '13 23:05 melinath

Whoaaa.

harrislapiroff avatar May 23 '13 14:05 harrislapiroff

We could always implement it, warn heavily in the documentation, and encourage people to use preadjustments if they're using seam carving?

Although, I guess without a serious use case, our only real motivation to do that is that it's AWESOME.

harrislapiroff avatar May 23 '13 15:05 harrislapiroff

Yeah... I think the main reason we wanted this was the awesomeness factor. ;-) We could offer it with preadjustments, but that wouldn't help the case where someone uploaded an image which was viewed immediately. We'd need some sort of "fast version" which could placehold while the slow version was computed.

melinath avatar May 23 '13 17:05 melinath

Apparently Image Magick has a plugin for seam carving. And there's at least one python library for interfacing with Image Magick. So maybe that would be an option.

melinath avatar May 24 '13 09:05 melinath