我试图"翻译"冈萨雷斯和伍兹(第2版)中关于拉普拉斯滤波器的内容.
我已经阅读了图片并创建了过滤器.但是,当我尝试显示结果时(通过减法,因为-ve中的中心元素),我没有得到教科书中的图像.
我认为主要原因是"缩放".但是,我不确定如何做到这一点.据我所知,一些在线资源表示缩放只是为了使值在0-255之间.从我的代码中,我看到值已经在该范围内.
我真的很感激任何指针.
以下是我使用的原始图像:
下面是我的代码,以及由此产生的锐化图像.
谢谢!
clc;
close all;
a = rgb2gray(imread('e:\moon.png'));
lap = [1 1 1; 1 -8 1; 1 1 1];
resp = uint8(filter2(lap, a, 'same'));
sharpened = imsubtract(a, resp);
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');
Run Code Online (Sandbox Code Playgroud)
我一直在努力完成 Andrew Ng 的机器学习课程,我现在正在学习逻辑回归。我试图在不使用 MATLAB 函数的情况下发现参数并计算成本fminunc。但是,我并没有收敛到其他使用fminunc. 具体来说,我的问题是:
theta不正确NaN我的成本向量中有很多s(我只是创建了一个成本向量来跟踪)我试图通过梯度下降发现参数作为我理解内容的方式。但是,我的实现似乎仍然给我不正确的结果。
dataset = load('dataStuds.txt');
x = dataset(:,1:end-1);
y = dataset(:,end);
m = length(x);
% Padding the the 1's (intercept term, the call it?)
x = [ones(length(x),1), x];
thetas = zeros(size(x,2),1);
% Setting the learning rate to 0.1
alpha = 0.1;
for i = 1:100000
% theta transpose x (tho why in MATLAB it needs to be done the other way
% round? :) …Run Code Online (Sandbox Code Playgroud)