I am currently working on a project where I need to convolve two images grayscale images (0-255 range).I am using conv2() command but the output image matrix is having very high intensity value (292643 and above). I have tried normalizing and then convoluting but that did not work. Here is the code and the image I used.
clc;clear all;close all;image=imread('du5.jpg');figure(),imshow(image);grayimage= rgb2gray(image);im=grayimage;k=imerode(im,strel('disk',1));x=imdilate(k,strel('disk',1));figure(),imshow(x);k = 1000;st=std2(x);sigma1 = st/10;sigma2 =sigma1*k;h1 = fspecial('gaussian', [3,3], sigma1);h2 = fspecial('gaussian', [9,9], sigma2);gauss1 = imfilter(x,h1,'replicate');gauss2 = imfilter(x,h2,'replicate');dogImg = gauss1 - gauss2;i=conv2(dogImg,im);
Best Answer