Ask Your Question
0

Creating a focal point service that only responds w/ coordinates

asked 2013-01-07 11:12:16 -0600

Adam gravatar image

updated 2013-01-07 11:33:04 -0600

I'm looking to create a simple HTTP service where you post a URL to an image, and in response it would simply reply with the coordinates of the image's focal point (not so much recognizing a face or who that person is, but determining the focal point of any image). It must be scalable so I'd like it to be on a cloud based service like App Engine or Amazon (I prefer App engine, but since you cannot run C modules I'm not sure it'll work).

I do not need to use most of OpenCV's features, like resizing and cropping, and only need the face detection coordinates in the form of json or xml. It also doesn't need to save any data, and it only gets the image data by a public url, then forget about it after the process is done.

Has anyone done something similar, or know of any services that already exist like this? Is OpenCV the right choice? Any recommendations for server setup?

edit retag flag offensive close merge delete

Comments

I see this is quiet an old question. Have you got the answer already? Please respond, I need exactly the same thing.

Probal gravatar imageProbal ( 2016-05-13 01:14:42 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-10-03 10:45:53 -0600

Eek gravatar image

Thumbor's smart detection might help you do that - https://github.com/thumbor/thumbor/wi...

Thumbor is a HTTP Service that helps you do anything with images. The Focal Points are provided provided by the Good Features to Track Algorithm in OpenCV (in case no faces are Detected, in the cases of Faces, it will use Face Detection to detect the Focal Points)

To get the Focal Points you will need to use the smart detection algorithm, usually used in the crop service, but you can use it if you don't even crop.

Example:

To smart crop a image and center in a 720x720 box:

localhost:8888/unsafe/720x720/smart/yourimage.jpg

but you can exclude the crop dimensions and get just the meta:

localhost:8888/unsafe/meta/smart/yourimage.jpg

That will give you something like this:

{ "thumbor": 
  {
  "operations":[],
  "source":{
     "url":"yourimage.jpg",
     "width":1280,
     "frameCount":1,
     "height":720
  },
  "focal_points":[
     {
        "origin":"alignment",
        "height":1.0,
        "width":1.0,
        "y":235.0,
        "x":708.0,
        "z":1.0
     },
     {
        "origin":"alignment",
        "height":1.0,
        "width":1.0,
        "y":263.0,
        "x":663.0,
        "z":1.0
     },
     {
        "origin":"alignment",
        "height":1.0,
        "width":1.0,
        "y":235.0,
        "x":573.0,
        "z":1.0
     },
     {
        "origin":"alignment",
        "height":1.0,
        "width":1.0,
        "y":263.0,
        "x":618.0,
        "z":1.0
     },
     {
        "origin":"alignment",
        "height":1.0,
        "width":1.0,
        "y":324.0,
        "x":654.0,
        "z":1.0
     },
     {
        "origin":"alignment",
        "height":1.0,
        "width":1.0,
        "y":373.0,
        "x":653.0,
        "z":1.0
     },
     {
        "origin":"alignment",
        "height":1.0,
        "width":1.0,
        "y":280.0,
        "x":654.0,
        "z":1.0
     }
  ],
  "target":{
     "width":1280,
     "height":720
      }
   }
 }

Hope this helps :D

edit flag offensive delete link more

Comments

This is an ancient topic, but afaik the focal point is the point at which initially collimated rays of light meet after passing through a convex lens, or reflecting from a concave mirror. So how does this relate to the position of faces in images? o_O

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-04 04:56:56 -0600 )edit

Question Tools

Stats

Asked: 2013-01-07 11:12:16 -0600

Seen: 2,727 times

Last updated: Oct 03 '16