Konuyu Oyla:
  • Derecelendirme: 5/5 - 1 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Yuz tanima to el tanima
#1
Merhaba,
 projemde kullancagim el hareketlerini algilamak uzerine arastirma yapiyorum yuz tanima islemini yapan ornek buldum karsilastirma yapiyor ama neye gore nasil karsilastirma yaptigini cozemedim,
Bir diger ornekte ise el hareketini kare icine aliyor bu el hareketinin kareye alan kismini kaydedecegim bu yuz tanima projesine upload edecegim fakat yuz tanima sadece yuu taniyor el hareketine nasil odak yaparim nereye mudahale edebilirim sizlere sormak istedim.
tesekkurler


yuz tanima pass dosyasi:

unit umain;

interface

uses
 Windows, Messages, SysUtils, {$IfNDef VER130} Variants, {$EndIf} Classes, Graphics, Controls, Forms,
 Dialogs, ievision, Menus, imageenview, ieview, iemview, hyieutils,
 StdCtrls, ExtCtrls, CheckLst, iexBitmaps, hyiedefs, iesettings, iexLayers, iexRulers;

type
 TMainForm = class(TForm)
   ImageEnView1: TImageEnView;
   Panel1: TPanel;
   btnOpen: TButton;
   btnViewDB: TButton;
   procedure btnViewDBClick(Sender: TObject);
   procedure FormCreate(Sender: TObject);
   procedure btnOpenClick(Sender: TObject);
   procedure FormClose(Sender: TObject; var Action: TCloseAction);
 private
   { Private declarations }
   m_exePath: string;
   m_objectsFinder: TIEVisionObjectsFinder;
   m_faceRecognizer: TIEVisionFaceRecognizer;
   m_faces: TIEMultiBitmap;

   procedure LoadImage(const sFilename: string);
   procedure ExtractFaces();
   procedure AddFace(Rect: TIEVisionRect);
   procedure TrainDataset();
 public
   { Public declarations }
 end;

var
 MainForm: TMainForm;

implementation

uses
 ulabelface, usaving, uviewfaces, iexHelperFunctions, uIEVisionPath;

{$R *.DFM}
{$R ImageEnManifest.res}


const
 CLASSIFIERS: array [0..1] of AnsiString = (IEVC_FRONTAL_FACE_DEFAULT, IEVC_PROFILE_FACE);

 FACESFILENAME = 'faces.dat';
 LEARNFILENAME = 'learn.dat';


procedure TMainForm.FormCreate(Sender: TObject);
var
 sDLLPath: string;
 i: integer;
 classifier: AnsiString;
begin
 // Calling IEInitialize_ievision is NOT required if the IEVision DLL is located in the same folder as the EXE or on the system path
 // You need only call IEVisionAvailable which will automatically call IEInitialize_ievision
 sDLLPath := FindIEVisionDLLPath();
 if sDLLPath <> '' then
   IEInitialize_ievision(sDLLPath, False); // Initialize DLL in custom location

 if not IEVisionAvailable() then
 begin
   ShowMessage('This application requires the ievision.dll plug-in, v' + IEVC_EXPECTED_LIBRARY_VERSION +'. Please download it from http://www.imageen.com');
   Application.Terminate;
   exit;
 end;

 m_exePath := IncludeTrailingBackSlash(ExtractFilePath(Application.ExeName));

 m_faces := TIEMultiBitmap.Create();
 if FileExists(m_exePath + FACESFILENAME) then
   m_faces.LoadSnapshot(m_exePath + FACESFILENAME);

 // setup face detector(s)
 m_objectsFinder := IEVisionLib().createObjectsFinder();
 for i := 0 to High(CLASSIFIERS) do
 begin
   classifier := CLASSIFIERS[i];
   m_objectsFinder.addClassifier( PAnsiChar( classifier ), IEVisionLib.createCascadeClassifier( PAnsiChar( classifier )));
 end;

 m_objectsFinder.setDivisor(1);
 m_objectsFinder.setHaarScaleFactor(1.1);
 m_objectsFinder.setHaarMinNeighbors(5);
 m_objectsFinder.setHaarFlags(ievSCALE_IMAGE);
 m_objectsFinder.setEqualizeHistogram(false);
 m_objectsFinder.setHaarMinSize(IEVisionSize(30, 30));

 // setup face recognizer
 m_faceRecognizer := IEVisionLib().createFaceRecognizer();
 m_faceRecognizer.selectEigenFaceRecognizer();
 if FileExists(m_exePath + LEARNFILENAME) then
   m_faceRecognizer.load(PWideChar(WideString(m_exePath + LEARNFILENAME)));

end;

procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 Screen.Cursor := crHourglass;

 FormSaving := TFormSaving.Create( self );
 
 FormSaving.Show();
 Application.ProcessMessages();

 m_faces.SaveSnapshot(m_exePath + FACESFILENAME);
 m_faces.Free();

 m_faceRecognizer.save(PWideChar(WideString(m_exePath + LEARNFILENAME)));

 // Don't free FormSaving
end;


// Open image...
procedure TMainForm.btnOpenClick(Sender: TObject);
var
 sFilename: string;
begin
 sFilename := ImageEnView1.IO.ExecuteOpenDialog();
 ShowTempHourglass;
 if sFilename <> '' then
   LoadImage(sFilename);
end;


procedure TMainForm.LoadImage(const sFilename: string);
begin
 ImageEnView1.IO.LoadFromFile(sFilename);
 ImageEnView1.Fit();
 ImageEnView1.LayersClear( False );
 ExtractFaces();
end;


procedure TMainForm.ExtractFaces();
var
 i: integer;
 rects: TIEVisionVectorRect;
