Click here to Skip to main content
Click here to Skip to main content

"Hey! Is That My Car? How to Sharpen a QuickBird Satellite Image Using DotImage"

, 12 Nov 2007 CPOL
Atalasoft leverages their DotImage toolkit to manipulate color channels for the purpose of image enhancement, in this case satellite images. The article is a tutorial on image enhancement and it includes all source code and test images.

Editorial Note

This article is in the Product Showcase section for our sponsors at CodeProject. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

This is a showcase review for our sponsors at The Code Project. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

Because the bandwidth to a satellite is limited, sometimes they send their imagery as a high-resolution grayscale image and a low-resolution color image of the same area. Pan Sharpening is a class of GIS image processing techniques that are used to combine these two images into a single color image. The resulting image will appear to be at a higher resolution than the original color one.

The general idea is to transform the color image so that one channel of the image is substitutable by the high-resolution grayscale image. Then after the substitution, perform the reverse transforms, if necessary, to obtain a high-resolution color image.

To make sure we're on the same page so far, let's talk about color and channels. In an 8-bit grayscale image, each pixel is given a value that represents the "brightness" of that point in the image. 0 represents black and 255 represents white. A color image is made up of multiple channels, each can be thought of as being a single grayscale image. The usual way this is done is to have three channels, one for Red, Blue and Green. To determine the color of a pixel, the three channel values for that pixel are combined.

Using image-processing software or toolkits, such as DotImage, it's easy to operate on channels directly. Replacing, splitting, re-combining, and individually shifting channels are basic image-processing commands.

To do Pan Sharpening, the idea is to find a channel in the color image that conceptually is the same as the high-resolution grayscale image that you have. Unfortunately, neither Red, Green or Blue channels are appropriate for this. So, before doing the channel substitution it's necessary to transform the color space so that the channels have a different meaning, with one of them being analogous to the high-resolution grayscale image.

A common alternative to RGB is the Hue, Saturation and Lightness representation of color. The Lightness channel is actually a pretty close match to what we'd find in a grayscale image. So if we transform the image to HSL color representation, and then substitute the L channel with the grayscale image, and then transform the result back to RGB, we should end up with a color image that has a higher resolution.

Here is some C# code using DotImage. First you need to load the color and grayscale image:

AtalaImage color = new AtalaImage("atalasoft-color.jpg");
AtalaImage gray = new AtalaImage("atalasoft-gray.jpg");

You need to make sure the color image is the same size as the gray:

if (color.Size != gray.Size) {
    ImageCommand cmdResample = new ResampleCommand(gray.Size);
    ImageResults res = cmdResample.Apply(color);
    color = res.Image;
}

Next you need to translate the image to HSL. To do this, I have created a command called HslConvertCommand to handle converting the image between RGB and HSL.

HslConvertCommand toHslCmd = new HslConvertCommand(true);
color = toHslCmd.Apply(color).Image;

Substitute the Lightness channel

AtalaImage[] channels = {null, null, gray};
ImageCommand replaceLCmd = new ReplaceChannelCommand(channels);
ImageResults res = replaceLCmd.Apply(color);
color = res.Image;

And convert back to RGB:

HslConvertCommand toRGBcmd = new HslConvertCommand(false);
color = toRGBcmd.Apply(color).Image;

Here is the original Color image (a satellite photo of Atalasoft World Headquarters in Easthampton, MA)

Screenshot - image001.jpg

And here is the higher resolution grayscale image

Screenshot - image002.jpg

After running this code, here is the resulting higher resolution color image

Screenshot - image003.jpg

Attached to this article is a basic channel editor written using DotImage and some images so that you can play around. All of the source for the project is also included.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Lou Franco
Atalasoft, Inc.
United States United States
Lou Franco is the Director of Engineering at Atalasoft, provider of the leading .NET Imaging SDK (DotImage) and the Document Viewer for SharePoint (Vizit).
 
http://atalasoft.com/products/dotimage
http://vizitsp.com

Comments and Discussions

 
Questiondownload link broken? PinmemberMember 466849421-Dec-11 23:19 
AnswerRe: download link broken? PinmemberDavid Groves5-Feb-13 9:30 
As of this date, it's still broken.   I guess no-one monitors these old articles and the links in them.   Too bad.
Generalimm.... PinmemberMichael Sync23-Feb-08 7:53 
GeneralArtifacts PinmemberWilli Deutschmann20-Dec-07 8:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.141029.1 | Last Updated 13 Nov 2007
Article Copyright 2007 by Lou Franco
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid