MathWorks | Steve on Image Processing with MATLAB

507 FOLLOWERS

Get a better understanding of image processing and the use of MATLAB from Steve Eddins at MathWorks. Steve's blog covers Image processing concepts, algorithms, and MATLAB. MathWorks is the leading developer of mathematical computing software for engineers & scientists.

MathWorks | Steve on Image Processing with MATLAB

7M ago

The time has come! After more than 30 years of software development at MathWorks, I have decided to retire. Friday, March 29, will be my last day.
For 18 of those 30 years, I’ve been writing here (600 posts!) about image processing and MATLAB. I am grateful to all of you who have been following along.
Here are few highlights.
Some favorite deep dives:
ROIPOLY and POLY2MASK (part 1, part 2, part 3)
Fourier transforms
Upslope area
Continental divide
The story behind the default MATLAB image
Best invented term, “neighbor indexing”
Most controversial topics:
Implicit expansion (Guests on Loren ..read more

MathWorks | Steve on Image Processing with MATLAB

1y ago

While I was working on a prototype yesterday, I found myself writing a small bit of code that turned out to be so useful, I wondered why I had never done it before. I'd like to show it to you. It'll be an opportunity to explore some recent advances in MATLAB that make useful function syntaxes easy to write.
I wrote a simple function called imageSizeInXY. This function takes a MATLAB Graphics Image object and returns its total width and height in the spatial x-y units of the axes.
function out = imageSizeInXY(im)
...
end
(I'll show the full implementation below.) I was using the ..read more

MathWorks | Steve on Image Processing with MATLAB

1y ago

Today's post is by guest blogger Isaac Bruss. Isaac has been a course developer for MathWorks since 2019. His PhD is in computational physics from UMass Amherst. Isaac has helped launch and support several courses on Coursera, on topics such as robotics, machine learning, and computer vision. Isaac's post is based on a lesson from the Image Processing for Engineering and Science Specialization on Coursera.
Introduction
In this post, I’ll analyze a video of a container filling with liquid. Now, that might not sound like the most exciting thing in the world, but imagine, for example, you're a q ..read more

MathWorks | Steve on Image Processing with MATLAB

1y ago

For some shapes, especially ones with a small number of pixels, a commonly-used method for computing circularity often results in a value which is biased high, and which can be greater than 1. In releases prior to R2023a, the function regionprops used this common method. In R2023a, the computation method has been modified to correct for the bias.
For the full story, read on!
What Is Circularity?
Our definition of circularity is:
$c = \frac{4\pi a}{p^2}$
where a is the area of a shape and p is its perimeter. It is a unitless quantity that lies in the range $[0,1]$. A true circle has a circulari ..read more

MathWorks | Steve on Image Processing with MATLAB

1y ago

I have seen some requests and questions related to identifying objects in a binary image that are touching the image border. Sometimes the question relates to the use of imclearborder, and sometimes the question is about regionprops. Today, I'll show you how to tackle the problem both ways.
Using imclearborder
I'll be using this binary version of the rice.png sample image from the Image Processing Toolbox.
url = "https://blogs.mathworks.com/steve/files/rice-bw-1.png";
A = imread(url);
imshow(A)
The function imclearborder removes all objects touching the border.
B = imclearborder(A);
ims ..read more

MathWorks | Steve on Image Processing with MATLAB

1y ago

In May 2006, I wrote about a technique for computing fast local sums of an image. Today, I want to update that post with additional information about integral image and integral box filtering features in the Image Processing Toolbox.
First, let's review the concept of local sums.
A = magic(7)
A = 7×7
30 39 48 1 10 19 28 38 47 7 9 18 27 29 46 6 8 17 26 35 37 5 14 16 25 34 36 45 13 15 24 33 42 44 4 21 23 32 41 43 3 12 22 31 40 49 2 11 20
The local sum of the $3 \times 3$ neighborhood around (2,3) element of A can be computed this way:
submatrix = A(1:3, 2:4)
submatrix = 3×3
39 48 1 47 7 ..read more

MathWorks | Steve on Image Processing with MATLAB

1y ago

In some of my recent perusal of image processing questions on MATLAB Answers, I have come across several questions involving binary image objects and polygonal boundaries, like this.
The questions vary but are similar:
How can I determine which objects touch the polygon boundary?
How can I get rid of objects outside the boundary?
How can I get rid of objects outside or touching the boundary?
How can I get rid of objects within a certain distance of the boundary?
Today I want to show you how to answer all these questions and more besides, using these fundamental operations:
drawpolygon and ..read more

MathWorks | Steve on Image Processing with MATLAB

1y ago

I have recently been reading a lot of image processing and image analysis questions on MATLAB Answers. Anyone who does the same will quickly come across comments and answers posted by the prolific Image Analyst, a MATLAB Answers MVP who has posted an astounding 34,600+ answers in the last 11 years.
I always enjoy the side commentary that I sometimes find in these answers. For example, I came across this code comment in one answer:
% This is a horrible image. NEVER use JPG format
% for image analysis. Use PNG, TIFF, or BMP instead.
Today, I want to take the opportunity to endorse this stateme ..read more

MathWorks | Steve on Image Processing with MATLAB

1y ago

Last winter, Aktham asked on MATLAB Answers how to find the channels in this image.
url = "https://www.mathworks.com/matlabcentral/answers/uploaded_files/880740/image.jpeg";
A = imread(url);
imshow(A)
Image credit: Aktham Shoukry. Used with permission.
Here is an example of what Aktham meant by "channel."
This post shows one way to accomplish the task, using erosion, morphological reconstruction, and some image arithmetic.
The channels are relatively thin in one dimension, either horizontally or vertically. So, a morphological erosion can be constructed that will keep a portion of each ..read more

MathWorks | Steve on Image Processing with MATLAB

2y ago

Woo hoo! The Image Processing Toolbox team has just created a new product:
Medical Imaging Toolbox
Shipped with the R2022b release a couple of months ago, this product provides apps, functions, and workflows for designing and testing diagnostic imaging applications. You can perform 3D rendering and visualization, multimodal registration, and segmentation and labeling of radiology images. The toolbox also lets you train predefined deep learning networks (with Deep Learning Toolbox). I'm looking forward to writing about this product and its capabilities.
I've been talking recently with Sailesh ..read more