Replacing pixel value in a loop
古いコメントを表示
Hi everyone, Im trying to replace all pixels in rbg image, where the sum of r,g,b components is lower or equal 10 with zero value ([r,b,g]=[0,0,0]) .
If not I want to keep the value from MyImage.
Here is my attempt ...unfortunately not working
MyImage=imread('003264663547_60.jpeg');
RGBsum=(sum(MyImage,3));
NewImage = zeros(size(MyImage));
[a b c]= size(NewImage);
[row column depth]=size(MyImage);
for l=1:depth
for i=1:row
for j=1:column,
if RGBsum <= 10;
NewImage(a,b,c)=0;
else
NewImage(a,b,c)=MyImage(row,column,depth);
end
end
end
end
imshow(NewImage);
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!