Azzera filtri
Azzera filtri

how to make two matrices multiplicable in matlab

1 visualizzazione (ultimi 30 giorni)
Muneef
Muneef il 16 Feb 2016
Commentato: Walter Roberson il 16 Feb 2016
let say i have an image of some dimension and a 3x3 matrix which i want to multiply with all its pixels but how can i achieve it. Rows and cols are not equal?

Risposte (1)

Star Strider
Star Strider il 16 Feb 2016
You can see if the convn function does what you want. For this, your image has to be in double-precision, so use the double function on it first.
Esample:
Img = randi([0 255], 40, 50, 3);
K33 = rand(3);
Out = convn( Img, K33, 'same');
figure(1)
subplot(1,2,1)
imshow(uint8(Img))
subplot(1,2,2)
imshow(uint8(Out))
  2 Commenti
Muneef
Muneef il 16 Feb 2016
still getting it ??? Error using ==> times Matrix dimensions must agree.
Walter Roberson
Walter Roberson il 16 Feb 2016
Is your image 2D (grayscale, black and white) or 3D (RGB) ? If it is 2D then you would use conv2() instead of convn()

Accedi per commentare.

Categorie

Scopri di più su Read, Write, and Modify Image in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by