News for hackers. Stuff that matters.
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by ryandamm on Tuesday December 19, 2017 @12:56PM (#15962178)
This is traditionally called a histogram in video. It allows you to see brightness by region, though it's typically stacked vertically.
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by TeMPOraL on Tuesday December 19, 2017 @01:29PM (#15962577)
Isn't histogram an entirely different thing? As far as I know, to make a histogram you'd iterate over all pixels and, for each of them, increment histogram[pixelBrightness]. Here the author is not counting pixels, but exchanging coordinates.
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by emeraldd on Tuesday December 19, 2017 @01:31PM (#15962589)
Doesn't a histogram throw away the positional element of the pixel entirely and bin by the number of pixels at a particular brightness? This doesn't seem to do that ...
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by nhoiunh4nth on Tuesday December 19, 2017 @01:44PM (#15962775)
Yes it does. This is similar to what is shown on the video scopes of television engineers in the luma waveform view.

https://support.apple.com/kb/PH12688?locale=en_US&viewlocale...

Re:Show HN: Swapping Position and Brightness in Grayscale Im... by Karliss on Tuesday December 19, 2017 @02:14PM (#15963120)
You can keep one of the dimensions by making a histogram a 3d surface. 3d surface f(x,y)->z can be displayed as flat image with brightness representing z value. Brightness can be displayed using dithering. Putting all that together would result in more or less the same diagrams as described in article. With biggest difference being that information about left part of image is actually visible.

Swapping x with brightness is a bit misleading as dithering effect of white dots on black background give much stronger feeling of varied brightness than actual brightness.

Re:Show HN: Swapping Position and Brightness in Grayscale Im... by no_gravity on Tuesday December 19, 2017 @01:09PM (#15962331)
Interesting. Do you have a link to such a histogram?
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by fyrstenberg on Tuesday December 19, 2017 @01:28PM (#15962565)
This type is actually known as a luma waveform histogram:

https://i.imgur.com/Gn4KQTW.png

Source: https://github.com/epistemex/scopes

Re:Show HN: Swapping Position and Brightness in Grayscale Im... by pierrec on Tuesday December 19, 2017 @04:59PM (#15964771)
Modern waveform monitors usually have a feature that does exactly this. They replaced the older analog waveform monitors, which achieved a visually similar result but through rather different means. Very useful for video QC and calibration (I worked a few years as tech at a company that did exactly this and also had some analog ones to play with).

Some digital cameras have this as an overlay on the LCD. If you have a Canon EOS you can always get this feature via the really cool Magic Lantern open-source firmware.

Also, re: some comments calling it a histogram here: maybe colloquially (though I've never heard it), but generally it's called a waveform monitor.

Re:Show HN: Swapping Position and Brightness in Grayscale Im... by amaterasu on Tuesday December 19, 2017 @05:18PM (#15964944)
Specific feature is colloquially known as luma parade. Also done using RGB channels, (inventively) referred to as RGB parade. Also, on video monitors the parade is usually done over the X axis, so rotated vs what appears in the article.
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by swframe2 on Tuesday December 19, 2017 @04:19PM (#15964380)
I wish the demo had the ability to select a region in the original image to focus on. See http://svgjs.com/svg.draw.js/demo/index.html
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by chrisparton1991 on Tuesday December 19, 2017 @07:15PM (#15965827)
It would be neat to provide an "iterations" parameter that runs the algorithm N times over the source image. It could be implemented a slider so the results can be animated, after a fashion.

I did this manually with the seagull photo, and some pretty interesting results occur. The seagull becomes increasingly compressed towards the left, and looks more like a seagull on even iterations than on odd iterations.

Just goes to show how entertaining a simple algorithm can be, nice work!

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 :)
Re:Show HN: Swapping Position and Brightness in Grayscale Im... by arnarbi on Wednesday December 20, 2017 @10:36AM (#15970417)
This is used a lot in grading video, where it is called a luma waveform. Here's a quick tutorial: https://youtu.be/qt1XpfFMyyw