/*************************************************************************\
* "$RCSfile: ImgLibDemo.cpp,v $"                                          *
***************************************************************************
* Information by CVS or VSS:                                              *
*     Last check in on: $Date: 2007-11-02 15:44:26 $                      *
*     by                $Author: schluckebier $
*     Revision        : $Revision: 1.2 $                                  *
***************************************************************************
* (c) 2004 - 2006 Strampe Systemelektronik GmbH & Co. KG                  *
\*************************************************************************/

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "vision_box.h"
#include "GUI_Lib.h"
#include <csl_cache.h>
#include "VIC_PS.h"
#include <mem.h>

extern "C"{
#include "img_thr_gt2max.h"
#include "img_thr_gt2thr.h"
#include "img_thr_le2thr.h"
#include "img_thr_le2min.h"
#include "img_perimeter.h"
#include "img_sobel.h"
}

void ImgLibDemo(YIMAGE *pSrc, YIMAGE *pDst)
{
	static int InitDone = 0;
	static int i = 100;
	static unsigned char *LineBuffer;
	int j;

	if (!InitDone)
	{
		LineBuffer = (unsigned char*) MEM_alloc(ISRAM, pSrc->Width, 128);
		InitDone = 1;
	}

	// *** threshold ***
	for (j=0; j<pSrc->Height; j++)
	{
		int Offset = (short)j*(short)pSrc->Width;
		IMG_thr_gt2max(&pSrc->pY[Offset], LineBuffer, pSrc->Width, 1, i);
		IMG_thr_le2min(LineBuffer, &pDst->pY[Offset], pSrc->Width, 1, 254);
	}

}
/*************************************************************************/
