Steve on Image Processing with MATLAB

Image processing concepts, algorithms, and MATLAB

Note

Steve on Image Processing with MATLAB has been archived and will not be updated.

Color correction with a parula quilt

My wife, Geri Eddins, has been making a lot of quilts lately. A few months ago, I printed out these 10 colors, showed them to her, and asked, "Can you make a wall hanging quilt with this color scheme? And make it look kind of mathematical?" (Whatever that means!)

These are ten of the colors from the default MATLAB colormap, called parula. I've posted about this colormap several times.

So, we looked at some pattern books and found something that seemed promising. She took the color samples and bought some matching fabrics, and then she did her sewing magic. Pretty soon, she had finished two wall hangings! I hung one up at home and one at my MathWorks office. Here is the final result:

I took this picture in my office, using my phone's camera, and lit with sunlight filtered through office windows. But the picture above isn't the first thing I saw after taking the picture. Instead, this is what I got:

That's quite a difference! The yellows are almost completely gone. I can only guess that the way I framed the picture really fooled the phone camera's automatic white balancing algorithm.

After puzzling over what to do with that picture, I remembered about a new-ish (R2017b) color balancing function in the Image Processing Toolbox called chromadapt.

The simplest way to use this function is with the call:

out = chromadapt(in,illuminant)

where illuminant is chosen as a pixel color from the input that should be gray or white, but isn't. Notice that, in this wall hanging, Geri has conveniently provided a white region: the background of the rectangular label at the bottom.

I used impixelinfo to grab a pixel color ([143 170 241]/255) from this region. Then I processed the original image as follows:

corrected = chromadapt(original,[143 170 241]/255);

The resulting image is the first one displayed above, the one with the clearly visible yellow hues.

Enjoy.




Published with MATLAB® R2019a

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.