I've developed an application which is able to communicate directly with a CCD camera (unbranded and obscure) and I'm able to capture and store the image from this camera.

When the image is first captured, the byte order sequence for RGB data is sequential (RRRGGGBBB) so I correct this by simply interleaving the values. When this is done, the image colours are inverted. To fix this step I simply subtract the pixel values from 255.

At this stage, I have an image which closely resembles what is scanned, except for banding of RGB colours around the edges of what is being scanned. If you zoom in on the image I've attached, you will notice red/green/blue lines around the edges of the strips; most prominently around the 2D barcode.

CCD camera result

I have two questions pertaining to this issue:

  1. Could anyone elaborate on the cause of this issue? Would it be a case of chromatic aberration? or something different that may often be observed in low quality CCD cameras?
  2. What techniques may exist to combat this issue (which should be executable in real-time on a kiosk type hardware.

Edit 1: Included full image enter image description here

Edit 2: Included original CCD image prior to colour inversion. enter image description here

  • Is this a crop from a larger image? - this appears to be chromatic aberration yes, if this is not from the center of the image but the top/bottom/side then this is the cause. – Digital Lightcraft Jun 30 '14 at 10:43
  • Looks like chromatic aberration but I am seeing that it is present in all of the image. How are you getting your images ? Are you using Bayer filter ? Something can be wrong on the reconstruction step from color coded image. Additionally just an idea, if you are going to check only the QR codes, you can consider using grayscale images. – Tyathalae Jun 30 '14 at 10:54
  • @DarkcatStudios Yes the image was cropped. I've attached the original image in the edit. – BlackBox Jun 30 '14 at 10:56
  • 3
    This is not CA, this is just the artifact of the R, G and B sensors not sharing the same physical location. You should just adjust the R,G and B channels' location (in your image processing, that is, moving by pixels or subpixels) and you will have a composite image without errors. – TFuto Jun 30 '14 at 11:45
  • 3
    This question appears to be off-topic because it is about computer vision that is unlikely to correspond to still photography. – AJ Henderson Jun 30 '14 at 13:57

To fix this, you need to decompose your image to RGB channels separately. R and G channels are vertically shifted from B channel by 5 pixels each. You need to align these channels vertically. For example I have shifted red channel 10 pixels and green channel 5 pixels from the blue channel.

Here is the result with comparison :

Shifted one Shifted

Corrected one Corrected

5 pixel value is only an assumption, you can improve this even more by using a calibration sheet.

| improve this answer | |
  • Excellent Selim. Just the knowledge I needed, thank you. A quick question though; when you shift, what is left in the gaps? are the last pixels cycled to the start or are they replaced with black/white/alpha? – BlackBox Jun 30 '14 at 12:23
  • This is actually your preference. I have cropped the image as you can see from the bottom part of it. If you need to keep the original image size, you can choose to put black pixels to suit the background. – Tyathalae Jun 30 '14 at 12:30
  • Yeah okay, I see! Thanks again for your help and explanations. – BlackBox Jun 30 '14 at 12:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.