Steve on Image Processing

March 7th, 2008

R2008a

Last week The MathWorks released R2008a, the ninth in a series of six-month releases. (If there's an equinox coming up, look for a new MATLAB® release!)

Here are some of the highlights especially related to image processing. The Image Processing ToolboxTM, the Image Acquisition ToolboxTM, and the Video and Image Processing BlocksetTM all had minor upgrades.

Image Processing Toolbox enhancements include:

  • The previous release added the ability to read a high dynamic-range (HDR) image and convert it to RGB. With the new release, you can construct a new high dynamic-range image from multiple exposures and then write it out to an HDR file.
  • The regionprops function now supports gray-scale images and measurements.
  • You can use imshow to display very large TIFF images using subsampling.
  • The ROI tools (imellipse, imfreehand, imline, impoint, impoly, imrect, imroi) have several minor enhancements, including wait and resume methods for using them from a script, as well as the ability to interactively add vertices to an existing polygon ROI.
  • You can more easily convert between RGB and CMYK color spaces using makecform and applycform.
  • The function iccwrite can create smaller profile files in some cases.
  • The function cp2tform supports the new transform types similarity and nonreflective similarity.

Image Acquisition Toolbox enhancements include:

And here are some of the Video and Image Processing Blockset enhancements:

Note: If you are a Simulink® user, then you should really be reading Seth's new Simulink blog!

Finally, here are a couple of enhancements for the MATLAB image format functions:

  • The imfinfo function now returns new digital camera information.
  • The imwrite function now lets you control how many rows are in each strip when you write a TIFF file.

10 Responses to “R2008a”

  1. Qi Chen replied on :

    Kind of disappointed that the geotiffwrite() is still not available after so many years’ waiting.

  2. Mark Hayworth replied on :

    Steve, it’s nice that you added the gray scale measurements to regionprops. That’s been a major outage for far too long. However I found it ironic that your next blog post mentions how most of the measurements are multidimensional, yet you mention that the new pixel measurements work with gray scale images and you make no mention of multidimensional images such as RGB color images. It sounds like R2008a is not multidimensional for regionprops. These new measurements could easily (I believe) have been extended to handle color images and return color values. Do I have to wait until the next version? Or the one after that?

    Also, another obvious omission is the lack of returning the blob perimeter pixels. For the entire blob, you return the area and all the pixels that make up the area, yet for the perimeter, you only return the perimeter length and not all the pixels that make up the perimeter. Why not? Is it just an oversight or is it really that complicated to add. The work around I might try is to erode the binary image and then subtract the original (to get just the perimeter pixels), then label and regionprop that image to get PixelIDXList which would then represent only the perimeter pixels. Will you be adding this functionality directly into regionprops soon so that we do not have to resort to tricky workarounds to get the perimeter coordinates? The reason for the request is that after finding the blobs, I want to plot the perimeters of them on top of the original color or gray scale image.

  3. Steve replied on :

    Mark—Thanks for your suggestions.

    regionprops has supported multidimensional label matrices since 2001, but not for every measurement. The descriptions for the individual measurements tell you which ones work for multidimensional L, and which ones work only for two-dimensional L. For example, the description for ‘Centroid’ starts with “1-by-ndims(L) vector …” The description for ‘Eccentricity’, on the other hand, says “This property is supported only for 2-D input label matrices.”

    Your description sounds like you want multidimensional support in a different sense. You have a two-dimensional label matrix, and you want to compute the specified measurements corresponding to that label matrix for each plane of a three-dimensional array. This is a straightforward application of functionality that’s already in the product. For example, you might do something like this:

    for k = 1:3
      means{k} = regionprops(L, rgb(:,:,k), 'MeanIntensity');
    end
    

    Boundary tracing has been available in the toolbox for a few releases. You could compute the boundaries for each labeled region this way:

    [L, n] = bwlabel(L);
    s = regionprops(L, 'Image');
    for k = 1:numel(s)
      s(k).Boundaries = bwboundaries(s(k).Image);
    end
    

    I like your “use case” of plotting the outlines of labeled regions, and I’m going to suggest to the team that we add an example like that to the documentation.

  4. Steve replied on :

    Qi—I’m sorry that we’ve disappointed you. Exporting to geotiff is definitely high on our list, but I’m not sure yet when it will be available.

  5. Jerker Wågberg replied on :

    Steve - I just ran into the perimeter problem and came googling to this page. I don’t think your solution to finding the perimeter pixels is what Mark was asking for. The Boundaries in your example will have offsets, since each ‘Image’ will have the same size as the corresponding ‘BoundingBox’. The workaround is of course to adjust the pixel lists with ‘BoundingBox’ coordinates, but I think this functionality really should be offered by regionprops.

    And while you’re at it ;-), I would like a pixel list of the perimeter of the ‘FilledImage’ too!

  6. Steve replied on :

    Jerker—Thanks for the clarification. There are many measurements we could conceivably add to regionprops, but we will probably stick to the ones with a high volume of requests.

  7. Arjun Raj replied on :

    Hi Steve,

    My old license just expired, taking with it my old version of MATLAB, which I had avoided upgrading because of the changes to imshow that require the use of the JVM. I much prefer running MATLAB in -nojvm mode, but I do a lot of image processing and now it seems as though I’m stuck with the JVM. Is there any way around this?

    Thanks,
    Arjun

  8. Steve replied on :

    Arjun—It is no longer feasible to run MATLAB without the jvm. Too much functionality depends on it.

  9. Ljubomir Josifovski replied on :

    >> “It is no longer feasible to run MATLAB without the jvm”

    OMG. I take this is the direction Matlab is going. Very disappointing. Is this true for the latest Unix version as well?

    Thanks,
    Ljubomir

  10. Steve replied on :

    Ljubomir—That’s the direction MATLAB has been going in for the past six years or so, on all platforms.

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.