{"id":250,"date":"2011-05-04T16:48:21","date_gmt":"2011-05-04T08:48:21","guid":{"rendered":"http:\/\/www.magicandlove.com\/blog\/?p=250"},"modified":"2011-07-08T14:23:15","modified_gmt":"2011-07-08T06:23:15","slug":"smile-detection-in-processing-mac-osx","status":"publish","type":"post","link":"http:\/\/www.magicandlove.com\/blog\/2011\/05\/04\/smile-detection-in-processing-mac-osx\/","title":{"rendered":"Smile Detection in Processing &#8211; Mac OSX"},"content":{"rendered":"<p>I manage to compile an OSX version of the library. I use the 10.6 SDK to package the library. You can download the sample application below. I place it temporarily in a <strong>code<\/strong> folder.<\/p>\n<p><a href=\"http:\/\/www.magicandlove.com\/software\/Smile002_Processing.zip\">PSmile library sample<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-253\" title=\"smile001\" src=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2011\/05\/smile001.jpg\" alt=\"smile detection processing.org\" width=\"480\" height=\"300\" srcset=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2011\/05\/smile001.jpg 480w, http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2011\/05\/smile001-300x187.jpg 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-254\" title=\"smile002\" src=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2011\/05\/smile002.jpg\" alt=\"smile detection processing.org\" width=\"480\" height=\"300\" srcset=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2011\/05\/smile002.jpg 480w, http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2011\/05\/smile002-300x187.jpg 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><br \/>\nThis is the Processing source code for the example.<\/p>\n<pre lang=\"java\">\r\nimport processing.video.*;\r\nimport pSmile.PSmile;\r\n\r\nCapture cap;\r\nPSmile smile;\r\nPImage img2;\r\nfloat res, factor;\r\nPFont font;\r\nint w, h;\r\n\r\nvoid setup() {\r\n  size(640,480);\r\n  w = width\/2;\r\n  h = height\/2;\r\n  background(0);\r\n  cap = new Capture(this, width, height, Capture.list()[1], 25);\r\n  img2 = createImage(w,h,ARGB);\r\n  smile = new PSmile(this,w,h);\r\n  res = 0.0;\r\n  factor = 0.0;\r\n  font = loadFont(\"SansSerif.plain-16.vlw\");\r\n  textFont(font,16);\r\n  textAlign(CENTER);\r\n  noStroke();\r\n  fill(255,200,0);\r\n  rectMode(CORNER);\r\n}\r\n\r\nvoid draw() {\r\n  img2.copy(cap,0,0,width,height,0,0,w,h);\r\n  img2.updatePixels();\r\n  image(cap,0,0);\r\n  res = smile.getSmile(img2);\r\n  if (res>0) {\r\n    factor = factor*0.8 + res*0.2;\r\n    float t_h = factor*30;\r\n    rect(width\/2-20,height-t_h-30,40,t_h);\r\n  }\r\n  String str = nf(res,1,4);\r\n  text(str,width\/2,height-10);\r\n}\r\n\r\nvoid captureEvent(Capture _c) {\r\n  _c.read();\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I manage to compile an OSX version of the library. I use the 10.6 SDK to package the library. You can download the sample application below. I place it temporarily in a code folder. PSmile library sample This is the Processing source code for the example. import processing.video.*; import pSmile.PSmile; Capture cap; PSmile smile; PImage [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[62,60],"class_list":["post-250","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-processing-org","tag-smile-detection"],"_links":{"self":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/comments?post=250"}],"version-history":[{"count":8,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/250\/revisions"}],"predecessor-version":[{"id":291,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/250\/revisions\/291"}],"wp:attachment":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/media?parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/categories?post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/tags?post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}