I wrote last week about new features in R2009a related to connected component labeling. There are two new functions, bwconncomp and labelmatrix, as well as additional syntaxes for an existing function, regionprops. The features were designed to reduce the amount of memory required to measure geometric properties of connected components (objects) in binary images. In many cases the computational speed is improved as well.
We were concerned that existing users would not discover and use the new features. If users did not change their code, then they would not benefit from the memory and speed improvements.
So we asked the MATLAB M-Lint team for help. M-Lint is the MATLAB code analysis tool that is behind those helpful suggestions that the MATLAB Editor makes about your code. We asked the team to detect the code pattern where the output of bwlabel is passed as the first input argument to regionprops. I showed this coding pattern in Part 1. Here's what the MATLAB Editor now shows for the script is used to create Part 1:
If you hover over the underlined "L" with your mouse, a short message pops up:
And if you click on the short message, you get a full explanation of how to change your code:
As I mentioned in Part 1, the feedback of blog readers was influential in increasing the priority of this issue. I thank you for your many comments on my previous blogs about bwlabel and regionprops.
If you get a chance to use the new features, let us know what you think by commenting on this post.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.