Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use multiplication with grayscale image matrix

I am quite new to matlab/octave. I loaded an image using imread() function of octave. I tried to perform multiplication operation on the matrix but get the following error:

binary operator `*' not implemented for `uint8 matrix' by `matrix' operations 

Is there another way to input the image??

like image 238
ishan3243 Avatar asked Dec 06 '22 04:12

ishan3243


2 Answers

I=imread('...');
I=rgb2gray(I);
I=double(I);
% you can perform the multiplication operation now
like image 162
lennon310 Avatar answered Dec 11 '22 10:12

lennon310


This usually means that you are trying to multiply arrays of different data types. The easiest thing to do here is to convert the uint8 image into double. You can either use the double() function, which will just cast the values, or us im2double(), which will also normalize the values to be between 0 and 1.

like image 22
Dima Avatar answered Dec 11 '22 10:12

Dima