# image processing in matlab

We try to multiplication operation bw(black-white) image with rgb image in same image but it's class is not same(bw-> logical, rgb->uint8) so not complated successfully.

How can do convert from logical to uint8? Or, can we do images which is in different class multiplication?

thanks for all thing...

The simplest way to convert type is: a=uint8(a) where a is your bw image.

I can convert to any type in this way e.g a=double(a).

For multiplication remember to use .* for element wise multiplication. * does matrix multiplication.

I guess you have a Binary (Logic) mask you want to multiply the image by.

It is easy:

mMask = double(mMaskBinary);

for ii = 1:numChannels

mOutImage(:, :, ii) = mMask  .* mInputImage(:, :, ii);

end


Enjoy.