avinash k
avinash k

Reputation: 25

Masking an RGB image with Binary mask Code in matlab

I have a RgB image (MxNx3) and binary mask which is a image consisting of 0's and 1's. Anywhere that the mask is 0, I wish to make exactly 0 in the original image, while anywhere the mask is 1 I just want to leave alone. Any solutions on how to proceed to achieve the desired results?

Upvotes: 1

Views: 509

Answers (1)

Pranav Totala
Pranav Totala

Reputation: 158

This should be your solution,

mat_new=mat_rgb.*mat_binary

. (dot) before a operator will make element wise operation on the matrices.

Upvotes: 1

Related Questions