标题:
FPGA的Sobel算法的实现(Verilog+MATLAB+C源码)
[打印本页]
作者:
panweiwen
时间:
2018-4-29 20:56
标题:
FPGA的Sobel算法的实现(Verilog+MATLAB+C源码)
FPGA的Sobel算法的实现 Verilog+MATLAB+C
0.png
(44.65 KB, 下载次数: 77)
下载附件
2018-4-30 01:47 上传
matlab边缘检测源程序如下:
% CS638-1 Matlab Tutorial
% TA: Tuo Wang
% tuowang@cs.wisc.edu
% Feb 12th, 2010
clear
clc
% Sobel operator:
% read image
lena = imread('abs.jpg');
% convert it into double type
lena = double(lena);
% get the dimensional information
height = size(lena, 1);
width = size(lena, 2);
channel = size(lena, 3);
% output image
lenaOutput = zeros(size(lena));
% kernels
% Gx = [1 2 1; 0 0 0; -1 -2 -1];
% Gy = [1 0 -1; 2 0 -2; 1 0 -1];
Gx=[-1 0 1;-2 0 2;-1 0 1];
Gy=[1 2 1;0 0 0;-1 -2 -1];
% compute for every pixel
for i = 2 : height - 1
for j = 2 : width - 1
for k = 1 : channel
tempLena = lena(i - 1 : i + 1, j - 1 : j + 1, k);
x = sum(sum(Gx .* tempLena));
y = sum(sum(Gy .* tempLena));
pixValue = sqrt(x^2 + y^2);
lenaOutput(i, j, k) = pixValue;
end
end
end
% display the processed image
lenaOutput = uint8(lenaOutput);
figure;
imshow(lenaOutput);
title('Sobel Edge Detection');
% write the output to disk
imwrite(lenaOutput, 'lenaOutput.jpg', 'jpg')
% original image
figure;
imshow(uint8(lena));
title('Original Image');
复制代码
0.jpg
(16.76 KB, 下载次数: 91)
下载附件
2018-4-30 01:48 上传
所有资料51hei提供下载:
程序代码=Verilog+MATLAB+C.rar
(9.86 MB, 下载次数: 47)
2018-4-29 20:54 上传
点击文件名下载附件
功能实现代码
下载积分: 黑币 -5
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1