Tag: Face

  • 用 Face.com API 处理肖像照

    之前某天, 我接了个任务: 把用户上传的照片(全身或者半身照)做处理, 输出一张从头到肩的肖像. 一开始我觉得很难, 因为高等数学什么的早就还给老师了. 但后来一想, “Not to re-invent the wheel”, 找个现成的脸部识别 API 不就可以了吗. 于是开始 Google “face detection”. 结果之中, 来自 face.com 的 API 帮我搞定了这个任务. 顺便把一个批处理的 ruby 程序贴上, 尽管写的很丑. require ‘rubygems’ require ‘net/http’ require ‘rest_client’ require ‘json’ ratio = 2.0 photos = Dir.glob File.join(“photos”, “*.jpg”) photos.each { |photo| puts photo     res = RestClient.post( ‘http://api.face.com/faces/detect.json’,…