📄 transformations.dpr
字号:
program Transformations;
uses
Forms,
IPL in '..\Ipl.pas',
OpenCV in '..\OpenCV.pas',
highGui in '..\highGui.pas';
{$R *.res}
const w = 500 ;
var imgA,imgB,img,grayimg ,edgeimg: 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;
lines : pCvSeq;
p1,p2 : cvPoint;
var dx,dy : integer;
white , black : CvScalar;
angle : double = 40.0;
scale : double = 1.0;
edgeX : pIplImage;
center : CvPoint2D32f;
affine_mat,rot_mat : pcVMat;
aValue : double;
begin
//--- Cargo una imagen
imgA := cvLoadImage( 'image_sample4.jpg', -1);
imgB := cvCreateImage( cvSize_( imgA.width,imgA.Height), IPL_DEPTH_8U, 3);
center := cvPoint2D32f_( imgA.width/2.0, imgA.height/2.0);
//// Matriz de Deformacion
affine_mat := cvCreateMat( 2, 3, CV_32FC1);
cvSetReal2D( affine_mat, 0, 0, 1.06603);
cvSetReal2D( affine_mat, 0, 1, -0.84641);
cvSetReal2D( affine_mat, 0, 2, 93.11797);
cvSetReal2D( affine_mat, 1, 0, 0.15359);
cvSetReal2D( affine_mat, 1, 1, 0.66603);
cvSetReal2D( affine_mat, 1, 2, 20.41745);
aValue := cvGetReal2D(affine_mat,0,2);
cvWarpAffine( imgA, imgB, affine_mat, CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS,cvScalarAll(0));
//-- Hay un problema con el formato de la Matriz
cvNamedWindow( 'image', 1 );
cvShowImage( 'image', imgB );
cvWaitKey(0);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -