Red and blue.

<Previous page Next Page>


Now we get into scary territory. Figuring out how to produce color with minimal artifacts.

Here is the example images used on the previous pages. The barcode is enlarged by two. Both have had the simple linear interpolation performed on them.


The methods I want to play with involve extracting the color information, enhancing the green layer and then adding the color to the green. This assumes there is green information but this is not always the case, so we have to cope with special cases. In these images the chroma has been extracted from the RGB data and stored as RG and BG ratios. This method will fall over if the green value is zero and potentially produce noisy colors if the green value is near zero. The bar code clearly shows the enemy. If the system was perfect the barcode and surrounding white area would show no chroma – IE the rectangle should be even gray. The color artifacts are mainly caused by our crude interpolation interpolating across edges. To complicate matters the optics produce chromatic aberrations in places (color fringes) – these might need to be removed first??.


There green layer has been slightly enhanced as described on the previous page.

The left image is the same simple interpolation as above. The right image is the chroma and enhanced green layer recombined. It looks exactly as expected – a slight improvement in sharpness but little change in the color artifacts.

My first attempt at improving the above image was woeful but tonight has been better.

My plan was to locate the edge boundaries so I can avoid averaging across edges. This is quite a task. The output of the edge/phase detector is shown here, yellow means there is an edge to the left. Blue for right, red for down and cyan for up. Don't expect too much in where the lines a tight, there just isn't enough data to resolve it. My interest the is in the boundaries around larger regions – in particular the numbers. Things are getting ugly where blue turns to black but it should be possible to handle these special cases.


Now having this edge data I can reprocess the green layer to avoid averaging across edges. A simple blend is on the left and the smarter blend is on the right. I think it is very promising. This is a special case being a black and white region but I think this method can be applied to much of the colored areas. This method probably supersedes the weighted mean method on the previous page. Perhaps I'm biased but I reckon this is easier to read - as is text in other parts of the image which I haven't shown here.


I've also tried to use the edge data in the color interpolation. The simple blend is on the left and the smarter one on the right. This still needs work. My current code only knows about adjacent edges but it need to also know about edges further away. This could explain some of the color ghosting. My edge/phase detector is having trouble at the blue/black edge and this is visible. Bear in mind smoothing and sharpening filters can (and probably will) be applied later. More deep thought required....