laplacian边缘检测算子matlab实现

上传人:小** 文档编号:89184691 上传时间:2019-05-20 格式:DOC 页数:2 大小:11.78KB
返回 下载 相关 举报
laplacian边缘检测算子matlab实现_第1页
第1页 / 共2页
laplacian边缘检测算子matlab实现_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《laplacian边缘检测算子matlab实现》由会员分享,可在线阅读,更多相关《laplacian边缘检测算子matlab实现(2页珍藏版)》请在金锄头文库上搜索。

1、%本代码是拉普拉斯算子的matlab实现过程%Laplacian为laplacian的子函数,laplacian为拉普拉斯增强函数的调用接口function R = laplacian( I )%I为要进行拉普拉斯增强的图像,R为得到的增强图像length_x, length_y = size(I); R = zeros(length_x, length_y); for i = 2 : length_x - 1 for j = 2 : length_y - 1 templet = I(i-1 : i+1, j-1 : j+1); templet = double(templet); temp

2、= Laplacian(templet); R(i, j) = round(temp); endend min_R = min(R(:); if min_R 0 R = R - min_R;end% R = R * (255/max_R);%这一句一般不用,因为图像中最大的灰度值附近可能只有个别点,这样会使图像灰度范围变窄R = uint8(R);end function newPixel = Laplacian( templet )% L4 = 0, -1, 0; -1, 5, -1; 0, -1, 0; % laplacian算子%L4 = -1, -1, -1; -1, 11, -1; -1, -1, -1; % laplacian算子% temp1 = templet(1, :) * L4(:, 1);temp2 = templet(2, :) * L4(:, 2);temp3 = templet(3, :) * L4(:, 3); newPixel = temp1 + temp2 + temp3;end

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 管理学资料

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号