dentifying and marking image regions

Jeff · Mar 4, 2022 · 1.9K views
Question
Hello all,   I have an image (original.png) that I need to separate regions where there are and are not these white dots. The final image should look something like (final.png).   I've tried playing with some image processing functions but because the spaces between the dots is so large relative to the size of the dots I can't find an effective way of filling in the spaces. Original Final  
Expert Answer
Profile picture of John Michell
John Michell PhD Expert
Answered Aug 12, 2026
There are at least four ways that I can think of. One is to to an imclose() with a really big kernel - big enough so that the dots connect. Then use bwboundaries to find the "envelope."
The second way is to use alpha shapes . The File Exchange has submissions on alpha shapes, as well as snakes, active contours, balloons, or whatever you want to call them.
 
The third way is to use a "restricted" convex hull - something I've been after the Mathworks for years to add. I have a inefficient demo of that if you're interested. Basically it's kind of like the convex hull but it only looks within a certain distance to find convex points, so it has the effects of going into the little bays, nooks, and crannies more. So you'll get something like you showed in the red line, whereas a standard convex hull is just like you wrapped a rubber band around the points so that you will have no following of the points into bays.
 
The fourth way might be to calculate the Euclidean Distance transform with bwdist() and then threshold. I haven't tried this (just thought it up now) but it might work.
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!