﻿
{"id":6684,"date":"2017-07-22T18:33:40","date_gmt":"2017-07-22T18:33:40","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=6684"},"modified":"2017-07-22T18:37:11","modified_gmt":"2017-07-22T18:37:11","slug":"c-accord-net-face-detectionyuz-algilama","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/c-accord-net-face-detectionyuz-algilama\/","title":{"rendered":"C# Accord.NET &#8211; Face Detection(Y\u00fcz Alg\u0131lama)"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>Son zamanlarda g\u00f6r\u00fcnt\u00fc i\u015fleme \u00fczerine \u00e7al\u0131\u015fmalarda bulunmaktay\u0131m. Tabi bu \u00e7al\u0131\u015fmalar\u0131mda yo\u011funluk olarak AForge.NET, EmguCV ve Accord.NET frameworklerini kullanmakta ve bu teknolojilere ait t\u00fcm ke\u015fiflerimi tek tek siz de\u011ferli okuyucular\u0131ma sunabilmenin tela\u015fesiyle makaleler olu\u015fturmaktay\u0131m. Her konuda oldu\u011fu gibi \u015fuana kadar g\u00f6r\u00fcnt\u00fc i\u015fleme \u00fczerine yapt\u0131\u011f\u0131m \u00e7al\u0131\u015fmalar o kadar lezzet ve haz verici sonu\u00e7lar vermi\u015ftir ki zamanla bu \u00e7al\u0131\u015fmalar \u00fczerine i\u00e7erikler olu\u015fturduk\u00e7a ne demek istedi\u011fimi sizlerde anlayacaks\u0131n\u0131z. Misal bu yaz\u0131m\u0131zda; bu e\u011flenceli \u00e7al\u0131\u015fmalardan netice elde etti\u011fim bir konu olan ve C# ile bir g\u00f6r\u00fcnt\u00fc \u00fczerinde y\u00fcz alg\u0131lama olarak nitelendirilen Face Detection olay\u0131n\u0131n Accord.NET framework\u00fcn\u00fc kullanarak nas\u0131l ger\u00e7ekle\u015ftirildi\u011fini ele alaca\u011f\u0131z.<\/p>\n<p>\u0130\u00e7eri\u011fe ba\u015flamadan belirtmek istedi\u011fim m\u00fchim bir nokta vard\u0131r. Birazdan da g\u00f6rece\u011finiz \u00fczere Face Detection uygulamas\u0131n\u0131 Accord.NET ile basit ve h\u0131zl\u0131 bir \u015fekilde ger\u00e7ekle\u015ftirebilece\u011fiz. Halbuki bu uygulama taraf\u0131m\u0131zdan bir ba\u015flang\u0131\u00e7 seviyesinde kabul edilecektir ve zamanla ayn\u0131 i\u015fi daha y\u00fcksek teknolojide nas\u0131l yapabiliriz konusunu ele al\u0131p de\u011ferlendirece\u011fiz. Bu konuda EmguCV ve di\u011fer teknolojiler \u00fczerinden ara\u015ft\u0131rmalar\u0131ma devam etmekte oldu\u011fumu bilmenizi isterim.<\/p>\n<p>\u015eimdi makalemize d\u00f6nelim&#8230;<\/p>\n<p>Makale s\u00fcrecinde, g\u00f6r\u00fcnt\u00fc a\u00e7\u0131s\u0131ndan web kameradan beslenece\u011fimiz i\u00e7in AForge.NET&#8217;in kameraya ba\u011flanma i\u015flevini g\u00f6ren s\u0131n\u0131flar\u0131ndan yararlanaca\u011f\u0131m\u0131z\u0131 bilmenizi isterim. Bunlar\u0131n yan\u0131nda s\u00fcreci takip etmek istiyorsan\u0131z bir adet Windows Form projesi a\u00e7\u0131p, form \u00fczerine bir adet PictureBox nesnesi eklemeniz gayet yeterli olacakt\u0131r.<\/p>\n<p>\u0130lk olarak Accord.NET k\u00fct\u00fcphanelerini projemize entegre ederek ba\u015flayal\u0131m. Bu i\u015flem i\u00e7in Nuget penceresini a\u015fa\u011f\u0131daki gibi kullanabiliriz.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/07\/C-Accord.NET-Face-DetectionY\u00fcz-Alg\u0131lama.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/07\/C-Accord.NET-Face-DetectionY\u00fcz-Alg\u0131lama.png\" alt=\"C# Accord.NET - Face Detection(Y\u00fcz Alg\u0131lama)\" width=\"619\" height=\"523\" class=\"aligncenter size-full wp-image-6694\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/07\/C-Accord.NET-Face-DetectionY\u00fcz-Alg\u0131lama.png 619w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/07\/C-Accord.NET-Face-DetectionY\u00fcz-Alg\u0131lama-300x253.png 300w\" sizes=\"auto, (max-width: 619px) 100vw, 619px\" \/><\/a><\/p>\n<p>Yukar\u0131da g\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere Accord.NET k\u00fct\u00fcphanesini projemize entegre ediyoruz. Ayr\u0131ca kamera i\u015flemleri i\u00e7in AForge.NET k\u00fct\u00fcphanesini kullanaca\u011f\u0131m\u0131z i\u00e7in de <a href=\"http:\/\/www.gencayyildiz.com\/blog\/aforge-net-kutuphanelerine-erisim-ve-sistemdeki-kameralari-listeleme\/\" target=\"_blank\">bu adresteki<\/a> belirtmi\u015f oldu\u011fum t\u00fcm k\u00fct\u00fcphaneleri projenize dahil etmeyi unutmay\u0131n.<\/p>\n<p>\u015eimdi s\u0131ra geldi kod yazmaya.<\/p>\n<p>\u00d6ncelikle sistemdeki dahili kameraya ba\u011flan\u0131p g\u00f6r\u00fcnt\u00fc elde edelim.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n        private void Form1_Load(object sender, EventArgs e)\r\n        {\r\n            KameralariGetir(pictureBox1);\r\n        }\r\n        public void KameralariGetir(PictureBox pb)\r\n        {\r\n            AForge.Video.DirectShow.VideoCaptureDevice FinalVideoSource;\r\n            AForge.Video.DirectShow.FilterInfoCollection VideoCaptuerDevices;\r\n            VideoCaptuerDevices = new AForge.Video.DirectShow.FilterInfoCollection(AForge.Video.DirectShow.FilterCategory.VideoInputDevice);\r\n            FinalVideoSource = new AForge.Video.DirectShow.VideoCaptureDevice(VideoCaptuerDevices&#x5B;0].MonikerString);\r\n            FinalVideoSource.NewFrame += new AForge.Video.NewFrameEventHandler((sender, eventArgs) =&gt;\r\n            {\r\n                Bitmap image = (Bitmap)eventArgs.Frame.Clone();\r\n                pb.Image = image;\r\n            });\r\n            FinalVideoSource.DesiredFrameRate = 1;\r\n            FinalVideoSource.DesiredFrameSize = new Size(1, 500);\r\n            FinalVideoSource.Start();\r\n        }\r\n<\/pre>\n<p>Evet&#8230; Bu i\u015flemden sonra FinalVideoSource referans\u0131n\u0131n NewFrame olay\u0131ndan devam edece\u011fiz.<\/p>\n<p>\u015eimdi elde edilen her bir g\u00f6r\u00fcnt\u00fc \u00fczerinde Accord.NET ile bir \u00e7al\u0131\u015fma ger\u00e7ekle\u015ftirip y\u00fcz tespitinde bulunacak ve ilgili y\u00fcz\u00fcn etraf\u0131n\u0131 dikd\u00f6rtgen ile \u00e7izerek vurgulayaca\u011f\u0131z.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n            FinalVideoSource.NewFrame += new AForge.Video.NewFrameEventHandler((sender, eventArgs) =&gt;\r\n            {\r\n                Bitmap image = (Bitmap)eventArgs.Frame.Clone();\r\n\r\n                \/\/Y\u00fcz bilgisini tutan s\u0131n\u0131f. Daha do\u011frusu y\u00fcz\u00fcn tan\u0131mlanm\u0131\u015f matematiksel\r\n                \/\/yap\u0131s\u0131n\u0131 tutan s\u0131n\u0131f.\r\n                Accord.Vision.Detection.Cascades.FaceHaarCascade cascade = new Accord.Vision.Detection.Cascades.FaceHaarCascade();\r\n                \/\/FaceHaarCascade nesnesini kullanarak g\u00f6r\u00fcnt\u00fc \u00fczerinde arama yapan\r\n                \/\/detekt\u00f6r.\r\n                Accord.Vision.Detection.HaarObjectDetector detector = new Accord.Vision.Detection.HaarObjectDetector(cascade, 30);\r\n\r\n                detector.SearchMode = Accord.Vision.Detection.ObjectDetectorSearchMode.Average;\r\n                detector.ScalingFactor = 1.5f;\r\n                detector.ScalingMode = Accord.Vision.Detection.ObjectDetectorScalingMode.GreaterToSmaller;\r\n                detector.UseParallelProcessing = true;\r\n                detector.Suppression = 3;\r\n\r\n                \/\/detector nesnesinin g\u00f6r\u00fcnt\u00fc \u00fczerinde buldu\u011fu y\u00fcz ifadelerinin\r\n                \/\/dikd\u00f6rtgen k\u00f6\u015fe bilgileri.\r\n                Rectangle&#x5B;] faces = detector.ProcessFrame(image);\r\n\r\n\r\n                Graphics g = Graphics.FromImage(image);\r\n                foreach (var face in faces)\r\n                {\r\n                    Pen p = new Pen(Color.Red, 10f);\r\n                    \/\/Her bulunan y\u00fcze ait dikd\u00f6rtgenlerin\r\n                    \/\/grafik nesnesiyle \u00e7izilmesi.\r\n                    g.DrawRectangle(p, face);\r\n                }\r\n                g.Dispose();\r\n\r\n                pb.Image = image;\r\n\r\n            });\r\n<\/pre>\n<p>Yapm\u0131\u015f oldu\u011fumuz bu i\u015flemlerden sonra projemizi derleyip \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131m\u0131z zaman a\u015fa\u011f\u0131daki videodan da g\u00f6rd\u00fc\u011f\u00fcn\u00fcz \u00fczere kameradan elde edilen g\u00f6r\u00fcnt\u00fcler \u00fczerinde y\u00fcz alg\u0131lama i\u015flemini ba\u015far\u0131yla ger\u00e7ekle\u015ftirmi\u015f bulunuyoruz.<\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/F-vKCycPmUk\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>Dikkat edilirse e\u011fer yap\u0131lan bu \u00e7al\u0131\u015fmada Accord.NET teknolojisinin hassasiyet ve alg\u0131lama derecesi olduk\u00e7a d\u00fc\u015f\u00fck oldu\u011fu i\u00e7in yan ve yamuk a\u00e7\u0131lardan olan y\u00fczler alg\u0131lanamamaktad\u0131r. Bu s\u0131k\u0131nlar\u0131 yaz\u0131m\u0131z\u0131n ba\u015f\u0131nda da ifade etti\u011fim gibi EmguCV vs. gibi teknolojiler ile ileride a\u015faca\u011f\u0131m\u0131za inan\u0131yorum. O halde bu ve bunun d\u0131\u015f\u0131nda nice i\u015flemler \u00fczerine isti\u015fare edece\u011fimiz konularda g\u00f6r\u00fc\u015fmek \u00fczere diyorum.<\/p>\n<p>Ho\u015f\u00e7akal\u0131n&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, Son zamanlarda g\u00f6r\u00fcnt\u00fc i\u015fleme \u00fczerine \u00e7al\u0131\u015fmalarda bulunmaktay\u0131m. Tabi bu \u00e7al\u0131\u015fmalar\u0131mda yo\u011funluk olarak AForge.NET, EmguCV ve Accord.NET frameworklerini kullanmakta ve bu teknolojilere ait t\u00fcm ke\u015fiflerimi tek tek siz de\u011ferli okuyucular\u0131ma sunabilmenin tela\u015fesiyle makaleler olu\u015fturmaktay\u0131m.&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":6705,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1903,1904],"tags":[1897,1902,1868,1896,1900,1901,1898,1899],"class_list":["post-6684","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-accord-net","category-goruntu-isleme","tag-accord-net","tag-accord-net-yuz-algilama","tag-aforge-net","tag-c-accord-net","tag-c-face-detection","tag-c-yuz-algilama","tag-face-detection","tag-yuz-algilama"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/6684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=6684"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/6684\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/6705"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=6684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=6684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=6684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}