+ -
当前位置:首页 → 问答吧 → delphi中使用opencv进行bmp转pIplimage的问题.

delphi中使用opencv进行bmp转pIplimage的问题.

时间:2011-08-13

来源:互联网

在delphi利用opencv进行boost算法时,对同一张图片进行检测的过程中,对bmp转pIplimage采用了2种方法:

一种是利用cvLoadImage('1.bmp'),该方法能准确进行检测;但当我利用bmp2IplImg的方法时,却不能进行精准的检测,各位大虾我的程序到底哪里的问题啊?代码部分附下:
  boostbmp:= tbitmap.create;
  boostbmp.LoadFromFile(getcurrentdir+'\1.bmp');
  boostbmp.Width := 320;
  boostbmp.Height := 240;
  boostbmp.PixelFormat := pf24bit;
//////////////////////////////////////////////////////////////////////////////////////bmp转iplimg
///////////////////////////////////////////////////////////////////////////////(问题就出现这部分)
  dest := cvCreateImage(cvSize_(320,240), IPL_DEPTH_8U,3);
  dest.Origin := IPL_ORIGIN_BL;
  CopyMemory(dest.ImageData, boostbmp.ScanLine[boostbmp.Height - 1], dest.ImageSize);
///////////////////////////////////////////////////////////////////////////////////////////////
  storage := cvCreateMemStorage(0);
  doHaar(dest,bmp);//此过程cvHaarDetectObjects检测物体
  self.formImage.width := bmp.width;
  self.formImage.height := bmp.height;
  self.formImage.canvas.StretchDraw(self.formImage.canvas.ClipRect , bmp);

作者: IsTrueMan   发布时间: 2011-08-13

转换是成功的,但是检测效果与cvLoadImage方法比,就完全不同了,急求大虾答疑!

作者: IsTrueMan   发布时间: 2011-08-13

热门下载

更多