画像の黒を白に置き換える方法を知りたいです

お世話になります。
添付画像のうち、画素値が[0 0 0]の部分を[255 255 255]に置き換えたいのですが、やり方が分かりません。
もしご存知でしたら、教えてください。

 Réponse acceptée

Hernia Baby
Hernia Baby le 6 Déc 2022

1 vote

まずは読み込みます。
I = imread("image.png");
imshow(I)
バイナリイメージを作成します。
Ir = I(:, :, 1);
Ig = I(:, :, 2);
Ib = I(:, :, 3);
idx = Ir == 0 & Ig == 0 & Ib ==0;
imoverlayでバイナリイメージからtrueの値を着色します。
I1 = imoverlay(I,idx,'w');
imshow(I1)

1 commentaire

渓太
渓太 le 9 Déc 2022
できました!
ありがとうございます、助かります!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur イメージ dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!