图像处理之基于链码跟踪的大米数量检测
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "bmpFile.h"
#include "FastSobelShenJun.h"
#include "OtsuThre.h"
#include "ChainCode.h"
void test_SJ()
{
clock_t t1,t2;
int width,height;
BYTE *pGryImg=Read8BitBmpFile2Img("..//BmpOrgFile//LDW.bmp",&width,&height);
BYTE *pResImg=new BYTE [width*height];
t1=clock();
for(int k=0;k<100;k++)
ShenJunEdgeFast(pGryImg,width,height,0.3,20,pResImg);
t2=clock();
printf("\n%d",t2-t1);
Write8BitImg2BmpFile(pResImg,width,height,"..//BmpResFile//SJ_03_20.bmp");
delete pGryImg;
delete pResImg;
printf("\nPress any key to exit!");
getchar();
getchar();
return;
}
void test_rice()
{
int width,height;
BYTE *pGryImg=Read8BitBmpFile2Img("..//BmpOrgFile//rice_light_corrected.bmp",&width,&height);
BYTE *pCodeBuf=new BYTE [width*height];
BYTE *pResImg=new BYTE [width*height];