how to mask an image?

조회 수: 5 (최근 30일)
sheno39
sheno39 2013년 9월 19일
I = imread('E:\M.E 3rd semester\project\coding\flower.jpg');
I = rgb2gray(I);
J=ones(3,3)/9;
K = conv2(I,J,'same');
Warning: CONV2 on values of class UINT8 is obsolete. Use CONV2(DOUBLE(A),DOUBLE(B)) or CONV2(SINGLE(A),SINGLE(B)) instead.
Can anyone help to correct the error?
  댓글 수: 2
Image Analyst
Image Analyst 2013년 9월 19일
That's not masking an image - that's blurring it with a box (or sliding mean) filter. But like the others said, you need to case to double before convolving. Masking would be like setting inside or outside a region to some value or creating an ROI. For example you could mask your image so that the blurring just occurred inside a big circle in the middle of your image. Let me know if you want a masking demo.
sheno39
sheno39 2013년 9월 20일
Thanks for your explanation. As am new to image processing in matlab it would be more helpful to me.

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

채택된 답변

Anand
Anand 2013년 9월 19일
I = im2double(imread('..'));
I = rgb2gray(I);
J = ones(3)/9;
K = conv2(I,J,'same');
  댓글 수: 1
sheno39
sheno39 2013년 9월 20일
thank you..

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

추가 답변 (2개)

Image Analyst
Image Analyst 2013년 9월 20일
편집: Image Analyst 2013년 9월 20일
Regarding your comment asking for a masking demo, one of mine is attached. Click on it below to see it.

Matt J
Matt J 2013년 9월 19일
I = double(rgb2gray(I));
  댓글 수: 3
Matt J
Matt J 2013년 9월 19일
I = imread('E:\M.E 3rd semester\project\coding\flower.jpg');
I = double(rgb2gray(I));
sheno39
sheno39 2013년 9월 20일
thank you..

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

Community Treasure Hunt

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

Start Hunting!

Translated by