行业知识
1.图像验证算法平台搭建
2026-11-13 00:26:09
来源:互联网转载
1.简介
���节主要讲如何使用matlab来将图片转化为二进制数据的txt格式的文本,并将txt文本通过仿真的方式来将数据传入Modelsim。经过仿真处理后,在将处理后的二进制txt文本传出matlab转化为图片格式。
2.bmp转TXT
下面是将bmp格式的图像转化为灰度图后转化为二进制txt文件。
clear;clc;close all;a = imread('../img/800x480.bmp');figure(1);subplot(2,1,1)imshow(a),title('原始图像');a = rgb2gray(a);[row,col] = size(a);subplot(2,1,2)imshow(a),title('灰度图像');p_fid = fopen('../data/pre.txt','w+');for i = 1:row for j = 1:col fprintf(p_fid,'%02x',a(i,j)); fprintf(p_fid,'\n'); endendfclose(p_fid); FPGA仿真读取TXT文本并大致按照VGA时许输出
`timescale 1ns / 1psmodule img_gen#( parameter ACTIVE_IW = 800, parameter ACTIVE_IH = 480, parameter TOTAL_IW = 1057, parameter TOTAL_IH = 506, parameter H_START = 216, parameter V_START = 24)( input wire clk , input wire rst_n , output reg vs , output reg de , output reg [7:0] data );reg [7:0] raw_array [ACTIVE_IW * ACTIVE_IH-1:0];integer i;initial beginfor (i=0; i
下一篇:如何下载并安装谷歌浏览器