histogram.c

来自「基于dsp6416处理器的边缘检测算法」· C语言 代码 · 共 78 行

C
78
字号
//#include <stdio.h>
#include <csl.h>
#include <csl_edma.h>
#include <csl_dat.h>
#include <std.h>
#include <sys.h>
#include <tsk.h>
#include <log.h>

#include "iekc64.h"
#include "img_ycbcr422p_rgb565.h"     //header file for C64x IMGLIB

#include "agl.h"
#include "agl_string.h"
#include "agl_font.h"
#include "agl_font_lucida.h"

#include "basic_op.h"

void statistic_count(struct YUV422_image * in_image,Uint8* histgram,int len)
{
int i;
#if 1	
for(i=0;i<255;i++)
	histgram[i]=i;
histgram[4]=245;	
histgram[6]=245;	
histgram[16]=200;	
histgram[64]=160;
histgram[66]=180;
histgram[70]=190;
histgram[78]=210;	
#endif
}

void image_histogram(struct YUV422_image * in_image,
   	     struct YUV422_image * out_image)
{

DRAW_Point start,end;   
DRAW_Point point;       
Bool bStatus;	
int i;
Uint8 * p_worked_YUV=out_image->p_data;

Uint8 histgram[256];	

statistic_count(in_image,&histgram[0],256);


    start.x = 10;
    start.y = 10;
    end.x = 10;
    end.y = 260;         
    
    bStatus = myDRAW_line(p_worked_YUV, 352, 288, start, end, DRAW_RED);    
    start.x = 10;
    start.y = 260;
    end.x = 330;
    end.y = 260;    
    bStatus = myDRAW_line(p_worked_YUV, 352, 288, start, end, DRAW_RED);       
    // Check the status
        if(bStatus == false)
                printf("Point out of bounds\n");	
                

for(i=0;i<255;i++)
	{
	 start.x=i+10;
	 start.y=260;
	 
	 end.x=i+10;
	 end.y=260-histgram[i];
bStatus = myDRAW_line(p_worked_YUV, 352, 288, start, end, DRAW_BLUE);       	 
	}
}
		  

⌨️ 快捷键说明

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