How to replace pixel values using a loop in a image?

1 view (last 30 days)
grayImage = imageData;
I = grayImage;
Rv = [54:154; 67:167; 41:141; 80:180]; % Row Start Matrix
% Column Vector
Rc = 0:15; % Row Subscript Address Length
for k=1:100
I(Rv(1,k)+Rc,Cv(k)) = I(Rv(3,k)+Rc, Cv(k));
I(Rv(2,k)+Rc,Cv(k)) = I(Rv(4,k)+Rc, Cv(k));
Hi, I am having an issue with this code. As you can see below in the photo, the code does not perform what I intend to do. As I want to replace the metal artifact pixels with the surrounding tissue pixels. So I need to make it so the column vector is repeated for a few of the row matrix.
Screenshot 2020-02-08 at 15.53.53.png

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by