目录
将FPGA的拼接结果导入到matlab,显示结果如下:
vivado2019.2
- `timescale 1ns / 1ps
- //
- // Company:
- // Engineer:
- //
- // Create Date: 2022/07/28 01:51:45
- // Design Name:
- // Module Name: test_image
- // Project Name:
- // Target Devices:
- // Tool Versions:
- // Description:
- //
- // Dependencies:
- //
- // Revision:
- // Revision 0.01 - File Created
- // Additional Comments:
- //
- //
-
-
- module test_image;
- reg i_clk;
- reg i_clk2x;
- reg i_rst;
- reg i_EN;
- reg [7:0] Buffer1 [0:100000];
- reg [7:0] Buffer2 [0:100000];
- reg [7:0] II1;
- reg [7:0] II2;
- wire [7:0] o_dat;
- integer fids1,fids2,idx=0,dat1,dat2;
-
-
- //D:\FPGA_Proj\FPGAtest\codepz
- initial
- begin
- fids1 = $fopen("D:\\FPGA_Proj\\FPGAtest\\codepz\\1.bmp","rb");//调用2个图片
- dat1 = $fread(Buffer1,fids1);
- $fclose(fids1);
- end
- initial
- begin
- fids2 = $fopen("D:\\FPGA_Proj\\FPGAtest\\codepz\\2.bmp","rb");//调用2个图片
- dat2 = $fread(Buffer2,fids2);
- $fclose(fids2);
- end
-
-
-
- initial
- begin
- i_clk=1;
- i_clk2x=1;
- i_rst=1;
- i_EN=1'b0;
- #1000;
- i_rst=0;
- end
- always #5 i_clk=~i_clk;
- always #10 i_clk2x=~i_clk2x;
- always@(posedge i_clk2x or posedge i_rst)
- begin
- if(i_rst)
- begin
- II1<=8'd0;
- II2<=8'd0;
- idx<=0;
- i_EN<=1'b0;
-
- end
- else begin
- II1<=Buffer1[idx];
- II2<=Buffer2[idx];
-
-
- idx<=idx+1;
- if(idx>=1077+1 & idx<=1077+65536)
- i_EN<=1'b1;
- else
- i_EN<=1'b0;
- end
- end
-
- //调用合并模块
- tops tops_u(
- .i_clk (i_clk),
- .i_clk2x (i_clk2x),
- .i_rst (i_rst),
- .i_en (i_EN),
- .i_I1 (II1),
- .i_I2 (II2),
- .o_dat (o_dat)
- );
- //将合并后的模块保存到txt文件中
- integer fout1;
- initial begin
- fout1 = $fopen("SAVEDATA.txt","w");
- end
-
- always @ (posedge i_clk)
- begin
- if(idx<=66619)
- $fwrite(fout1,"%d\n",o_dat);
- else
- $fwrite(fout1,"%d\n",0);
- end
-
- endmodule
- 0X_015m
基于FPGA的图像拼接算法实现是一种利用FPGA硬件平台对图像进行拼接处理的方法。基于FPGA的图像拼接算法实现主要是通过将多张图像进行对齐、融合等处理,最终得到一张拼接后的全景图像。该算法利用了FPGA并行计算的优势,提高了图像拼接的速度和效率。
具体来说,该算法的实现过程主要包括以下步骤:
在本课题中,输入到FPGA的为两个256*256的灰度图,将这两个图并行输入到FPGA中,在FPGA中,通过处理将两个图片拼接成一个图片输出。
OOOOO
OOO
O