How to replace pixel values using a loop in a image?
1 回表示 (過去 30 日間)
古いコメントを表示
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
Cv=16:116
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));
end
imshow(I)
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270598/Screenshot%202020-02-08%20at%2015.53.53.png)
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!