⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 djv5.htm

📁 基于FPGA的嵌入式机器人视觉识别系统模块源代码
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0063)http://www.seattlerobotics.org/encoder/200601/article3/djv5.htm -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY text=#000000 vLink=#000000 aLink=#0000ff link=#0000b0 
bgColor=#008080><BASEFONT face=Arial color=#ffffff>
<CENTER>
<H2>A Color Vision System for Embedded Robotics Applications</H2></CENTER>
<CENTER>
<H2><A 
href="http://www.seattlerobotics.org/encoder/200601/article3/index.php#djv" 
target=main>Click here to return to article</CENTER></A>
<P>
<TABLE borderColor=#0080ff cellPadding=10 align=center 
background=djv5.files/grid.gif border=10>
  <TBODY>
  <TR>
    <TD><FONT color=black>
      <CENTER>
      <H4>Verilog FPGA color blob detection code:</H4></CENTER>
      <P><PRE>//=========================================================
//
//  DJ's verilog code for blob detection
//
//  Written By: Kenneth Y. Maxon - 03/17/2004
//
//=========================================================

module blob_detection(
			input wire sys_clock,
			input wire force_reset,

			input wire [7:0] line_count,
			input wire [8:0] pixel_count,
			input video1_out_strb,
			
			input wire video_filter_data_valid,
			input wire end_of_screen_capture,
			input wire beginning_of_screen_capture,
			
			output wire [23:0] x_output,
			output wire [23:0] y_output,
			
			output wire blob_capture_done
			);

wire divide1_done_flag;
reg [23:0] running_x_counter;
reg [23:0] running_y_counter;
reg [16:0] running_num_counter;

always @(posedge sys_clock)
	if(beginning_of_screen_capture)
	begin
		running_x_counter[23:0] &lt;= #1 24'h000000;
		running_y_counter[23:0] &lt;= #1 24'h000000;
		running_num_counter[16:0] &lt;= #1 17'h00000;
	end
	else if(video_filter_data_valid &amp;&amp; video1_out_strb)
	begin
		running_x_counter[23:0] &lt;= #1 running_x_counter[23:0] + pixel_count[8:0];
		running_y_counter[23:0] &lt;= #1 running_y_counter[23:0] + line_count[7:0];
		running_num_counter[16:0] &lt;= #1 running_num_counter[16:0] + 17'h00001;
	end

//=======------------*** serial divider #1

serial_divide_uu #(24,24,0,0,5,1) my1_divider(
			.clk_i(sys_clock),
			.clk_en_i(1'b1),
			.rst_i(force_reset),
			.divide_i(end_of_screen_capture),
			.dividend_i(running_x_counter[23:0]),
			.divisor_i({7'h0,running_num_counter[16:0]}),
			.quotient_o(x_output[23:0]),
			.done_o(divide1_done_flag)
			);


serial_divide_uu #(24,24,0,0,5,1) my2_divider(
			.clk_i(sys_clock),
			.clk_en_i(1'b1),
			.rst_i(force_reset),
			.divide_i(end_of_screen_capture),
			.dividend_i(running_y_counter[23:0]),
			.divisor_i({7'h0,running_num_counter[16:0]}),
			.quotient_o(y_output[23:0]),
			.done_o()
			);


assign #1 blob_capture_done = divide1_done_flag;

endmodule

</PRE></FONT></TR></TBODY></TABLE>
<P>
<CENTER>
<H2><A 
href="http://www.seattlerobotics.org/encoder/200601/article3/index.php#djv" 
target=main>Click here to return to 
article</CENTER></A></H2></H2></BASEFONT></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -