Swati Gupta
Swati Gupta

Reputation: 11

how to multiply two images in matrix multiplication manner in matlab?

I have two images A and B, each of mxm size. I want to multiply these images such that C=AxB.

So far I've found the immultiply function in MATLAB, but this function multiplies the corresponding bits of the images rather than performing matrix multiplication.

I have also tried A.*B but this also gives multiplication of corresponding bits. When I try A*B I get this message:

??? Error using ==> mtimes
Integer data types are not fully supported for this operation.
At least one operand must be a scalar.

Upvotes: 1

Views: 3966

Answers (1)

lakshmen
lakshmen

Reputation: 29064

You need to convert the images into doubles before multiplying them.

Example:

multiplied = double(firstMat) * double(secondMat);

Upvotes: 2

Related Questions