Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无图像包函数的Matlab/Octave写拉普拉斯滤波器_Matlab_Image Processing_Octave - Fatal编程技术网

无图像包函数的Matlab/Octave写拉普拉斯滤波器

无图像包函数的Matlab/Octave写拉普拉斯滤波器,matlab,image-processing,octave,Matlab,Image Processing,Octave,我的任务是对图像应用拉普拉斯滤波器,而不使用图像包中的函数,如imfilter或fspecial。这是我到目前为止的代码,我想我只需要解决imfilter和imadjust函数的问题: clc; close all; a = im2double(imread('343a.tif')); lap = [-1 -1 -1; -1 8 -1; -1 -1 -1]; resp = imfilter(a, lap, 'conv'); minR = min(resp(:)); maxR = max

我的任务是对图像应用拉普拉斯滤波器,而不使用图像包中的函数,如imfilter或fspecial。这是我到目前为止的代码,我想我只需要解决imfilter和imadjust函数的问题:

clc;
close all;
a = im2double(imread('343a.tif')); 
lap = [-1 -1 -1; -1 8 -1; -1 -1 -1]; 
resp = imfilter(a, lap, 'conv'); 


minR = min(resp(:));
maxR = max(resp(:));
resp = (resp - minR) / (maxR - minR);


sharpened = a + resp;

minA = min(sharpened(:));
maxA = max(sharpened(:));
sharpened = (sharpened - minA) / (maxA - minA);

sharpened = imadjust(sharpened, [60/255 200/255], [0 1]);

figure; 
subplot(1,3,1);imshow(a); title('Original image');
subplot(1,3,2);imshow(resp); title('Laplacian filtered image');
subplot(1,3,3);imshow(sharpened); title('Sharpened image');

非常感谢您的帮助:)

在您呼叫
imfilter
后的第一个小片段是拉普拉斯算子。剩下的你都不需要了。查找MATLAB函数conv2。如果我使用conv2(a,lap,“same”),图像几乎是黑色的,而不是应该的灰色…我做错了什么吗?你显示错了<代码>imshow(resp,[])