フィルターのクリア

how to convolved two image ?

15 ビュー (過去 30 日間)
SAM
SAM 2013 年 10 月 13 日
コメント済み: Image Analyst 2015 年 11 月 4 日
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 日
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 件のコメント
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 日
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 日
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 日
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".

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by