avik-das / avik-das.github.io

Personal website
1 stars 1 forks source link

Fix the energy function #1

Closed aryann closed 5 years ago

aryann commented 5 years ago

I followed your blog post. It was an excellent post!

I initially implemented my script using the energy function that is just the sum of the horizontal and vertical components, and I didn't get very good results. I then decided to take the square root of the sum, and got way better results[1].

Let me know if you want me to send over a before/after picture.

[1] Commit with change: https://github.com/aryann/seam-carving/commit/96117ba2059069d8a7d551ed58907f97e2474c90

avik-das commented 5 years ago

@aryann: thanks so much for digging into this. I had actually considered using the square root, but I didn't find the effect on surfer image very satisfying. But maybe it works better on other images?

I'm working on a follow-up blog post about improvements to the seam carving, where the effect of how "low-energy seams" are defined will be important. Instead of editing the existing blog post, I'll include your contribution in the new one. What would be helpful is a few images:

I'll definitely give you credit in the blog post!

aryann commented 5 years ago

Sorry about the delay in getting back to you. I had a chance to play around with the energy functions more. I was using a scaled down version of the surfer for my initial testing (to make the algorithm faster; turns out numpy probably isn't the right choice as most operations can't be vectorized, but that's another story), and in those versions the square root energy function performed better. Same with the Broadway Tower photo that's on Wikipedia.

But... when I scaled down the images less or used the full versions, I couldn't see a big difference between the two energy functions. I think in practice it's hard to say if square rooting is strictly better or worst--I just hadn't spent as much time experimenting when I opened the pull request. I'll close this out since I no longer agree with my original conclusion.

Thanks for humoring me, and let me know if you want someone to look at a draft of your follow up post. My email address is easy to find.

avik-das commented 5 years ago

@aryann: glad you were able to check the results. I would love to see any images from your investigation. Showing how the square root version makes a difference in smaller images, but not in bigger images, would be really cool.

Either way, would you mind if I linked to the above comment in my next blog post?