当前位置:网站首页>图像处理:生成3×3的窗口
图像处理:生成3×3的窗口
2022-07-23 07:20:00 【刘颜儿】

生成3×3的窗口
module Shift_RAM_3X3(
//global signals
input clk,
input rst_n,
//Image data prepred to be processd
input per_frame_vsync, //Prepared Image data vsync valid signal
input per_frame_href, //Prepared Image data href vaild signal
input per_frame_clken, //Prepared Image data output/capture enable clock
input [7:0] per_img_Y, //Prepared Image brightness input
//Image data has been processd
output matrix_frame_vsync, //Prepared Image data vsync valid signal
output matrix_frame_href, //Prepared Image data href vaild signal
output matrix_frame_clken, //Prepared Image data output/capture enable clock
output reg [7:0] matrix_p11,
output reg [7:0] matrix_p12,
output reg [7:0] matrix_p13, //3X3 Matrix output
output reg [7:0] matrix_p21,
output reg [7:0] matrix_p22,
output reg [7:0] matrix_p23,
output reg [7:0] matrix_p31,
output reg [7:0] matrix_p32,
output reg [7:0] matrix_p33
);
//----------------------------------------------
//consume 1clk
wire [7:0] row1_data;//frame data of the 1th row
wire [7:0] row2_data;//frame data of the 2th row
reg [7:0] row3_data;//frame data of the 3th row
// ====================================================================================================
// 得到一个3×n的矩阵
// ====================================================================================================
// 将正在输入的Y值给data_3,data_3一直在最上面那一行
always @(posedge clk or negedge rst_n)begin
if(!rst_n)
row3_data <= 8'b0;
else begin
if(per_frame_clken)
row3_data <= per_img_Y;
else
row3_data <= row3_data;
end
end
//Shift_RAM_3X3_8bit1
//在这个IP和内部会先将输入的data_3存到RAM中,等存满一行后,就将data_3给data_2进行输出
Shift_RAM_3X3_8bit u1_Shift_RAM_3X3_8bit (
.D (row3_data), // 输入的灰度Y,即当前正在输入的那一行
.CLK (per_frame_clken & clk), // input wire CLK
.Q (row2_data) // output wire [7 : 0] Q
);
//Shift_RAM_3X3_8bit2
Shift_RAM_3X3_8bit u2_Shift_RAM_3X3_8bit (
.D (row2_data), // input wire [7 : 0] D
.CLK (per_frame_clken & clk), // input wire CLK
.Q (row1_data) // output wire [7 : 0] Q
);
// ====================================================================================================、、
//per_clken delay 3clk
reg [4:0]per_frame_clken_r;
reg [4:0]per_frame_vsync_r;
reg [4:0]per_frame_href_r;
always @(posedge clk or negedge rst_n)begin
if(!rst_n)begin
per_frame_clken_r <= 5'b0;
per_frame_vsync_r <= 5'b0;
per_frame_href_r <= 5'b0;
end
else begin
per_frame_clken_r <= {
per_frame_clken_r[3:0], per_frame_clken};
per_frame_vsync_r <= {
per_frame_vsync_r[3:0], per_frame_vsync};
per_frame_href_r <= {
per_frame_href_r [3:0], per_frame_href};
end
end
assign matrix_frame_clken = per_frame_clken_r[4];
assign matrix_frame_href = per_frame_href_r [4];
assign matrix_frame_vsync = per_frame_vsync_r[4];
/**************************************** (1)read data from shift_RAM (2)caulate the sobel (3)steady data after sobel generate ******************************************/
// 将那3行数据进行打拍
always @(posedge clk or negedge rst_n)begin
if(!rst_n)begin
{
matrix_p11, matrix_p12, matrix_p13} <= 24'h0;
{
matrix_p21, matrix_p22, matrix_p23} <= 24'h0;
{
matrix_p31, matrix_p32, matrix_p33} <= 24'h0;
end
else if(per_frame_clken_r[3])begin //shift_RAM data read clock enbale
{
matrix_p11, matrix_p12, matrix_p13} <= {
matrix_p12, matrix_p13, row1_data};//1th shift input
{
matrix_p21, matrix_p22, matrix_p23} <= {
matrix_p22, matrix_p23, row2_data};//2th shift input
{
matrix_p31, matrix_p32, matrix_p33} <= {
matrix_p32, matrix_p33, row3_data};//3th shift input
end
else begin
{
matrix_p11, matrix_p12, matrix_p13} <= {
matrix_p11, matrix_p12, matrix_p13};
{
matrix_p21, matrix_p22, matrix_p23} <= {
matrix_p21, matrix_p22, matrix_p23};
{
matrix_p31, matrix_p32, matrix_p33} <= {
matrix_p31, matrix_p32, matrix_p33};
end
end
endmodule
边栏推荐
- 关于#redis#的问题:Redis设置数据持久化之后还是会有丢失数据的风险
- 解决MySQL向表中增加数据插入中文乱码问题
- CenterNet目标检测模型及CenterFusion融合目标检测模型
- 数据库系统原理与应用教程(044)—— MySQL 查询(六):使用 LIMIT 选项实现分页查询
- Kotlin - 挂起函数 suspend
- Light chain dissection / tree chain dissection
- Unity关于本地加载图片涉及webrequest或者byte
- Special topic of MIMO Radar (0) - General Chapter
- Interface test - simple interface automation test demo
- 一篇文章教会你使用kubernetes的基本使用
猜你喜欢

IP address classification and range

常用的鼠标事件和键盘事件

离屏渲染 &FBO

keepalived双机热备

2022 summer vacation software innovation laboratory training project practice 1
![[JS advanced] basics of regular expressions - about regular expressions you want to know_ 01](/img/b8/7961a3c4375c93971ddd74b1a2473f.jpg)
[JS advanced] basics of regular expressions - about regular expressions you want to know_ 01

SparkSQL设计及入门,220722,

C#:in、out、ref关键字

【STM32】串口通信基础知识

Convergence of abnormal integral
随机推荐
About this pointer
Backtracking method to solve the eight queens problem
Research on hardware architecture of Ti single chip millimeter wave radar xwr1642
数据库系统原理与应用教程(041)—— MySQL 查询(三):设置查询条件
SeekTiger的Okaleido有大动作,生态通证STI会借此爆发?
PHP gets the current timestamp three bit MS MS timestamp
概率沉思录:2.The quantitative rules
Point target simulation of SAR imaging (II) -- matlab simulation
常用的鼠标事件和键盘事件
Hardware system architecture of 4D millimeter wave radar
What should I do if I use PIP in the virtual environment by default
[cocos creator] spin animation, monitoring and playback end
常用的鼠標事件和鍵盤事件
docker redis
Ti single chip millimeter wave radar 1642 code walk through (0) - General Outline
-20: +usecgroupmemorylimitforheap failed to create virtual machine problem
PHP获取当前时间戳三位毫秒 - 毫秒时间戳
Detailed explanation of decision tree
[Part 2] full analysis of oak-d+turnlebot3 robot project
2022-07-22 review linked list operation and some problems