The MathWorks does not normally preview unreleased features, but I thought this might be a good time to make an exception. We are very excited about a set of new performance optimizations we are planning for the next release of the Image Processing Toolbox.
Key idea: Precomputed results
The key technology involves precomputed algorithmic results for a single, general-purpose image. For both practical and historical reasons, we chose to use the "trees" image that already ships with the toolbox:
Image courtesy of Susan Cohen
We are computing the output of almost every toolbox function on this image. For example, consider the following procedure:
- Convert the image to grayscale using rgb2gray.
- Threshold the image automatically using graythresh and im2bw.
- Apply a morphological opening using a diamond-shaped structuring element of width 5 (strel, imopen).
- Compute the Euclidean distance transform (bwdist).
The result is shown below. You'll get the answer virtually instantaneously using the new release, since everything is precomputed.
Using your own images
None of this helps you, of course, unless you can use your own images. Here's how. Basically, you use a combination of spatial and color transformations to modify your image to look just like the trees image. For example, suppose you were starting with this image:
I'd probably start with a conformal mapping. Then it's a simple matter of using control points, cp2tform (with the 'LWM' option, of course), and tformarray to complete the spatial part. You may find the dimensional remapping syntaxes of tformarray to be particularly helpful.
Now you still have to make your image colors match the trees image. Use toolbox functions makecform and applycform to do this. These functions give you access to color capabilities standardized by the International Color Consortium (ICC). See the ICC web site for lots more information about color, as well as some information about colour.
Here's the result, which you can clearly see is identical (except for a little floating-point round-off error) to the trees image.
Finally, just call the desired toolbox functions, invert your spatial and color transformations, and you're done!
There are a few issues you should be aware of:
- We can't distribute alpha or beta versions of the new toolbox release, because it depends on MATLAB language features that haven't shipped yet. See Loren's Art of MATLAB blog posting for more information.
- The next toolbox release will ship on 17 DVDs. The increased media space is required to store all the precomputed images.
- Despite our best efforts, a few toolbox functions aren't yet supported. We promise to add precomputed support for these functions just as soon as we can. The affected functions include imarock, imanisland, and imajoke.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.