|
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
|
評分
-
查看全部評分
|