找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 4772|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

FPGA的Sobel算法的實(shí)現(xiàn)(Verilog+MATLAB+C源碼)

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
FPGA的Sobel算法的實(shí)現(xiàn) Verilog+MATLAB+C


matlab邊緣檢測(cè)源程序如下:
  1. % CS638-1 Matlab Tutorial
  2. % TA: Tuo Wang
  3. % tuowang@cs.wisc.edu
  4. % Feb 12th, 2010

  5. clear
  6. clc
  7. % Sobel operator:
  8. % read image
  9. lena = imread('abs.jpg');     
  10. % convert it into double type
  11. lena = double(lena);
  12. % get the dimensional information
  13. height = size(lena, 1);
  14. width = size(lena, 2);
  15. channel = size(lena, 3);
  16. % output image
  17. lenaOutput = zeros(size(lena));
  18. % kernels
  19. % Gx = [1 2 1; 0 0 0; -1 -2 -1];
  20. % Gy = [1 0 -1; 2 0 -2; 1 0 -1];
  21. Gx=[-1 0 1;-2 0 2;-1 0 1];
  22. Gy=[1 2 1;0 0 0;-1 -2 -1];
  23. % compute for every pixel
  24. for i = 2 : height - 1
  25.    for j = 2 : width - 1
  26.        for k = 1 : channel
  27.            tempLena = lena(i - 1 : i + 1, j - 1 : j + 1, k);
  28.            x = sum(sum(Gx .* tempLena));
  29.            y = sum(sum(Gy .* tempLena));
  30.            pixValue = sqrt(x^2 + y^2);
  31.            lenaOutput(i, j, k) = pixValue;
  32.        end
  33.    end
  34. end
  35. % display the processed image
  36. lenaOutput = uint8(lenaOutput);
  37. figure;
  38. imshow(lenaOutput);
  39. title('Sobel Edge Detection');
  40. % write the output to disk
  41. imwrite(lenaOutput, 'lenaOutput.jpg', 'jpg')

  42. % original image
  43. figure;
  44. imshow(uint8(lena));
  45. title('Original Image');
復(fù)制代碼

所有資料51hei提供下載:
程序代碼=Verilog+MATLAB+C.rar (9.86 MB, 下載次數(shù): 47)




評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表