Steve on Image Processing

November 3rd, 2008

R2008b

The MathWorks updates its product line twice per year on a regular schedule. Early last month we shipped our second release of the year, R2008b.

My fellow bloggers have already been busy posting about the new release. In particular, Ken and Mike (with some help from Lori and James) have already written several posts about some great new features in the MATLAB Desktop. You should click over and read their October posts.

In MATLAB, the main thing that caught my eye specific to image processing is the enhancements to imread. We've added JPEG 2000 and netCDF support.

The Image Processing Toolbox has several enhancements. We've made several operations faster, including:

  • binary erosion and dilation (imdilate)
  • binary hit-miss (bwhitmiss)
  • range filtering (rangefilt)
  • gray-level co-occurrence matrix (graycomatrix)

We added a new corner detection function, cornermetric. It offers two choices for the metric: Harris, and Shi / Tomasi.

Also, the ROI functions such as imrect, imellipse, impoly, etc., offer a new createMask method for converting the ROI to binary image mask form.

Here's a timing of imdilate on a 1k-by-1k image using a 3-by-3 structuring element. (If you want to run this yourself, you'll need to download timeit from the MATLAB Central File Exchange.)

bw = repmat(imread('text.png'), 4, 4);
se = strel(ones(3,3));
timeit(@() imdilate(bw, se))
ans =

    0.0060

That result is about 3 times faster than R2008a on my computer.

You might also be interested in updates to the Image Acquisition Toolbox and the Video and Image Processing Blockset. Key new features in the Image Acquisition Toolbox include:

  • Support for display of high bit-depth cameras in the Video Preview window
  • Enhancements to Image Acquisition Tool
  • Support for additional DALSA® hardware

Video and Image Processing Blockset enhancements include:

  • Fixed-point and integer word size limit extended from 32 to 128 bits for Embedded MATLAB code, accelerated simulation modes, and automatic code generation
  • New Apply Geometric Transformation block
  • New Bar Code Recognition demo
  • Enhanced Lane Departure Warning System demo

For more details about these or any other product updates in R2008b, see the product release notes.


Get the MATLAB code

Published with MATLAB® 7.7

8 Responses to “R2008b”

  1. Michael replied on :

    Are there any plans to include support for BigTIFF in imread? If not, do you know of any ways of getting around this?

  2. OkinawaDolphin replied on :

    It is nice to hear that binary dilation has been made faster. However, morphological operations on grayscale images should be made faster, too.

    Matlab is very handy for designing algorithms for surface inspection and other image processing applications. However, deployed Matlab programs are slow when compared to programs written in C++. It is true that it is cumbersome to do image processing with C and Assembler or with C++. This is much easier with Matlab and Simulink. However, 300 ms per image are just too long a processing time in many image processing applications.

  3. Steve replied on :

    Michael—Yes, we do plan to support BigTIFF. Our preference is to wait until there is an official LibTIFF library release supporting BigTIFF. The library version currently being distributed with BigTIFF support is still in beta, if I understand correctly.

  4. Steve replied on :

    Okinawa—Thanks for your input. We are looking at possible performance improvements for many toolbox features, including grayscale morphology. Where does your 300ms number come from? For what size image and what size structuring element? What is your expectation for what the time should be, and what is the basis for your expectation?

  5. OkinawaDolphin replied on :

    My most recent application works with images that have 640 * 480 pixels. The structuring element for binary closing is a disk with a radius of 10 pixels. I tested this application with the profiler several times and the average processing time per image is 300 ms. These 300 ms are related to the whole processing, not only to morphologic operations and regionprops. However, regionprops and morphologic filtering are definitely the bottle neck.

    Another application is steel surface inspection. The current image size is 768 * 426 pixels. It can be set to 768 * 576 pixels because this is the video resolution. The structuring element for grayscale bottom hat is a square with 32 * 32 pixels. The functions imbothat and regionprops are called at least twice per image if any objects are found.

    The processing time varies with the number of objects found on the surface and it can be from 400 ms (no objects indicating damages) to 900 ms on a computer with a dual core processor. The processing time for this application has never been as short as 300 ms on a computer I profiled it with.

    The speed of steel is 1 m/s - 2 m/s and the length of the imaged area is around 1.1 m - 1.6 m. This means that the processing time for one image should not exceed 800 ms to ensure that the whole surface is examined. If both sides are inspected simultaneously, the limit for processing time is as low as 400 ms. This applied for a very early stage of steel production. The steel moves much faster than this at later stages.

  6. Steve replied on :

    Okinawa—Thanks for the additional information. Here’s what I get on my computer (an IBM Thinkpad T60 laptop). For binary dilation of a 480-by-640 image with a disk structuring element with radius 10: 18ms. For grayscale bottom-hat of 576-by-768 image with 32-by-32 structuring element: 103ms.

  7. A. Ghaffar replied on :

    Hi Steve
    Is the code for cornermetric function available freely or the new release has to be purchased? I have R2007a currently.

  8. Steve replied on :

    A. Ghaffar—You’ll have to upgrade to R2008b.

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.