フィルターのクリア

How can I change the pixel value of central row and column of an image?

3 ビュー (過去 30 日間)
Shakir Ishaq
Shakir Ishaq 2018 年 5 月 2 日
コメント済み: Shakir Ishaq 2018 年 5 月 2 日
I have already used one method but I want to use another method without using "for loop". My code is...
a = imread('pic.jpg');
[r,c]=size(a);
centerRow = round(r/2);
centerColumn = round(c/2);
for i=1:r
for j=1:c
if(i==centerRow || j==centerColumn)
a(i,j) =255;
end
end
end
imshow(a);

回答 (1 件)

KSSV
KSSV 2018 年 5 月 2 日
編集済み: KSSV 2018 年 5 月 2 日
for loop is not required........
a = imread('pic.jpg');
[r,c]=size(a);
centerRow = round(r/2);
centerColumn = round(c/2);
a(centerRow,centerColumn,:) =255;
imshow(a);
  1 件のコメント
Shakir Ishaq
Shakir Ishaq 2018 年 5 月 2 日
Thank you for helping me but I want result like this.
The above code does not give result like this.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by