Swapping Position and Brightness in Grayscale Images
One of the reasons I founded Product Chart is my interest to put things on
charts that usually do not belong there. And it turned out to be super useful
to use charts instead of lists to organize products and compare them.
Recently I was thinking about the pixels of images as objects on a chart. After all, that is not too strange compared to the things that we usually put on charts here.
In a grayscale image, every pixel has 3 parameters: Horizontal position, vertical position and brightness. I was wondering what the image would look like if I exchanged the brightness and the horizontal position for each pixel. So what was dark becomes left. What was bright becomes right. What was left becomes dark and what was right becomes bright.
Recently I was thinking about the pixels of images as objects on a chart. After all, that is not too strange compared to the things that we usually put on charts here.
In a grayscale image, every pixel has 3 parameters: Horizontal position, vertical position and brightness. I was wondering what the image would look like if I exchanged the brightness and the horizontal position for each pixel. So what was dark becomes left. What was bright becomes right. What was left becomes dark and what was right becomes bright.
Putting it into code is straight forward:
for (x=0;x<width;x++) {
for (y=0;y<height;y++) {
b=oldImage[x,y];
newImage[b,y]=x;
}
}
Let's see what happens:
Or check out the other things we have put on charts!