⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contour3.dpr

📁 Delphi版本的OpenCV头文件库(以及诸多实例)
💻 DPR
字号:
program HoughLines;
uses
  Forms,
  IPL in '..\openCV\Ipl.pas',
  OpenCV in '..\openCV\OpenCV.pas',
  highGui in '..\openCV\highGui.pas';

{$R *.res}
const w =  500 ;
var  imgA,imgB,img : pIplImage;
     box :  CvBox2D ;
     storage : pcvMemStorage;
     contours,Approx_contours : pCvSeq;
     res : integer;
     cS : cvSize ;
     i,j : integer;
     levels : integer = 3;
     rect :cvRect;
     pt : array [0..3] of  CvPoint2D32f;


var dx,dy : integer;
    white  , black : CvScalar;
    angle : double;
begin
    imgA := cvLoadImage( 'image_sample16.bmp', -1);
    imgB := cvCreateImage( cvSize_(imgA.Width,imgA.Height), 8, 3 );
    cvZero( imgB );
  //    cvCvtColor( imgA, imgB, CV_GRAY2BGR);

    cvNamedWindow( 'image', 1 );
    cvShowImage( 'image', imgA );
    storage := cvCreateMemStorage(0);
    cvFindContours( imgA, storage, @contours, sizeof(CvContour),
                    CV_RETR_LIST, CV_CHAIN_APPROX_NONE, cvPoint_(0,0) );
    //--- Esta funcion no esta Andando
 //   Approx_contours := cvApproxPoly( @contours, sizeof(CvContour), storage, 0, 10.0, 1 );
    cvDrawContours( imgB, contours, CV_RGB(255,0,0), CV_RGB(0,255,0), 7, 3, CV_AA, cvPoint_(0,0) );
    rect := cvBoundingRect( contours, 0);
    cvRectangle( imgB, cvPoint_(rect.x,rect.y), cvPoint_( rect.x+rect.width,rect.y+rect.height),   CV_RGB( 255, 0, 0), 2, 8, 0);
    cvNamedWindow( 'contours', 1 );
    cvWaitKey(0);
end.



⌨️ 快捷键说明

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