几年前我做了一个sobel过滤器。要做到这一点,我写了一个管道,让在每个时钟周期9个像素:
architecture rtl of matrix_3x3_builder_8b is
type fifo_t is array (0 to 2*IM_WIDTH + 2) of std_logic_vector(7 downto 0);
signal fifo_int : fifo_t;
begin
p0_build_5x5: process(rst_i,clk_i)
begin
if(rst_i = '1')then
fifo_int <= (others => (others => '0'));
elsif(rising_edge(clk_i))then
if(data_valid_i = '1')then
for i in 1 to 2*IM_WIDTH + 2 loop
fifo_int(i) <= fifo_int(i-1);
end loop;
fifo_int(0) <= data_i;
end if;
end if;
end process p0_build_5x5;
data_o1 <= fifo_int(0*IM_WIDTH + 0);
data_o2 <= fifo_int(0*IM_WIDTH + 1);
data_o3 <= fifo_int(0*IM_WIDTH + 2);
data_o4 <= fifo_int(1*IM_WIDTH + 0);
data_o5 <= fifo_int(1*IM_WIDTH + 1);
data_o6 <= fifo_int(1*IM_WIDTH + 2);
data_o7 <= fifo_int(2*IM_WIDTH + 0);
data_o8 <= fifo_int(2*IM_WIDTH + 1);
data_o9 <= fifo_int(2*IM_WIDTH + 2);
end rtl;
在这里,您阅读像素的图像像素来构建你的3x3矩阵。管道填充时间较长,但一旦完成,每个时钟脉冲都有一个新的矩阵。
每个BlockRAM字中使用了多少位?你使用RGB还是黑白?您也可以使用外部存储器来存储图像(QDR-SSRAM或DDR-SDRAM),并将图像的一部分复制到本地快速BlockRAM中。该解决方案可扩展至FullHD及以上版本。 – Paebbels
请注意,[Sobel](http://en.wikipedia.org/wiki/Sobel_operator)是一个可分离的过滤器,因此您可以将过滤作为两个一维卷积进行。您可以分别处理图像的行和列,而不是在二维邻域中加载9个像素。 – dhanushka
该照片是每像素12位,我使用RGB –