hi
i want to convolved 2 images.
i tried with conv2 but its not working.
i have 2 images one is Gaussian filterd image and other is sharped image. and i would like to convolved this 2 image. i write a code
im = imread('my original.jpg');
myfilter = fspecial('gaussian',[3 3], 0.5);
a = imfilter(image, myfilter);
b = imsharpen(image,'Radius',0.5);
c=conv2(a,b);
plz help me

 채택된 답변

Image Analyst
Image Analyst 2013년 10월 13일
편집: Image Analyst 2013년 10월 13일

0 개 추천

You DON'T want to use image as the name of a variable - it's the name of a built in function. Plus you need to convert to double when you call the convolution.
grayImage = imread('Cameraman.tif');
grayImage = double(grayImage);
subplot(2,3,1);
imshow(grayImage, []);
axis on;
title('Original Image', 'FontSize', 15);
myfilter = fspecial('gaussian',[3 3], 0.5);
subplot(2,3,2);
imshow(myfilter, []);
axis on;
title('myFilter', 'FontSize', 15);
a = imfilter(grayImage, myfilter);
subplot(2,3,3);
imshow(a, []);
axis on;
title('a', 'FontSize', 15);
b = imsharpen(grayImage,'Radius',0.5);
subplot(2,3,4);
imshow(b, []);
axis on;
title('b', 'FontSize', 15);
c=conv2(a,b, 'full');
subplot(2,3,5);
imshow(c, []);
title('c', 'FontSize', 15);
axis on;

댓글 수: 9

Image Analyst
Image Analyst 2013년 10월 13일
Why do you want to do this anyway - what does it mean? It doesn't make sense to me.
SAM
SAM 2013년 10월 13일
i would like to calculate the blurring effect...
Image Analyst
Image Analyst 2013년 10월 13일
That's what image "a" is. It makes no sense whatsoever to convolve a blurred full sized image with a sharpened full size image. It's basically meaningless.
SAM
SAM 2013년 10월 13일
편집: SAM 2013년 10월 13일
Undefined function 'conv2' for input arguments of type 'double' and
attributes 'full 3d real'.
again same error...
Error in tryingf11_2 (line 18)
c=conv2(a,b, 'same');
SAM
SAM 2013년 10월 13일
To estimate the blurring effect in a painting,
to model the blurred image I b as the result of Gaussian smoothing filter Gσ applied on a hypothetic sharp image I s ,
i.e. I b =G σ ∗ I s .
The symbol ∗ here means convolution.
Here the parameter σ of Gaussian filter and the sharp image I s are both unknown. Assuming that the frequency distribution for I s is approximately the same, we have the parameter σ of Gaussian filter to represent the degree of blurring. By taking Fourier-Transform on I b , this method looks for the highest frequency whose power is greater than a certain threshold and assumed it inverse-proportioned to the smoothing parameter σ . If the highest frequency is small, it can be considered to be blurred by a largeσ . So the blurring feature is measured as:
Image Analyst
Image Analyst 2013년 10월 14일
Well that's fine, but that's not at all what you are doing.
Anand
Anand 2013년 10월 14일
Looks like your image, is 3D. Is it an RGB image, in that case use rgb2gray to convert it to grayscale:
im = double(rgb2gray(imread('my original.jpg')));
SAM
SAM 2013년 10월 14일
ya i got it
SAM
SAM 2013년 10월 14일
@image analyst
so what should i do?

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

추가 답변 (3개)

Matt J
Matt J 2013년 10월 13일
편집: Matt J 2013년 10월 13일

0 개 추천

You didn't show your error messages, so I'm just guessing, but this
im = imread('my original.jpg');
should probably be this
image = double(imread('my original.jpg'));

댓글 수: 2

SAM
SAM 2013년 10월 13일
Undefined function 'conv2' for input arguments of type 'double' and
attributes 'full 3d real'.
again same error...
Image Analyst
Image Analyst 2013년 10월 14일
They both have to be gray scale images, not color. What does this say:
whos a whos b

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

Taimoor Zafar
Taimoor Zafar 2015년 2월 19일

0 개 추천

I need to convolve two jpg images by using conv2 command but it's not working . Images are attached.
I am new to this field.
Plz help me
Mahfuj
Mahfuj 2015년 11월 4일

0 개 추천

The code works fine. But how we can reconstruct two images from the convolved image ?

댓글 수: 1

Image Analyst
Image Analyst 2015년 11월 4일
You'd have to know one of them, and then use an "inverse filter".

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

질문:

SAM
2013년 10월 13일

댓글:

2015년 11월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by