Steve on Image Processing with MATLAB

Image processing concepts, algorithms, and MATLAB

MATLAB R2012a

Some of my fellow MATLAB Central bloggers have already talked about the MATLAB R2012a release. Usually, I like to scan the release notes and pick out just a few things that particularly interest me. I encourage you to take a look at the release notes to see what else is there that might interest you.

I was particularly happy to see that the web browser system built into MATLAB (used for various purposes, including the help system and the publish feature) was completely overhauled so that it looks a lot better on 64-bit Windows systems.

Speaking of the publish feature, have you heard of it? It's a great way to turn a MATLAB script (or function) into a web page, or a PDF, or a Word document. I use it to create almost all of my blog posts. You can find a lot of examples online by searching for the phrase "Published with MATLAB", such as Calculus with MATLAB. Anyway, you can include syntax-highlighted code in your published output. For example:

bw = imread('text.png');
s = regionprops(bw, {'Area', 'Centroid'});
imshow(bw)
hold on
for k = 1:numel(s)
  plot(s(k).Centroid(1), s(k).Centroid(2), 'b*');
end
hold off

There are several enhancements in the math area that interest me. For example, there are new numerical integration functions (integral, integral2, integral3) that have more capabilities than the functions they replace (quad and its cousins). Try an integration over an unbounded interval using integral:

fun = @(x) exp(-x.^2).*log(x).^2;
integral(fun,0,inf)
ans =

    1.9475

With quad that didn't work so well:

quad(fun,0,inf)
Warning: Infinite or Not-a-Number function value encountered. 

ans =

   NaN

The griddata function now supports natural neighbor interpolation.

And the unique function now has an additional option to preserve the original order of the data. I really like this one. The output of unique is normally sorted. Although you can postprocess the output to restore the original data order, it's tricky and I always puzzled over it a bit. With the new optional argument, it's really easy.

data = [3 2 9 4 8 1 1 10 1 2];
unique(data)
ans =

     1     2     3     4     8     9    10

You can see that the duplicates were removed and the result is sorted.

unique(data,'stable')
ans =

     3     2     9     4     8     1    10

Now the original data order has been preserved.

There are several nice enhancements in the file import/export area, including:

  • .xlsx files can now be read on all platforms
  • FITS export
  • OPeNDAP protocol support (using the netcdf functions)

Finally, if you are really into object-oriented programming using MATLAB, check out the new ability to control the set of allowed subclasses, as well as the ability to control access to class members.




Published with MATLAB® 7.14

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.