unit filterLogPolar;
(* ***** BEGIN LICENSE BLOCK *****
* Copyright (C) 2004 Durand Emmanuel
* Copyright (C) 2004 Burgel Eric
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact :
* filters@edurand.com
* filters@burgel.com
*
* ***** END LICENSE BLOCK ***** *)
{
edurand (filters@edurand.com)
}
{
use 'OpenCv' implementation
}
interface
uses
filter, fparameters, image;
type
TFilterLogPolar = class(TFilter)
public
constructor Create; override;
procedure Run(); override;
private
parameterImageIn, parameterImageOut : TParameterImage;
parameterMagnitude : TParameterInteger;
parameterReinverseTransformation : TParameterBoolean;
end;
implementation
uses
Windows, imageIO, wrapper_opencv, SysUtils;
constructor TFilterLogPolar.Create;
begin
inherited;
parameterImageIn:=addParameterImage('inImage', 'input image');
parameterImageOut:=addParameterImage('outImage', 'result image');
parameterMagnitude:=addParameterInteger('magnitude','Magnitude scale parameter',1,1000,400);
parameterReinverseTransformation:=addParameterBoolean('reinverseTransformation','Inverse transformation : src(phi,rho)->dst(x,y),',True);
end;
procedure TFilterLogPolar.Run();
var
roi : TRect;
x,y : Integer;
magnitude : Single;
reinverseTransformation : Integer;
begin
if (parameterImageIn.Image<>nil) and (parameterImageOut.Image<>nil) then begin
roi:=getRegionOfInterest(parameterImageIn.Image);
x:=roi.Left+((roi.Right-roi.Left) div 2);
y:=roi.Top+((roi.Bottom-roi.Top) div 2);
magnitude:=parameterMagnitude.Value / 10.;
reinverseTransformation:=1;
if parameterReinverseTransformation.Value=False then reinverseTransformation:=0;
wrapper_opencv.filterCvLogPolar(
parameterImageIn.Image, parameterImageOut.Image,
x,y,
magnitude,
reinverseTransformation
);
end;
end;
end.