constructor Create(ms: TStream); overload;
= Length(fEigenSystem.EigenVectors); end;
function KLFourierFeatureExtractor.GetID: string; begin
= 'FE_KLF'; end;
constructor KLFourierFeatureExtractor.Create(ms: TStream); begin fe := FourierDescriptorsFeatureExtractor.Create; inherited Create(ms); end;
constructor KLFourierFeatureExtractor.Create; begin fe := FourierDescriptorsFeatureExtractor.Create; inherited Create; end;
constructor KLFourierFeatureExtractor.Create(c: Coach); const imgDim: integer = 16; var numOfVectors, i: integer; samplesCount: integer; dataSamples: TFloatMatrix; idx: integer; ex: CharacterTemplate; begin fe := FourierDescriptorsFeatureExtractor.Create; // inherited Create(c); numOfVectors := fe.FeatureVectorLength div 2; samplesCount := c.GetPatternsCount() * 10; //Get 30 patterns of ech class; SetLength(dataSamples, samplesCount, fe.FeatureVectorLength); for i := 0 to samplesCount - 1 do begin ex := c.GetSample(idx); fe.GetFeatures(ex, @(dataSamples[i])); end; fEigenSystem := TKarhunenLoeveTransform.CreateBasis(dataSamples, numOfVectors, 10, 5E-18); SetLength(dataSamples, 0, 0); end;
constructor KLFourierFeatureExtractor.Create(eigenSystem: TEigenSystem); begin fe := FourierDescriptorsFeatureExtractor.Create; inherited Create(eigenSystem); end;
destructor KLFourierFeatureExtractor.Destroy; begin fe.Free; inherited;
end;
procedure KLFourierFeatureExtractor.GetFeatures( data: IPixelEnumerator; const features: PFloatArray); var imgVec: TFloatArray; begin SetLEngth(imgVec, fe.GetFVLength); fe.GetFeatures(data, @imgVec); TKarhunenLoeveTransform.GetFeatureVector(@imgVec, features, fEigenSystem.EigenVectors, fEigenSystem.MeanVector); end;
function KLFourierFeatureExtractor.GetFVLength: integer; begin