Software compatibility is a tricky subject. No one likes it when an incompatible change occurs in a software application they rely on. So why do we sometimes find it necessary to make an incompatible change? Here's an illustrative story from the early days of the Image Processing Toolbox.
The function dct2, which computes the two-dimensional discrete cosine transform (DCT), appeared in the original 1993 version of the toolbox. The authors of the toolbox relied on several authoritative references, including Two-Dimensional Signal and Image Processing by Lim. This book contains the following one-dimensional DCT equation:
The original implementation of dct2 used this formula.
At roughly the same time as the first toolbox release, the newly-standardized JPEG image compression method and format was becoming popular. The DCT is the mathematical heart of the JPEG algorithm. Here's the 8-point one-dimensional DCT equation that appears in JPEG: Still Image Data Compression Standard by Pennebaker and Mitchell.
The variable name differences are trivial, but the scale factor differences are very important! The JPEG DCT is an orthonormal transform, whereas the DCT defined in Lim's book is not.
Users of version 1 began to contact tech support, wondering why dct2 was giving the "wrong" answer. We realized that we would have to do something, but what? Changing the output of dct2 would introduce an incompatibility. Not changing it would let user confusion and tech support calls continue indefinitely.
We eventually made a decision based on the fact that image compression is the only widespread application of the DCT in image processing. Therefore, it made no sense for our function to produce an answer inconsistent with the standardized DCT-based image compression method. So we changed the output of dct2 in version 2 of the toolbox. When no complaints came in about the change, we breathed a sigh of relief.
Today at The MathWorks we have processes in place to carefully evaluate changes that might result in an incompatibility. What options have the developers considered? What steps are being taken to mitigate possible negative impacts of the change? What is the benefit to the user of the change?
Whether we are doing a good job or not is up to you to judge. How do you think we are doing? How has the evolution of MATLAB over the years affected your work? Have any good stories to tell? Leave your comments here.
Get the MATLAB code
Published with MATLAB® 7.2
9 CommentsOldest to Newest
How I connect digital camera with Matlab 6.5 ? I am using Image aquation toolbox 1.0.
Can it possible with Matlab 6.5 or any other external device required ?
Kindly help me.
Nita – please see product information for the Image Acquisition Toolbox, including specs, features, and documentation, here: http://www.mathworks.com/products/imaq/
we are doin a project on image processing which involves image compression of biomedical image.. so i request you to help me out with the matlab code for lzw method for compressing an image… thank u..
Thanks a lot for the support you r providing. I am working on steganography using Genetic algorithms on JPEG images. I am stuck at a point where I have to compute DCT over a JPEG image. The MATLAB image processing toolbox provides a function dct2 which can compute dct coefficients for a two dimensional image like GIF or bmp…but JPEG images when read thru imread in MATLAB come out as three dimensional images..so how to compute dct on this 3 dimensional matrix..Kindly help me out..
Hari—JPEG and similar compression algorithms apply the DCT on a block-by-block basis to individual color components, not to all three components at a time. Also, JPEG algorithms usually compress color images by converting RGB images to a different color space and downsampling the new color components. You might need to obtain some reference material on JPEG if you are serious about implement such algorithms.
Hi Steve ,
I am working on an JPEG authentication project. I use the VB.Net but I found it doesn’t good enough for image manipulating.
I realy need to play with the quantized DCT matrix values.
the question is do you advice me to use MATLAB for this project.
I need your advice.
for more information I will be happy to recive an email from you
in advance, thanks alot
Eman—In my completely biased opinion, I think that MATLAB (with the Image Processing Toolbox) is a terrific tool for your project.
i am currently working on a project on image processing, i wanted to extract features of DCTb (80 * 64).I did come up with something but was not sure whether its correct or not what kind of output would we be expecting???
Anmol—I don’t know what your project is. I don’t know what a DCTb is or what kind of features you want from it. I don’t know what you came up with (other than it was something) or what the result was.
You might try being a little more specific. :-)