Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm doing image analysis on MATLAB and I can't figure out how to use for loops in order for it to run through the image

I'm doing image analysis on MATLAB and I can't figure out how to use for loops in order for it to run through the image and take the noise off

Right now I have:

% Plotting the thresholded image

Subplot(5,1,5)

imagesc(threshold

axis off

[r,c] = size(plane3)

W = 232;

H = 251;

for r = 2:W-1

for c = 2:H-1

pixel = (r-1:r+1,c-1:c+1);

if pixel = 1

pixel = 0

end

end

end

The instructions are:

Create an image with most of the thresholding noise masked off:

Make a copy of the difference > thresholdValue image array.

For each pixel (you can use a nested pair of for loops to go through all columns of each row)

If the pixel is currently a 1, and less than 3 of its neighbors are 1, then set the pixel to 0.

But I'm not sure how to tell the program to look at the 3 neighbors and change them in needed be.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions