News for hackers. Stuff that matters.
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by brian-armstrong on Wednesday December 20, 2017 @12:47AM (#15967333)
This is a crazy transform to wrap your head around. Given the impl, I think I would restate it as B'(x,y) = ARGMAX(B(u,y)=x, u) -- that is, the brightness at x,y in the new image is the max value of u for which the brightness at u,y is x in the old image.

I wonder if rather than using max, if you averaged instead. Would you get more of an idea of right/left of how that brightness is distributed?

Re:Show HN: Swapping Position and Brightness in Grayscale Im... by no_gravity on Wednesday December 20, 2017 @05:31AM (#15968483)
Correct! In fact, I already use a poor mans average. Initially newImage is all black and then:

    b=oldImage[x,y];
    xa=(newImage[b,y]+x)/2; // poor mans average
    newImage[b,y]=xa;
Would a proper average improve the image further?

Let's see...

...here we go: No average on the left, poor mans average in the middle, proper average on the right:

https://www.productchart.com/elements/objects/blog/2017-12-1...

Yup, it's better. I updated the page with the proper average algorithm now.

Thanks, Brian!

Re:Show HN: Swapping Position and Brightness in Grayscale Im... by brian-armstrong on Wednesday December 20, 2017 @03:52PM (#15973701)
Awesome! The background gradient bar seems reasonable now, you can see that it's about hakf brightness which makes more sense to me :)