Steve on Image Processing

September 6th, 2007

R2007b

Sharp-eyed readers of my previous post might have noticed the "Published with MATLAB® 7.5" footer at the end of the example. That's right, as Loren posted earlier this week, R2007b is now traveling the world via plane, truck, and TCP/IP.

The new version of MATLAB is 7.5. Follow this link for the full release notes. Some of the new MATLAB features and enhancements might be of particular interest to readers of this blog:

  • Reading TIFF files using imread has been significantly enhanced. imread now supports reading TIFF files with JPEG, LZW, and Deflate compression. It also now supports any number of samples per pixel and bits per sample. And memory use has been greatly reduced when you use the 'PixelRegion' parameter to read in a subset of a TIFF file.
  • A new mmreader video file reader object for Windows platforms supports formats such as AVI, MPEG, and WMV, and adds the ability to read additional video codecs that aviread does not support.
  • You can now make and operate on much larger arrays if you have sufficient memory and are running on a 64-bit OS. Previously, arrays were limited to 231 - 2 elements. [Updated September 11, 2007] The new limit is 248 - 1.

Here are some other enhancements in the new MATLAB release that happened to catch my eye:

  • On Windows and Macintosh, fonts in the MATLAB Desktop are now antialiased according to system settings. It looks a lot better on my LCD monitor!
  • The editor supports code folding. Using this feature you can collapse and expand subfunctions and their associated help.
  • You can set the number of computational threads programmatically using maxNumComputationalThreads.
  • There are several incremental improvements to marking up text in cells, such as using HTML and LaTeX markup. (I like these improvements a lot, since I regularly use publish to generate posts for this blog.)
  • mlint can now show you the McCabe complexity metric for functions in your M-files. I have sometimes called this the "magic metric," and our team regularly uses it to improve the quality of our code. I talked about this metric in a presentation I gave last year at the International Conference on Image Processing. See pages 32-36 of my presentation for more information.

There are lots more. I encourage you to skim the release notes to discover which other features interest you.

R2007b also includes major new updates of Image Processing Toolbox and Image Acquisition Toolbox, as well a minor update of Video and Image Processing Blockset. I'll write about these releases a little later.

Enjoy!

8 Responses to “R2007b”

  1. noel replied on :

    just curious, why is the limit on number of elements 2^48 - 1? 2^64 - 1 would seem more natural.

    what functions does maxNumComputationalThreads affect? just BLAS and LAPACK calls, or will other matlab functions utilize more than 1 thread?

  2. Steve replied on :

    Noel—Good questions. It is occasionally necessary in some computations and algorithms to do signed arithmetic on array offsets. That requires a sign bit, so now we’re down to 2^63. But really, the current limitation is imposed by processor architectures. My secret source on the core architecture team (thanks, GW) tells me that none of the current 64-bit processor architectures supports 64-bit pointer arithmetic, and some support only 48 bits. So 2^48 is a hardware limitation. The software limitation inside MATLAB code is now 2^63.

    Here’s what the documentation says about multithreaded computation in MATLAB: “multithreaded computation in MATLAB speeds up elementwise computations such as those done by the sin and log functions, and computations that use the Basic Linear Algebra Subroutines (BLAS) library, such as matrix multiply.” I expect additional computations to be revised to exploit multithreaded operation in future releases. That is, every 6 months!

  3. noel replied on :

    ah cool thanks. so i guess that suggests some change in implementation, since the 2007a limit was 2^32 (maximum size of a 4 byte integer), not 2^31 (maximum offset from a signed 4 byte pointer).

    a somewhat unrelated question: does/will matlab use the intel TBB anywhere for its multithreaded functions? if that magically is the case, then it would help out a bunch if those headers/binaries/environment variables were distributed in the 2007b matlab installation. we have a bunch of mex files that use the intel TBB, so it would save some effort on installing those libraries if it came for free with the matlab install.

  4. Steve replied on :

    Noel—The previous limit was 231 - 2.

    I am not aware of any use of the Intel Threading Building Blocks library in MATLAB.

  5. Evan replied on :

    So, I can finally read in 12-bit TIFF files? That’s been on my wishlist for years, because we use 12-bit CCD cameras. I’m looking forward to trying this out.

  6. Steve replied on :

    Evan—imread has been able to read 12-bit TIFFs for several years already.

  7. Vincent replied on :

    Actually, what would have been needed is a complete rewrite of imread and imwrite. These have excessive overhead which prevents their use for large images stacks or sequences. For TIFF files, I have been using the low-level functions rtifc and wtifc instead but these also have much overhead. For example, when writing a TIFF stack, wtifc open and closes the TIFF file for every frame added to the stack. The consequence is that the time required to write a stack grows linearly with the size of the stack. This is a major hurdle when dealing with large data sets (tens to hundreds of thousands of images). Anyone aware of a faster library for handling TIFF images?

  8. Steve replied on :

    Vincent—See my blog post today, or my response to your comp.soft-sys.matlab newsgroup post.

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Steve Eddins manages the Image & Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.

  • Sana: hi steve, could you explain to me how i would be able to use the dir function, to do a loop through a directory...
  • Nishtha: Sir, I have preprocessed the image in following steps: [1] adaptive histogram equalization [2] thresholding...
  • Kristof: I also strongly support the idea. I have just recently bumped into the problem that im2single was not...
  • Steve: David—I’ m glad you found it useful!
  • David Lalejini: I found your example very useful for finding connected nodes in a large set of input pairs. I start...
  • tommy: Dear Steve, I have a question,please if you are kind to help me regarding the accumulator array dimensions of...
  • Steve: Abc—I don’t know how to distinguish the faces. You might try posting your question in the MATLAB...
  • Manju: well if we have a few ovals within each other like in a cell how do we measure the distance from the center...
  • Steve: Manju—What do you mean? How is each region defined?
  • Manju: if we have 2-3 regions within each other how do we measure the regions of each one?

These postings are the author's and don't necessarily represent the opinions of The MathWorks.