Fix rainbows on color eink with the Discrete Fourier Transform in Kindle Comic Converter
By Eink Dude
Summary
## Key takeaways - **Color eInk: Monochrome Under RGB Filter**: It's just a normal black and white monochrome ink panel underneath an RGB color filter. The color resolution is half of the black and white resolution because of the 2 by 2 filter array. [00:11], [00:45] - **Rainbows from Aligned White Pixels**: If there's a section of pixels that all happen to exactly line up, the white pixels line up on all the green sections, so that means in that portion of the image, you'll only see green. If you vary this pattern a little, you'll end up seeing rainbows where there weren't originally. [01:19], [01:27] - **Global Blur Fixes Rainbows, Loses Sharpness**: The simplest way is to just blur everything, that would definitely break up all those sharp edges, all those sharp diagonal edges, but obviously that makes things a lot blurrier. You can see all the sharpness and crispness of the lines have been lost if you just do a global blur. [01:48], [01:57] - **DFT Decomposes Images into Sine Waves**: You can construct any image just by adding a bunch of 2D sine functions basically. With a Fourier transform, you can represent an image as a bunch of sine waves combined together. [02:36], [03:20] - **High Frequencies Create Sharp Edges**: The key idea is the sharp edges are created by high frequencies. As you add more and more sine wave functions of greater frequencies you can make a signal with really sharp edges. [03:30], [03:36] - **Mask DFT to Blur Only Diagonals**: If we mask the Fourier transform like this, where we only remove frequencies in those four corners where the yellow part is, then we only blur basically the diagonal edges, which is what we were wanting to blur in the first place. This preserves much more sharpness, especially since text is mostly horizontal and vertical edges. [04:23], [04:38]
Topics Covered
- Color e-ink halves resolution
- Diagonal alignments cause rainbows
- Images decompose into sine waves
- Mask DFT to blur only diagonals
- New algorithm outperforms Coobo
Full Transcript
Today, let's talk about the relationship between manga and the discrete foryear transform on color e in featuring Kindle Comic Converter 9. All right, first off, let's go over what color ink actually
is. It's just a normal black and white
is. It's just a normal black and white monochrome ink panel underneath an RGB color filter. And this photo shows it
color filter. And this photo shows it from the side and this photo shows it from the front.
So, right now you can see there's a black and white monochrome ink panel in the back. You can see the white parts
the back. You can see the white parts sticking out between all the red, blue, and green stickers. That makes the color filter array. And if you zoom out far
filter array. And if you zoom out far enough, it'll look white. Or if you've actually seen them, it it really looks kind of grayish. But yeah, that's what color ink looks like. And this is why
the color resolution is half of the black and white resolution because the these little 2 by 2 things. But yeah,
and to be really explicit, this is you can see in these two photos, you can see the black and white parts switching.
So you see you can't really see the color when it's black, but you can see the colors when the ink is in the white mode, but it's blocked in the black mode. But yeah, that's how color ink
mode. But yeah, that's how color ink works with kido3 technology.
Okay, so let's think about the original problem that we were wanting to talk about rainbows on color ink. So what would cause a rainbow? Well, basically if there's a
rainbow? Well, basically if there's a section of pixels that all happen to exactly line up, the white pixels line up on all the green sections. So that
means in that portion of the image, you'll only see green. And then if you vary this pattern a little, you'll end up seeing rainbows where there weren't originally rainbows in the original
black and white image.
So we've reduced this problem. We want
to blur diagonal edges to get rid of patterns that result in rainbows.
So there's multiple ways to do it. The
simplest way is to just blur everything.
That would definitely break up all those sharp edges, all those sharp diagonal edges, but obviously that makes things a lot blurriier. You can see all the
lot blurriier. You can see all the sharpness and crispness of the lines have been lost if you just do a global blur. So yeah, what's a better solution?
blur. So yeah, what's a better solution?
And also Coobo does this with its reduce rainbow function. But yeah, but what's
rainbow function. But yeah, but what's there's a better way to do this? Enter
the 2D discrete foryear transform.
All right, this is actually a pretty advanced concept, so I won't be explaining everything, but there are plenty of resources online on how to learn about it. And the one that really clicked for me was digital image processing, a practical introduction
using Java by Nick Efford. I skipped all the parts about Java since I don't use Java for Kindle comic convers. But yeah,
but I'll just give a brief overview.
Basically, any signal in this photo here example, you can construct any signal by just adding together a bunch of sine waves of varying frequencies.
So you can see that if you add a bunch of sine waves, you can even get something that looks like that boxy function over there where it's just like yeah, it's pretty crazy honestly.
And a signal, let's just think about a 2D signal. These are you can construct
2D signal. These are you can construct any image just by adding a bunch of 2D sign functions basically.
Um so you see this is a sign function in the one dimensional case and this is what a sign function would look like in a two dimensional case. And you can see the bottom of a sine wave is black and the top of the sine wave is white. And
all the in between values there are various shades of gray. But yeah,
basically with a four-year transform, you can represent an image as a bunch of sine waves combined together. It's it's
a pretty crazy thing.
And I'll just go jump straight to the conclusion. The key ideas is the sharp
conclusion. The key ideas is the sharp edges are created by high frequencies.
So let's go back to the 1D case. You can
see as you add more and more sign sine wave functions of greater frequencies you could it you can create you can make a signal with really sharp edges and then if you actually examine all the
fouryear transforms you'll see that the direction of the edge of a picture is perpendicular to it edge and the fouryear transform. So you can see in
fouryear transform. So you can see in the first column if the image was basically just a horizontal line then the for transform is just a big vertical line
and yeah I skipped a lot of steps but this is the basic idea and let's just quickly go over what we did before a low pass filter removing all high frequencies is a global blur. Remember
you need high frequencies to create edges. So if you remove all the high
edges. So if you remove all the high frequencies all the edges get blurred out. And you can see in this picture the
out. And you can see in this picture the lady she gets really blurry.
However, if we mask the forer transform like this, where we only remove frequencies in those four corners where the yellow part is, then we only blur basically the the diagonal edges, which
is what we ex which is what we were wanting to blur in the first place. This
preserves much more sharpness, especially since text is mostly horizontal and vertical edges. And the
exact thresholds we decided on this were determined experimentally for the best looking result. This is highly
looking result. This is highly oversimplified. You can read the code
oversimplified. You can read the code for full details, but let's just go over the final result. You see this is the original image. You can see rainbows
original image. You can see rainbows and this is the old rainbow blur.
And here's the new rainbow eraser algorithm that only blurs diagonal edges. And you can see just how sharp
edges. And you can see just how sharp and clear it is compared to it compared to what we had before. This is way better than any of the algorithms that Coobo implemented. And yeah,
Coobo implemented. And yeah, uh just say remember I did not write this algorithm in Kindle common converter and only recently learned about the 4year transform. So, it's
possible I got some details wrong, but I hope this video gave you like some sort of intuition about how useful the discrete 4year transform is.
If you want to learn more about it, I highly recommend you check out you learn about the discrete case first. It's a
lot easier to comprehend than the continuous case. And yeah, and this
continuous case. And yeah, and this algorithm is highly optimized for Kido3.
Kaleido 3 is the one on the right. You
can see the rainbows there, but other color eating technologies have different pixel arrangements. So you would
pixel arrangements. So you would probably need a different algorithm for that. And yeah, that's basically it. If
that. And yeah, that's basically it. If
you like this sort of content, please like, comment, and subscribe. Thanks for
watching.
Loading video analysis...