Friday, April 19, 2024
HomeMatlabDiscovering the Channels » Steve on Picture Processing with MATLAB

Discovering the Channels » Steve on Picture Processing with MATLAB


url = “https://www.mathworks.com/matlabcentral/solutions/uploaded_files/880740/picture.jpeg”;

imshow(A)

Picture credit score: Aktham Shoukry. Used with permission.

Right here is an instance of what Aktham meant by “channel.”

This submit reveals one strategy to accomplish the duty, utilizing erosion, morphological reconstruction, and a few picture arithmetic.

The channels are comparatively skinny in a single dimension, both horizontally or vertically. So, a morphological erosion may be constructed that can preserve a portion of every grain, whereas utterly eliminating the channels.

First, a little bit of preprocessing.

imshow(B)

The channels are about 10 pixels thick, whereas the square-ish “grains” are about 50-by-50. Let’s erode with a sq. structuring aspect with a dimension that is in between.

C = imerode(B,ones(25,25));

imshow(C)

Subsequent, use morphological reconstruction to revive the unique grain shapes.

imshow(D)

Complement the picture to make the grains darkish once more.

imshow(E)

Subtracting the unique grayscale picture from E will get us very shut.

imshow(F)

imshow(G)

A closing cleanup of the small objects, utilizing both bwareafilt or bwareaopen, offers us our end result.

imshow(H)

The perform imoverlay offers us a pleasant visualization of the end result. (You can additionally use imfuse.)

Okay = imoverlay(Ag,H,[.8500 .3250 .0980]);

imshow(Okay)

Word, nevertheless, that our end result is not fairly excellent. There are partially cropped-off grains alongside the highest border which have been recognized as channels. Usually, I’d suggest utilizing imclearborder as a preprocessing step, however on this case, imclearborder eliminates too most of the desired channels.

I’m open to options about the best way to refine this technique. Go away a remark and let me know what you assume.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments