基于EBAZ4205矿板的图像处理:10gamma变换

基于EBAZ4205矿板的图像处理:10gamma变换

项目全部文件

会上传项目全部文件,如果没传,可以私信催我一下,最近太忙了

先看效果

在这里插入图片描述

请添加图片描述
我的项目中的gamma的变换系数为2.2,是会让图像整体变暗的,看右图说明我的gamma变换模块生效了。

算法

gamma映射是一种简单的、常见的图像处理方法,它能够拓展图像的低亮度区域的灰度级数,让图像的低亮度区域呈现更多的细节,但同时也会让图像的整体亮度变暗,有利有弊。
算法的公式为: y = A*x^g
其中,x为像素点的像素灰度值输入,y为像素点的像素灰度值变换结果,A为归一化系数,g为gamma变换系数。
下图是不同系数的gamma变换曲线。
在这里插入图片描述

算法的FPGA部署

首先,gamma变换是个指数函数。用FPGA来运算指数函数相当耗时,所以为了提升速度,我们采用查表法,既将某个gamma变换系数下的0~255灰度等级的所有对应变换结果算出来,然后在需要映射时,直接查表即可。

BD

在这里插入图片描述

项目代码

图像处理模块

module video_processor((* X_INTERFACE_IGNORE = "true" *) input         frame_clk,    //cmos 像素时钟(* X_INTERFACE_IGNORE = "true" *) input         frame_rst_n,  //预处理图像(* X_INTERFACE_IGNORE = "true" *) input         pre_vsync, //预处理图像场同步信号(* X_INTERFACE_IGNORE = "true" *) input [23:0]  pre_data,  //预处理图像数据(* X_INTERFACE_IGNORE = "true" *) input         pre_href,  //预处理图像数据有效信号(* X_INTERFACE_IGNORE = "true" *) input         pre_frame_ce, //预处理图像时钟使能信号//处理后图像(* X_INTERFACE_IGNORE = "true" *) output        pos_vsync, //处理后图像场同步信号(* X_INTERFACE_IGNORE = "true" *) output [23:0] pos_data,  //处理后图像数据(* X_INTERFACE_IGNORE = "true" *) output        pos_href, //处理后图像数据有效信号(* X_INTERFACE_IGNORE = "true" *) output        pos_frame_ce //处理后图像时钟使能信号  
);wire [7:0] gray_data ;
wire [7:0] post_gray_data ;rgb2gray  u_rgb2gray(.cmos_frame_clk     (frame_clk      ),.cmos_rstn          (frame_rst_n    ),//同步复位.cmos_frame_vsync   (pre_vsync      ),.cmos_frame_data    (pre_data       ),.cmos_frame_href    (pre_href       ),.cmos_frame_ce      (pre_frame_ce   ),.dataout_frame_vsync(pos_vsync     ),.dataout_frame_data (gray_data      ),.dataout_frame_href (pos_href      ),.dataout_frame_ce   (pos_frame_ce  )
);assign pos_data = {3{post_gray_data}};
Curve_Gamma_2P2 u_Curve_Gamma_2P2(.Pre_Data (gray_data),.Post_Data(post_gray_data)
);
endmodule 

色彩转换模块

`timescale 1ns / 1ps
module rgb2gray((* X_INTERFACE_IGNORE = "true" *)  input           cmos_frame_vsync,
(* X_INTERFACE_IGNORE = "true" *)  input [23:0]    cmos_frame_data,
(* X_INTERFACE_IGNORE = "true" *)  input           cmos_frame_href,(* X_INTERFACE_IGNORE = "true" *)  input           cmos_frame_clk,
(* X_INTERFACE_IGNORE = "true" *)  input           cmos_rstn,//同步复位
(* X_INTERFACE_IGNORE = "true" *)  input           cmos_frame_ce,(* X_INTERFACE_IGNORE = "true" *)  output          dataout_frame_vsync,
(* X_INTERFACE_IGNORE = "true" *)  output [7:0]    dataout_frame_data,
// (* X_INTERFACE_IGNORE = "true" *)  output [23:0]    dataout_frame_data,
(* X_INTERFACE_IGNORE = "true" *)  output          dataout_frame_href,
(* X_INTERFACE_IGNORE = "true" *)  output          dataout_frame_ce);// Y = 0.299R +0.587G + 0.114B// Y = (77 *R + 150*G + 29 *B)>>8reg [15:0] r_gray1;reg [15:0] g_gray1;reg [15:0] b_gray1;reg [15:0] y1;reg [7:0] y2;reg [2:0] dataout_frame_vsync_r;reg [2:0] dataout_frame_href_r;reg [2:0] dataout_frame_ce_r;always@(posedge cmos_frame_clk)beginif(!cmos_rstn)beginr_gray1 <= 8'h00;g_gray1 <= 8'h00;b_gray1 <= 8'h00;endelse beginr_gray1 <= cmos_frame_data[23:16]  * 8'd77 ;g_gray1 <= cmos_frame_data[15:8]   * 8'd150;b_gray1 <= cmos_frame_data[7:0]    * 8'd29 ;endendalways@(posedge cmos_frame_clk)beginif(!cmos_rstn)beginy1 <= 16'h0000;endelse beginy1 <= r_gray1 + g_gray1 + b_gray1;endendalways@(posedge cmos_frame_clk)beginif(!cmos_rstn)beginy2 <= 8'h0000;endelse beginy2 <= y1[15:8];endendalways@(posedge cmos_frame_clk)beginif(!cmos_rstn)begindataout_frame_ce_r      <= 3'b000;dataout_frame_vsync_r   <= 3'b000;dataout_frame_href_r    <= 3'b000;endelse begindataout_frame_ce_r      <= {dataout_frame_ce_r[1:0]     ,cmos_frame_ce};dataout_frame_vsync_r   <= {dataout_frame_vsync_r[1:0]  ,cmos_frame_vsync};dataout_frame_href_r    <= {dataout_frame_href_r[1:0]   ,cmos_frame_href};endend// assign dataout_frame_data = {y2,y2,y2};assign dataout_frame_data = y2;assign dataout_frame_ce = dataout_frame_ce_r[2];assign dataout_frame_vsync = dataout_frame_vsync_r[2];assign dataout_frame_href = dataout_frame_href_r[2];endmodule

gamma映射模块

//Curve of Gamma = 2.2
module Curve_Gamma_2P2
(input		[7:0]	Pre_Data,output	reg	[7:0]	Post_Data
);always@(*)
begincase(Pre_Data)8'h00 : Post_Data = 8'h00; 8'h01 : Post_Data = 8'h00; 8'h02 : Post_Data = 8'h00; 8'h03 : Post_Data = 8'h00; 8'h04 : Post_Data = 8'h00; 8'h05 : Post_Data = 8'h00; 8'h06 : Post_Data = 8'h00; 8'h07 : Post_Data = 8'h00; 8'h08 : Post_Data = 8'h00; 8'h09 : Post_Data = 8'h00; 8'h0A : Post_Data = 8'h00; 8'h0B : Post_Data = 8'h00; 8'h0C : Post_Data = 8'h00; 8'h0D : Post_Data = 8'h00; 8'h0E : Post_Data = 8'h00; 8'h0F : Post_Data = 8'h01; 8'h10 : Post_Data = 8'h01; 8'h11 : Post_Data = 8'h01; 8'h12 : Post_Data = 8'h01; 8'h13 : Post_Data = 8'h01; 8'h14 : Post_Data = 8'h01; 8'h15 : Post_Data = 8'h01; 8'h16 : Post_Data = 8'h01; 8'h17 : Post_Data = 8'h01; 8'h18 : Post_Data = 8'h01; 8'h19 : Post_Data = 8'h02; 8'h1A : Post_Data = 8'h02; 8'h1B : Post_Data = 8'h02; 8'h1C : Post_Data = 8'h02; 8'h1D : Post_Data = 8'h02; 8'h1E : Post_Data = 8'h02; 8'h1F : Post_Data = 8'h02; 8'h20 : Post_Data = 8'h03; 8'h21 : Post_Data = 8'h03; 8'h22 : Post_Data = 8'h03; 8'h23 : Post_Data = 8'h03; 8'h24 : Post_Data = 8'h03; 8'h25 : Post_Data = 8'h04; 8'h26 : Post_Data = 8'h04; 8'h27 : Post_Data = 8'h04; 8'h28 : Post_Data = 8'h04; 8'h29 : Post_Data = 8'h05; 8'h2A : Post_Data = 8'h05; 8'h2B : Post_Data = 8'h05; 8'h2C : Post_Data = 8'h05; 8'h2D : Post_Data = 8'h06; 8'h2E : Post_Data = 8'h06; 8'h2F : Post_Data = 8'h06; 8'h30 : Post_Data = 8'h06; 8'h31 : Post_Data = 8'h07; 8'h32 : Post_Data = 8'h07; 8'h33 : Post_Data = 8'h07; 8'h34 : Post_Data = 8'h08; 8'h35 : Post_Data = 8'h08; 8'h36 : Post_Data = 8'h08; 8'h37 : Post_Data = 8'h09; 8'h38 : Post_Data = 8'h09; 8'h39 : Post_Data = 8'h09; 8'h3A : Post_Data = 8'h0A; 8'h3B : Post_Data = 8'h0A; 8'h3C : Post_Data = 8'h0B; 8'h3D : Post_Data = 8'h0B; 8'h3E : Post_Data = 8'h0B; 8'h3F : Post_Data = 8'h0C; 8'h40 : Post_Data = 8'h0C; 8'h41 : Post_Data = 8'h0D; 8'h42 : Post_Data = 8'h0D; 8'h43 : Post_Data = 8'h0D; 8'h44 : Post_Data = 8'h0E; 8'h45 : Post_Data = 8'h0E; 8'h46 : Post_Data = 8'h0F; 8'h47 : Post_Data = 8'h0F; 8'h48 : Post_Data = 8'h10; 8'h49 : Post_Data = 8'h10; 8'h4A : Post_Data = 8'h11; 8'h4B : Post_Data = 8'h11; 8'h4C : Post_Data = 8'h12; 8'h4D : Post_Data = 8'h12; 8'h4E : Post_Data = 8'h13; 8'h4F : Post_Data = 8'h13; 8'h50 : Post_Data = 8'h14; 8'h51 : Post_Data = 8'h14; 8'h52 : Post_Data = 8'h15; 8'h53 : Post_Data = 8'h16; 8'h54 : Post_Data = 8'h16; 8'h55 : Post_Data = 8'h17; 8'h56 : Post_Data = 8'h17; 8'h57 : Post_Data = 8'h18; 8'h58 : Post_Data = 8'h19; 8'h59 : Post_Data = 8'h19; 8'h5A : Post_Data = 8'h1A; 8'h5B : Post_Data = 8'h1A; 8'h5C : Post_Data = 8'h1B; 8'h5D : Post_Data = 8'h1C; 8'h5E : Post_Data = 8'h1C; 8'h5F : Post_Data = 8'h1D; 8'h60 : Post_Data = 8'h1E; 8'h61 : Post_Data = 8'h1E; 8'h62 : Post_Data = 8'h1F; 8'h63 : Post_Data = 8'h20; 8'h64 : Post_Data = 8'h21; 8'h65 : Post_Data = 8'h21; 8'h66 : Post_Data = 8'h22; 8'h67 : Post_Data = 8'h23; 8'h68 : Post_Data = 8'h23; 8'h69 : Post_Data = 8'h24; 8'h6A : Post_Data = 8'h25; 8'h6B : Post_Data = 8'h26; 8'h6C : Post_Data = 8'h27; 8'h6D : Post_Data = 8'h27; 8'h6E : Post_Data = 8'h28; 8'h6F : Post_Data = 8'h29; 8'h70 : Post_Data = 8'h2A; 8'h71 : Post_Data = 8'h2B; 8'h72 : Post_Data = 8'h2B; 8'h73 : Post_Data = 8'h2C; 8'h74 : Post_Data = 8'h2D; 8'h75 : Post_Data = 8'h2E; 8'h76 : Post_Data = 8'h2F; 8'h77 : Post_Data = 8'h30; 8'h78 : Post_Data = 8'h31; 8'h79 : Post_Data = 8'h31; 8'h7A : Post_Data = 8'h32; 8'h7B : Post_Data = 8'h33; 8'h7C : Post_Data = 8'h34; 8'h7D : Post_Data = 8'h35; 8'h7E : Post_Data = 8'h36; 8'h7F : Post_Data = 8'h37; 8'h80 : Post_Data = 8'h38; 8'h81 : Post_Data = 8'h39; 8'h82 : Post_Data = 8'h3A; 8'h83 : Post_Data = 8'h3B; 8'h84 : Post_Data = 8'h3C; 8'h85 : Post_Data = 8'h3D; 8'h86 : Post_Data = 8'h3E; 8'h87 : Post_Data = 8'h3F; 8'h88 : Post_Data = 8'h40; 8'h89 : Post_Data = 8'h41; 8'h8A : Post_Data = 8'h42; 8'h8B : Post_Data = 8'h43; 8'h8C : Post_Data = 8'h44; 8'h8D : Post_Data = 8'h45; 8'h8E : Post_Data = 8'h46; 8'h8F : Post_Data = 8'h47; 8'h90 : Post_Data = 8'h49; 8'h91 : Post_Data = 8'h4A; 8'h92 : Post_Data = 8'h4B; 8'h93 : Post_Data = 8'h4C; 8'h94 : Post_Data = 8'h4D; 8'h95 : Post_Data = 8'h4E; 8'h96 : Post_Data = 8'h4F; 8'h97 : Post_Data = 8'h51; 8'h98 : Post_Data = 8'h52; 8'h99 : Post_Data = 8'h53; 8'h9A : Post_Data = 8'h54; 8'h9B : Post_Data = 8'h55; 8'h9C : Post_Data = 8'h57; 8'h9D : Post_Data = 8'h58; 8'h9E : Post_Data = 8'h59; 8'h9F : Post_Data = 8'h5A; 8'hA0 : Post_Data = 8'h5B; 8'hA1 : Post_Data = 8'h5D; 8'hA2 : Post_Data = 8'h5E; 8'hA3 : Post_Data = 8'h5F; 8'hA4 : Post_Data = 8'h61; 8'hA5 : Post_Data = 8'h62; 8'hA6 : Post_Data = 8'h63; 8'hA7 : Post_Data = 8'h64; 8'hA8 : Post_Data = 8'h66; 8'hA9 : Post_Data = 8'h67; 8'hAA : Post_Data = 8'h69; 8'hAB : Post_Data = 8'h6A; 8'hAC : Post_Data = 8'h6B; 8'hAD : Post_Data = 8'h6D; 8'hAE : Post_Data = 8'h6E; 8'hAF : Post_Data = 8'h6F; 8'hB0 : Post_Data = 8'h71; 8'hB1 : Post_Data = 8'h72; 8'hB2 : Post_Data = 8'h74; 8'hB3 : Post_Data = 8'h75; 8'hB4 : Post_Data = 8'h77; 8'hB5 : Post_Data = 8'h78; 8'hB6 : Post_Data = 8'h79; 8'hB7 : Post_Data = 8'h7B; 8'hB8 : Post_Data = 8'h7C; 8'hB9 : Post_Data = 8'h7E; 8'hBA : Post_Data = 8'h7F; 8'hBB : Post_Data = 8'h81; 8'hBC : Post_Data = 8'h82; 8'hBD : Post_Data = 8'h84; 8'hBE : Post_Data = 8'h85; 8'hBF : Post_Data = 8'h87; 8'hC0 : Post_Data = 8'h89; 8'hC1 : Post_Data = 8'h8A; 8'hC2 : Post_Data = 8'h8C; 8'hC3 : Post_Data = 8'h8D; 8'hC4 : Post_Data = 8'h8F; 8'hC5 : Post_Data = 8'h91; 8'hC6 : Post_Data = 8'h92; 8'hC7 : Post_Data = 8'h94; 8'hC8 : Post_Data = 8'h95; 8'hC9 : Post_Data = 8'h97; 8'hCA : Post_Data = 8'h99; 8'hCB : Post_Data = 8'h9A; 8'hCC : Post_Data = 8'h9C; 8'hCD : Post_Data = 8'h9E; 8'hCE : Post_Data = 8'h9F; 8'hCF : Post_Data = 8'hA1; 8'hD0 : Post_Data = 8'hA3; 8'hD1 : Post_Data = 8'hA5; 8'hD2 : Post_Data = 8'hA6; 8'hD3 : Post_Data = 8'hA8; 8'hD4 : Post_Data = 8'hAA; 8'hD5 : Post_Data = 8'hAC; 8'hD6 : Post_Data = 8'hAD; 8'hD7 : Post_Data = 8'hAF; 8'hD8 : Post_Data = 8'hB1; 8'hD9 : Post_Data = 8'hB3; 8'hDA : Post_Data = 8'hB5; 8'hDB : Post_Data = 8'hB6; 8'hDC : Post_Data = 8'hB8; 8'hDD : Post_Data = 8'hBA; 8'hDE : Post_Data = 8'hBC; 8'hDF : Post_Data = 8'hBE; 8'hE0 : Post_Data = 8'hC0; 8'hE1 : Post_Data = 8'hC2; 8'hE2 : Post_Data = 8'hC4; 8'hE3 : Post_Data = 8'hC5; 8'hE4 : Post_Data = 8'hC7; 8'hE5 : Post_Data = 8'hC9; 8'hE6 : Post_Data = 8'hCB; 8'hE7 : Post_Data = 8'hCD; 8'hE8 : Post_Data = 8'hCF; 8'hE9 : Post_Data = 8'hD1; 8'hEA : Post_Data = 8'hD3; 8'hEB : Post_Data = 8'hD5; 8'hEC : Post_Data = 8'hD7; 8'hED : Post_Data = 8'hD9; 8'hEE : Post_Data = 8'hDB; 8'hEF : Post_Data = 8'hDD; 8'hF0 : Post_Data = 8'hDF; 8'hF1 : Post_Data = 8'hE1; 8'hF2 : Post_Data = 8'hE3; 8'hF3 : Post_Data = 8'hE5; 8'hF4 : Post_Data = 8'hE7; 8'hF5 : Post_Data = 8'hEA; 8'hF6 : Post_Data = 8'hEC; 8'hF7 : Post_Data = 8'hEE; 8'hF8 : Post_Data = 8'hF0; 8'hF9 : Post_Data = 8'hF2; 8'hFA : Post_Data = 8'hF4; 8'hFB : Post_Data = 8'hF6; 8'hFC : Post_Data = 8'hF8; 8'hFD : Post_Data = 8'hFB; 8'hFE : Post_Data = 8'hFD; 8'hFF : Post_Data = 8'hFF; endcase
endendmodule

vitis代码

//作者:抢公主的大魔王
//功能:gamma映射
//日期:24.5.27
//版本:1v0
//联系方式:2376635586@qq.com
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "xil_types.h"
#include "xil_cache.h"
#include "xparameters.h"
#include "xgpiops.h"
#include "xscugic.h"
#include "xil_exception.h"
#include "xplatform_info.h"
#include "xaxivdma.h"
#include "xaxivdma_i.h"
#include "display_ctrl_hdmi/display_ctrl.h"
#include "vdma_api/vdma_api.h"
#include "emio_sccb_cfg/emio_sccb_cfg.h"
#include "ov5640/ov5640_init.h"
#include "sleep.h"//宏定义
#define DYNCLK_BASEADDR  	XPAR_AXI_DYNCLK_0_BASEADDR  //动态时钟基地址
#define VDMA_ID          	XPAR_AXIVDMA_0_DEVICE_ID    //VDMA器件ID
#define DISP_VTC_ID      	XPAR_VTC_0_DEVICE_ID        //VTC器件ID
//#define THRESHOLD_BASEADDR 	XPAR_AXICTRLTHRESHOLD_0_S00_AXI_BASEADDR#define EMIO_SCL_NUM 54
#define EMIO_SDA_NUM 55
#define KEY1 56 //T19
#define KEY2 57 //P19
#define KEY3 58 //U20
#define KEY4 59 //U19
#define KEY5 60 //V20
#define LED1 61 //H18
#define LED2 62 //K17
#define LED3 63 //E19#define GPIO_DEVICE_ID  	XPAR_XGPIOPS_0_DEVICE_ID
XGpioPs Gpio;
#define GPIO_BANK	XGPIOPS_BANK0  /* Bank 0 of the GPIO Device */
#define INTC_DEVICE_ID		XPAR_SCUGIC_SINGLE_DEVICE_ID
#define GPIO_INTERRUPT_ID	XPAR_XGPIOPS_0_INTR//全局变量
//frame buffer的起始地址
unsigned int const frame_buffer_addr = (XPAR_PS7_DDR_0_S_AXI_BASEADDR+ 0x1000000);
//u8 binary_threshold = 128;
XAxiVdma     vdma;
DisplayCtrl  dispCtrl;
VideoMode    vd_mode;static XScuGic Intc; /* The Instance of the Interrupt Controller Driver */static void IntrHandler(void *CallBackRef, u32 Bank, u32 Status)
{XGpioPs *Gpio_cb = (XGpioPs *)CallBackRef;if (XGpioPs_IntrGetStatusPin(Gpio_cb, KEY1)){//binary_threshold++;//Xil_Out32(THRESHOLD_BASEADDR, binary_threshold);//xil_printf("The threshold has been changed\n\rThe threshold now is %d\n\r",binary_threshold);XGpioPs_IntrClearPin(Gpio_cb, KEY1);}else if (XGpioPs_IntrGetStatusPin(Gpio_cb, KEY4)){//binary_threshold--;//Xil_Out32(THRESHOLD_BASEADDR, binary_threshold);//xil_printf("The threshold has been changed\n\rThe threshold now is %d\n\r",binary_threshold);XGpioPs_IntrClearPin(Gpio_cb, KEY4);}else if (XGpioPs_IntrGetStatusPin(Gpio_cb, KEY2)){//binary_threshold = binary_threshold+10;//Xil_Out32(THRESHOLD_BASEADDR, binary_threshold);//xil_printf("The threshold has been changed\n\rThe threshold now is %d\n\r",binary_threshold);XGpioPs_IntrClearPin(Gpio_cb, KEY2);}else if (XGpioPs_IntrGetStatusPin(Gpio_cb, KEY5)){//binary_threshold = binary_threshold-10;//Xil_Out32(THRESHOLD_BASEADDR, binary_threshold);//xil_printf("The threshold has been changed\n\rThe threshold now is %d\n\r",binary_threshold);XGpioPs_IntrClearPin(Gpio_cb, KEY5);}else if (XGpioPs_IntrGetStatusPin(Gpio_cb, KEY3)){//binary_threshold = 128;//Xil_Out32(THRESHOLD_BASEADDR, binary_threshold);//xil_printf("The threshold has been reset\n\rThe threshold now is %d\n\r",binary_threshold);XGpioPs_IntrClearPin(Gpio_cb, KEY3);}XGpioPs_WritePin(&Gpio, LED1, !XGpioPs_ReadPin(&Gpio, LED1));
}void SetupInterruptSystem(XScuGic *GicInstancePtr, XGpioPs *Gpio,u16 GpioIntrId){XScuGic_Config *IntcConfig;Xil_ExceptionInit();IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);XScuGic_CfgInitialize(GicInstancePtr, IntcConfig,IntcConfig->CpuBaseAddress);Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,(Xil_ExceptionHandler)XScuGic_InterruptHandler,GicInstancePtr);XScuGic_Connect(GicInstancePtr, GpioIntrId,(Xil_ExceptionHandler)IntrHandler,(void *)Gpio);XScuGic_Enable(GicInstancePtr, GpioIntrId);XGpioPs_SetIntrTypePin(Gpio, KEY1,  XGPIOPS_IRQ_TYPE_EDGE_FALLING);XGpioPs_SetIntrTypePin(Gpio, KEY2,  XGPIOPS_IRQ_TYPE_EDGE_FALLING);XGpioPs_SetIntrTypePin(Gpio, KEY3,  XGPIOPS_IRQ_TYPE_EDGE_FALLING);XGpioPs_SetIntrTypePin(Gpio, KEY4,  XGPIOPS_IRQ_TYPE_EDGE_FALLING);XGpioPs_SetIntrTypePin(Gpio, KEY5,  XGPIOPS_IRQ_TYPE_EDGE_FALLING);XGpioPs_IntrEnablePin(Gpio, KEY1);XGpioPs_IntrEnablePin(Gpio, KEY2);XGpioPs_IntrEnablePin(Gpio, KEY3);XGpioPs_IntrEnablePin(Gpio, KEY4);XGpioPs_IntrEnablePin(Gpio, KEY5);Xil_ExceptionEnableMask(XIL_EXCEPTION_IRQ);
}void Gpio_Init(void){XGpioPs_Config *ConfigPtr;ConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID);XGpioPs_CfgInitialize(&Gpio, ConfigPtr,ConfigPtr->BaseAddr);XGpioPs_SetDirectionPin(&Gpio, LED1, 1);XGpioPs_SetOutputEnablePin(&Gpio, LED1, 1);XGpioPs_WritePin(&Gpio, LED1, 0);XGpioPs_SetDirectionPin(&Gpio, LED2, 1);XGpioPs_SetOutputEnablePin(&Gpio, LED2, 1);XGpioPs_WritePin(&Gpio, LED2, 0);XGpioPs_SetDirectionPin(&Gpio, LED3, 1);XGpioPs_SetOutputEnablePin(&Gpio, LED3, 1);XGpioPs_WritePin(&Gpio, LED3, 0);XGpioPs_SetDirectionPin(&Gpio, KEY1, 0);XGpioPs_SetDirectionPin(&Gpio, KEY2, 0);XGpioPs_SetDirectionPin(&Gpio, KEY3, 0);XGpioPs_SetDirectionPin(&Gpio, KEY4, 0);XGpioPs_SetDirectionPin(&Gpio, KEY5, 0);SetupInterruptSystem(&Intc, &Gpio, GPIO_INTERRUPT_ID);}int main(void)
{u32 status;u16 cmos_h_pixel;                    //ov5640 DVP 输出水平像素点数u16 cmos_v_pixel;                    //ov5640 DVP 输出垂直像素点数u16 total_h_pixel;                   //ov5640 水平总像素大小u16 total_v_pixel;                   //ov5640 垂直总像素大小cmos_h_pixel = 1280;cmos_v_pixel = 720;total_h_pixel = 2570;total_v_pixel = 980;emio_init();status = ov5640_init( cmos_h_pixel,  //初始化ov5640cmos_v_pixel,total_h_pixel,total_v_pixel);//设置OV5640输出分辨率为1280*720  PCLK = 72Mhzif(status == 0)xil_printf("OV5640 detected successful!\r\n");elsexil_printf("OV5640 detected failed!\r\n");vd_mode = VMODE_1280x720;//配置VDMArun_vdma_frame_buffer(&vdma, VDMA_ID, vd_mode.width, vd_mode.height,frame_buffer_addr,0,0,BOTH);//初始化Display controllerDisplayInitialize(&dispCtrl, DISP_VTC_ID, DYNCLK_BASEADDR);//设置VideoModeDisplaySetMode(&dispCtrl, &vd_mode);DisplayStart(&dispCtrl);Gpio_Init();while(1){XGpioPs_WritePin(&Gpio, LED3, !XGpioPs_ReadPin(&Gpio, LED3));sleep(1);}return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/333767.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

1992-2022年经过矫正的夜间灯光数据

DMSP/OLS夜间灯光的年份是1992-2013年&#xff0c;NPP/VIIRS夜间灯光的年份是2012-2021&#xff0c;且由于光谱分辨率、空间分辨率、辐射分辨率、产品更新周期等方面的差异&#xff0c;DMSP-OLS和SNPP-VIIRS数据不兼容&#xff0c;也就是说我们无法直接对比分析DMSP-OLS和SNPP-…

多线程基本常识

多线程的状态 在Java中&#xff0c;一个线程的生命周期有以下几种状态&#xff1a; 新建&#xff08;New&#xff09;&#xff1a;当线程对象被创建时&#xff0c;线程处于新建状态。此时线程对象存在&#xff0c;但还没有调用start()方法启动线程。 运行&#xff08;Runnable…

满帮集团 Eureka 和 ZooKeeper 的上云实践

作者&#xff1a;胡安祥 满帮集团&#xff0c;作为“互联网物流”的平台型企业&#xff0c;一端承接托运人运货需求&#xff0c;另一端对接货车司机&#xff0c;提升货运物流效率。2021 年美股上市&#xff0c;成为数字货运平台上市第一股。根据公司年报&#xff0c;2021 年&a…

C++ (week5):Linux系统编程3:线程

文章目录 三、线程1.线程的基本概念①线程相关概念②我的理解 2.线程的基本操作 (API)(1)获取线程的标识&#xff1a;pthread_self(2)创建线程&#xff1a;pthread_create()(3)终止线程①pthread_exit()&#xff1a;当前线程终止&#xff0c;子线程主动退出②pthread_cancel()&…

深入解析BGP:互联网路由协议的全貌与应用

BGP&#xff08;Border Gateway Protocol&#xff09;是互联网上用于在自治系统&#xff08;AS&#xff09;之间交换路由信息的协议。它负责决定数据包的最佳路径以及路由的选择。以下是BGP的一些关键特点和工作原理的详细内容&#xff1a; BGP的特点&#xff1a; 1.路径矢量型…

Android开发 -- JNI开发

1.配置JNI环境 创建JNI文件夹 在项目的主目录中创建一个名为 JNI 的文件夹。这个文件夹将包含所有的本地源代码和配置文件。 编写Android.mk文件 这个文件是一个 Makefile&#xff0c;用来指导 NDK 如何编译和构建本地代码。 #清除之前定义的变量&#xff0c;确保每个模块的…

《python编程从入门到实践》day40

# 昨日知识点回顾 编辑条目及创建用户账户 暂没能解决bug&#xff1a; The view learning_logs.views.edit_entry didnt return an HttpResponse object. It returned None instead.# 今日知识点学习 19.2.5 注销 提供让用户注销的途径 1.在base.html中添加注销链接 …

运维笔记.Docker镜像分层原理

运维专题 Docker镜像原理 - 文章信息 - Author: 李俊才 (jcLee95) Visit me at CSDN: https://jclee95.blog.csdn.netMy WebSite&#xff1a;http://thispage.tech/Email: 291148484163.com. Shenzhen ChinaAddress of this article:https://blog.csdn.net/qq_28550263/artic…

探讨大米自动化生产线包装设备的智能化发展趋势

随着科技的飞速发展&#xff0c;智能化已经成为各行各业转型升级的重要方向。在大米生产领域&#xff0c;自动化生产线包装设备的智能化发展更是引领着粮食产业的未来潮流。星派将从智能化技术、市场需求、发展趋势等方面&#xff0c;探讨大米自动化生产线包装设备的智能化发展…

java图书电子商务网站的设计与实现源码(springboot+vue+mysql)

风定落花生&#xff0c;歌声逐流水&#xff0c;大家好我是风歌&#xff0c;混迹在java圈的辛苦码农。今天要和大家聊的是一款基于springboot的图书电子商务网站的设计与实现。项目源码以及部署相关请联系风歌&#xff0c;文末附上联系信息 。 项目简介&#xff1a; 图书电子商…

鸿蒙ArkTS声明式开发:跨平台支持列表【按键事件】

按键事件 按键事件指组件与键盘、遥控器等按键设备交互时触发的事件&#xff0c;适用于所有可获焦组件&#xff0c;例如Button。对于Text&#xff0c;Image等默认不可获焦的组件&#xff0c;可以设置focusable属性为true后使用按键事件。 说明&#xff1a; 开发前请熟悉鸿蒙开…

嵌入式进阶——外部中断(EXTI)

&#x1f3ac; 秋野酱&#xff1a;《个人主页》 &#x1f525; 个人专栏:《Java专栏》《Python专栏》 ⛺️心若有所向往,何惧道阻且长 文章目录 STC8H中断外部中断外部中断编写配置外部中断调用中断触发函数 外部中断测试测试外部中断0测试外部中断2、3或者4 PCB中断设计 STC8…

echarts取消纵坐标,自定义提示内容,完整 echarts 布局代码

效果图 实现代码 开启点击柱子时的提示内容 //完整写法请看下面tooltip: {trigger: axis,axisPointer: {type: shadow}},自定义提示内容 //完整写法请看下面formatter: function (param) {// param是悬浮窗所在的数据&#xff08;x、y轴数据&#xff09;let relVal "&…

【华为】将eNSP导入CRT,并解决不能敲Tab问题

华为】将eNSP导入CRT&#xff0c;并解决不能敲Tab问题 eNSP导入CRT打开eNSP&#xff0c;新建一个拓扑右键启动查看串口号关联CRT成功界面 SecureCRT连接华为模拟器ensp,Tab键不能补全问题选择Options&#xff08;选项&#xff09;-- Global Options &#xff08;全局选项&#…

LangChain技术解密:构建大模型应用的全景指南

&#x1f482; 个人网站:【 摸鱼游戏】【神级代码资源网站】【工具大全】&#x1f91f; 一站式轻松构建小程序、Web网站、移动应用&#xff1a;&#x1f449;注册地址&#x1f91f; 基于Web端打造的&#xff1a;&#x1f449;轻量化工具创作平台&#x1f485; 想寻找共同学习交…

vue3父组件改变 子组件不改变(uniapp)

项目中遇到了这么个问题 场景&#xff1a;封装select组件&#xff0c;通过子组件选中后传递值给父组件&#xff0c;父组件需要回显这个值&#xff08;这里使用 defineProps和defineEmits就可以实现&#xff0c;或者直接使用defineModel也可以实现&#xff0c;但是uniapp目前不…

学习编程对英语要求高吗?

学习编程并不一定需要高深的英语水平。我这里有一套编程入门教程&#xff0c;不仅包含了详细的视频讲解&#xff0c;项目实战。如果你渴望学习编程&#xff0c;不妨点个关注&#xff0c;给个评论222&#xff0c;私信22&#xff0c;我在后台发给你。 虽然一些编程资源和文档可能…

AI大模型在测试中的深度应用与实践案例

文章目录 1. 示例项目背景2. 环境准备3. 代码实现3.1. 自动生成测试用例3.2. 自动化测试脚本3.3. 性能测试3.4. 结果分析 4. 进一步深入4.1. 集成CI/CD管道4.1.1 Jenkins示例 4.2. 详细的负载测试和性能监控4.2.1 Locust示例 4.3. 测试结果分析与报告 5. 进一步集成和优化5.1. …

文件上传漏洞:pikachu靶场中的文件上传漏洞通关

目录 1、文件上传漏洞介绍 2、pikachu-client check 3、pikachu-MIME type 4、pikachu-getimagesize 最近在学习文件上传漏洞&#xff0c;这里使用pikachu靶场来对文件上传漏洞进行一个复习练习 废话不多说&#xff0c;开整 1、文件上传漏洞介绍 pikachu靶场是这样介绍文…

一键批量整理神器:轻松将相同名称文件归类至指定文件夹,告别繁琐文件管理!

信息爆炸的时代&#xff0c;电脑中的文件数量如潮水般涌现&#xff0c;管理起来令人头疼不已。您是否曾因为文件命名不规范而耗费大量时间寻找某个重要资料&#xff1f;是否曾因为文件散落各处而影响了工作效率&#xff1f;现在&#xff0c;我们为您隆重推荐一款文件管理神器—…