0
$\begingroup$

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...

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.