实现图像的二值化
實(shí)現(xiàn)圖像的二值化
源文件
`timescale 1ns / 1ps module binarization(//module clockinput clk , // 時(shí)鐘信號(hào)input rst_n , // 復(fù)位信號(hào)(低有效)//圖像處理前的數(shù)據(jù)接口input ycbcr_vsync , // vsync信號(hào)input ycbcr_hsync , // hsync信號(hào)input ycbcr_de , // data enable信號(hào)input [7:0] luminance ,//圖像處理后的數(shù)據(jù)接口output post_vsync, // vsync信號(hào)output post_hsync, // hsync信號(hào)output post_de , // data enable信號(hào)output reg monoc // monochrome( 1=白, 0=黑));//reg definereg ycbcr_vsync_d;reg ycbcr_hsync_d;reg ycbcr_de_d ;//*****************************************************//** main code//*****************************************************assign post_vsync = ycbcr_vsync_d ;assign post_hsync = ycbcr_hsync_d ;assign post_de = ycbcr_de_d ;//二值化 always @(posedge clk or negedge rst_n) beginif(!rst_n)monoc <= 1'b0;else if(luminanc總結(jié)