当前位置: 首页 > news >正文

FPGA图像处理(四)------ 图像裁剪

`timescale 1ns / 1ps
//
// Description:  图像裁剪算法
//
module image_crop(input wire clk,input wire reset,input wire [10:0] img_width,input wire [10:0] img_height,input wire [10:0] img_x_start,input wire [10:0] img_x_end,input wire [10:0] img_y_start,input wire [10:0] img_y_end,input wire valid_i,input wire [23:0] img_data_i,output reg valid_o,output reg [23:0] img_data_o);//参数声明reg [10:0] x_cnt_r; //行计数器reg [10:0] y_cnt_r; //列计数器//计数always@(posedge clk or posedge reset) beginif(reset) beginx_cnt_r <= 'b0;y_cnt_r <= 'b0;end else beginx_cnt_r <= valid_i ? ((x_cnt_r == img_width - 1) ? 0 : x_cnt_r + 1) : x_cnt_r;y_cnt_r <= valid_i&&(x_cnt_r == img_width - 1) ? ((y_cnt_r == img_height - 1) ? 0 : y_cnt_r + 1) : y_cnt_r;endend    always@(posedge clk or posedge reset) beginif(reset) beginvalid_o <= 'b0;img_data_o <= 'b0;end else beginvalid_o <= valid_i&&(x_cnt_r >= img_x_start)&&(x_cnt_r < img_x_end)&&(y_cnt_r >= img_y_start)&&(y_cnt_r < img_y_end) ? 1'b1 : 1'b0;img_data_o <= img_data_i;endendendmodule

 

相关文章:

  • 【C语言】(8)—指针2
  • 65.Three.js案例-使用 MeshNormalMaterial 和 MeshDepthMaterial 创建 3D 图形
  • Screeps Arena基础入门
  • 基于STM32、HAL库的CP2104 USB转UART收发器 驱动程序设计
  • 最新Spring Security实战教程(十四)OAuth2.0精讲 - 四种授权模式与资源服务器搭建
  • 湖南省密码协会成立,麒麟信安担任副会长单位共话密码创新应用之道
  • 【Python Web开发】05-WSGI概述
  • WordPress插件:WPJAM Basic优化设置
  • 数据库(MySQL)基础
  • 【AI提示词】费曼学习法导师
  • 【时时三省】(C语言基础)怎样定义和引用二维数组
  • 开平机:卷材高效成板的核心装备
  • 无需标记点,精准面部捕捉!无线面捕头盔赋予自由表演空间
  • Java大师成长计划之第15天:Java线程基础
  • 3.5/Q1,GBD数据库最新文章解读
  • ubuntu24.04安装anaconda
  • Spring Boot + Vue 实现在线视频教育平台
  • Spring Boot 3 + Undertow 服务器优化配置
  • modbus 帧信息格式
  • Linux/AndroidOS中进程间的通信线程间的同步 - 消息队列
  • 中日有关部门就日本水产品输华问题进行第三次谈判,外交部回应
  • 中方就乌克兰危机提出新倡议?外交部:中方立场没有变化
  • A股低开高走全线上涨:军工股再度领涨,两市成交12934亿元
  • 老铺黄金拟配售募资近27亿港元,用于门店拓展扩建及补充流动资金等
  • 视频|漫画家寂地:古老丝路上的文化与交流留下的独特印记
  • 从黄土高原到黄浦江畔,澄城樱桃品牌推介会明日在上海举办