begin
 ShowTempHourglass;

 ImageEnView1.LayersClear( False );

 // detect objects
 m_objectsFinder.findIn(ImageEnView1.IEBitmap.GetIEVisionImage());

 // merge intersecting rectangles of all searched objects
 rects := m_objectsFinder.mergeAllRects();

 // loop among rectangles
 for i := 0 to rects.size - 1 do
 begin
   AddFace(rects.getRect(i));
   with rects.getRect(i) do
     ImageEnView1.LayersAdd( iesRectangle, Rect(x, y, x + width, y + height), clRed, 3 );
 end;



 {
 Or if using a TImageEnVect, you could code as follows:

 ImageEnVect1.RemoveAllObjects();

 ....

 // loop among rectangles
 for i := 0 to rects.size - 1 do
 begin
   AddFace(rects.getRect(i));
   ImageEnVect1.ObjPenWidth[-1] := 2;
   with rects.getRect(i) do
     ImageEnVect1.AddNewObject(iekBOX, Rect(x, y, x + width, y + height), clRed);
 end;
 }

 // train
 TrainDataset();
end;


procedure TMainForm.AddFace(Rect: TIEVisionRect);
var
 i: Integer;
 confidence: Double;
 lbl: PWideChar;
begin
 FormLabelingFace := TFormLabelingFace.Create( self );
 try
   // assign detected face to the dialog that associates face with a label (name)
   FormLabelingFace.ImageEnView1.IEBitmap.AssignRect(ImageEnView1.IEBitmap, IEVisionRectToTRect(Rect));
   FormLabelingFace.ImageEnView1.Update();

   lbl := m_faceRecognizer.detect(FormLabelingFace.ImageEnView1.IEBitmap.GetIEVisionImage(), confidence);
   FormLabelingFace.EditFaceName.Text := string(lbl);
   FormLabelingFace.LabelConfidence.Caption := FloatToStr(confidence);

   if FormLabelingFace.ShowModal() = mrOK then
   begin
     i := m_faces.IndexOf( FormLabelingFace.ImageEnView1.IEBitmap );
     if i < 0 then      
       i := m_faces.AppendImage(FormLabelingFace.ImageEnView1.IEBitmap); // does not yet exist in database
     m_faces.ImageDictionary[i].Insert('Name', FormLabelingFace.EditFaceName.Text);
   end;
 finally
   FormLabelingFace.Free;
 end;
end;


function CompareName(i1, i2: Integer): Integer;
begin
 try
   Result := CompareText( FormViewFaces.ImageEnMView1.IEMBitmap.ImageDictionary[i1].GetString( 'Name' ),
                          FormViewFaces.ImageEnMView1.IEMBitmap.ImageDictionary[i2].GetString( 'Name' ));
 except
   // Unexpected failure
   result := 0;
 end;
end;

procedure TMainForm.btnViewDBClick(Sender: TObject);
begin
 ShowTempHourglass();
 FormViewFaces := TFormViewFaces.Create( Self );
 try
   FormViewFaces.ImageEnMView1.AssignEx( m_faces, True );
   FormViewFaces.ImageEnMView1.Sort( CompareName );
   FormViewFaces.ShowModal;
 finally
    FormViewFaces.Free;
 end;
end;


procedure TMainForm.TrainDataset();
var
 i: Integer;
begin
 m_faceRecognizer.clear();
 for i := 0 to m_faces.Count - 1 do
 begin
   m_faceRecognizer.addTrainImage(m_faces.GetTIEBitmap(i).GetIEVisionImage(),                // the image
                                  PWideChar(m_faces.ImageDictionary[i].GetString('Name')));  // the label
 end;
 m_faceRecognizer.train();
end;


end.


Yuz tanima kodu
Muharrem ARSLAN
WWW
Cevapla


Bu Konudaki Yorumlar
Yuz tanima to el tanima - Yazar: arsl01 - 13-03-2019, Saat: 11:58
Yuz tanima to el tanima - Yazar: iyarar - 13-03-2019, Saat: 16:11
Yuz tanima to el tanima - Yazar: arsl01 - 13-03-2019, Saat: 17:21
Yuz tanima to el tanima - Yazar: iyarar - 13-03-2019, Saat: 17:57
Cvp: Yuz tanima to el tanima - Yazar: forumcuali - 13-03-2019, Saat: 18:07
Yuz tanima to el tanima - Yazar: arsl01 - 13-03-2019, Saat: 19:40
Yuz tanima to el tanima - Yazar: arsl01 - 13-03-2019, Saat: 20:55
Yuz tanima to el tanima - Yazar: uparlayan - 13-03-2019, Saat: 20:57
Yuz tanima to el tanima - Yazar: arsl01 - 13-03-2019, Saat: 21:55
Cvp: Yuz tanima to el tanima - Yazar: uparlayan - 14-03-2019, Saat: 11:05
Cvp: Yuz tanima to el tanima - Yazar: Tuğrul HELVACI - 14-03-2019, Saat: 08:23
Yuz tanima to el tanima - Yazar: arsl01 - 14-03-2019, Saat: 08:49
Cvp: Yuz tanima to el tanima - Yazar: Tuğrul HELVACI - 14-03-2019, Saat: 09:35
Yuz tanima to el tanima - Yazar: arsl01 - 14-03-2019, Saat: 10:20
Yuz tanima to el tanima - Yazar: arsl01 - 14-03-2019, Saat: 12:00

Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Plaka Tanıma Uygulamasındaki Sorun hk. delhici 9 3.047 03-01-2024, Saat: 09:44
Son Yorum: rabiasnlk
  Cep Telefonu Yüz tanıma sistemi m_ekici 0 438 25-10-2022, Saat: 16:33
Son Yorum: m_ekici



Konuyu Okuyanlar: 1 Ziyaretçi