当前位置:网站首页>Image processing 4: corrosion
Image processing 4: corrosion
2022-07-23 13:51:00 【Liu Yaner】
Preface
Text
1. The core : Find out 3×3 The value of the center point of the window is 0、1
2. operation : take 3×3 In my window ,9 Element phase and , The result is the value of the center point of the window
`timescale 1ns / 1ps
//
// 1. The core : Find out 3×3 The value of the center point of the window is 0、1
//
// 2. operation : take 3×3 In my window ,9 Element phase and , The result is the value of the center point of the window
//
//
//
module erosion
(
//global clock
input clk, //cmos video pixel clock
input rst_n, //global reset
//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 per_img_Bit, //Prepared Image brightness input
//Image data has been processd
output post_frame_vsync, //Processed Image data vsync valid signal
output post_frame_href, //Processed Image data href vaild signal
output post_frame_clken, //Processed Image data output/capture enable clock
output post_img_Bit //Processed Image Bit flag outout(1: Value, 0:inValid)
);
//----------------------------------------------------
//Generate 8Bit 3X3 Matrix for Video Image Processor.
//Image data has been processd
wire matrix_frame_vsync; //Prepared Image data vsync valid signal
wire matrix_frame_href; //Prepared Image data href vaild signal
wire matrix_frame_clken; //Prepared Image data output/capture enable clock
wire [7:0] matrix_p11, matrix_p12, matrix_p13; //3X3 Matrix output
wire [7:0] matrix_p21, matrix_p22, matrix_p23;
wire [7:0] matrix_p31, matrix_p32, matrix_p33;
Shift_RAM_3X3 Shift_RAM_3X3_inst
(
//global clock
.clk (clk), //cmos video pixel clock
.rst_n (rst_n), //global reset
.per_frame_vsync (per_frame_vsync), //Prepared Image data vsync valid signal
.per_frame_href (per_frame_href), //Prepared Image data href vaild signal
.per_frame_clken (per_frame_clken), //Prepared Image data output/capture enable clock
.per_img_Y ({
7'b0,per_img_Bit}), //Prepared Image brightness input
//Image data has been processd
.matrix_frame_vsync (matrix_frame_vsync), //Prepared Image data vsync valid signal
.matrix_frame_href (matrix_frame_href), //Prepared Image data href vaild signal
.matrix_frame_clken (matrix_frame_clken), //Prepared Image data output/capture enable clock
.matrix_p11(matrix_p11), .matrix_p12(matrix_p12), .matrix_p13(matrix_p13), //3X3 Matrix output
.matrix_p21(matrix_p21), .matrix_p22(matrix_p22), .matrix_p23(matrix_p23),
.matrix_p31(matrix_p31), .matrix_p32(matrix_p32), .matrix_p33(matrix_p33)
);
//Eonsion with or operation
//Step 1
reg post_img_Bit1, post_img_Bit2, post_img_Bit3;
[email protected](posedge clk or negedge rst_n)begin
if(!rst_n)
begin
post_img_Bit1 <= 1'b0;
post_img_Bit2 <= 1'b0;
post_img_Bit3 <= 1'b0;
end
else
begin
post_img_Bit1 <= matrix_p11[0] & matrix_p12[0] & matrix_p13[0];
post_img_Bit2 <= matrix_p21[0] & matrix_p22[0] & matrix_p23[0];
post_img_Bit3 <= matrix_p21[0] & matrix_p32[0] & matrix_p33[0];
end
end
//Step 2
reg post_img_Bit_r;
[email protected](posedge clk or negedge rst_n)begin
if(!rst_n)
post_img_Bit_r <= 1'b0;
else
post_img_Bit_r <= post_img_Bit1 & post_img_Bit2 & post_img_Bit3;
end
//------------------------------------------
//lag 2 clocks signal sync
reg [1:0] per_frame_vsync_r;
reg [1:0] per_frame_href_r;
reg [1:0] per_frame_clken_r;
[email protected](posedge clk or negedge rst_n)begin
if(!rst_n)
begin
per_frame_vsync_r <= 0;
per_frame_href_r <= 0;
per_frame_clken_r <= 0;
end
else
begin
per_frame_vsync_r <= {
per_frame_vsync_r[0], matrix_frame_vsync};
per_frame_href_r <= {
per_frame_href_r [0], matrix_frame_href};
per_frame_clken_r <= {
per_frame_clken_r[0], matrix_frame_clken};
end
end
assign post_frame_vsync = per_frame_vsync_r[1];
assign post_frame_href = per_frame_href_r [1];
assign post_frame_clken = per_frame_clken_r[1];
assign post_img_Bit = post_frame_href ? post_img_Bit_r : 1'b0;
endmodule
边栏推荐
猜你喜欢

浅谈Anroid设备的CPU类型以及so文件的放置目录

图形管线(一)后处理阶段 alpha测试 模版测试 深度测试 混合

Événements courants de la souris et du clavier

Unity制作简单拦截近防炮——如何预测打击目标

docker redis

Chapter II relational database after class exercises

Power BI----综合应用

C#:in、out、ref关键字

Remote editing and debugging with vscode

Okaleido tiger NFT即将登录Binance NFT平台,你期待吗?
随机推荐
China leads the United States in another emerging technology field and stands at the commanding height of scientific and technological innovation
CSDN recommended template
腾讯MMKV的原理与实现
数据库系统原理与应用教程(041)—— MySQL 查询(三):设置查询条件
Running matlab program on GPU
SparkSQL设计及入门,220722,
数据库系统原理与应用教程(048)—— MySQL 查询(十):自连接查询
[cocos creator] spin animation, monitoring and playback end
Error running ‘XXX‘: Command line is too long. Shorten command line for AudioTest or also ...
解决MySQL向表中增加数据插入中文乱码问题
图像处理5:膨胀
智慧食堂数据分析系统
Reference and output message types in ROS
Warcraft map editor trigger notes
面试官:有了解过ReentrantLock的底层实现吗?说说看
C#:readonly与const
概率沉思录:2.The quantitative rules
数据库系统原理与应用教程(044)—— MySQL 查询(六):使用 LIMIT 选项实现分页查询
KingbaseESV8R6不同隔离级下xmin的区别
2022-07-22 review linked list operation and some problems