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

Fix the energy function #1

Closed
wants to merge 1 commit into from

Conversation

@aryann
Copy link

commented Jul 9, 2019

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: aryann/seam-carving@96117ba

Fix the energy function
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: aryann/seam-carving@96117ba
@avik-das

This comment has been minimized.

Copy link
Owner

commented Jul 10, 2019

@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:

  • Visualizing the energy with the old and new energy function.
  • Visualizing the lowest-energy seam with the old and new energy function. It would be good to see a "bad" seam with the old function and a more intuitive one with the new function.
  • The effect of removing multiple seams with the old and new energy function. Again, it would be good to see the old function behave poorly on the image, and the new function give better results.

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

@aryann

This comment has been minimized.

Copy link
Author

commented Jul 15, 2019

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.

@aryann aryann closed this Jul 15, 2019

@avik-das

This comment has been minimized.

Copy link
Owner

commented Jul 16, 2019

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.