delphi使用imageen对图像进行纠偏
var
dd: double;
ww, hh, perx, pery: integer;
tk1, tk2: dword;
ww := ImageEnView1.IEBitmap.Width;
perx := trunc(ww * 10 / 100); // 10% of the width
hh := ImageEnView1.IEBitmap.Height;
pery := trunc(hh * 10 / 100); // 10% of the height
ImageEnView1.SelectionBase := iesbBitmap;
ImageEnView1.Select(perx, pery, ww - perx, hh - pery, iespReplace);
ImageEnView1.Proc.CropSel;
ImageEnView1.Deselect;
// detect orientation
tk1 := gettickcount;
if not CheckBox1.Checked then
dd := ImageEnView1.Proc.SkewDetection(300, 15, 0.1, true)
else
dd := ImageEnView1.Proc.SkewDetection(0, 15, 0.1, false); // another way
tk2 := gettickcount;
Label9.Caption := inttostr(tk2 - tk1) + ' ms';
// reset original image
ImageEnView1.proc.Undo;
ImageEnView2.Assign(ImageEnView1);
// adjust image (rotate)
Label3.caption := 'Rotating...';
application.processmessages;
imageenview2.Background := clwhite;
//ImageEnView2.Proc.Rotate(dd);
ImageEnView2.Proc.RotateAndCrop(dd);