필터 지우기
필터 지우기

how to make two matrices multiplicable in matlab

조회 수: 1 (최근 30일)
Muneef
Muneef 2016년 2월 16일
댓글: Walter Roberson 2016년 2월 16일
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?

답변 (1개)

Star Strider
Star Strider 2016년 2월 16일
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
Muneef
Muneef 2016년 2월 16일
still getting it ??? Error using ==> times Matrix dimensions must agree.
Walter Roberson
Walter Roberson 2016년 2월 16일
Is your image 2D (grayscale, black and white) or 3D (RGB) ? If it is 2D then you would use conv2() instead of convn()

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by