Manuel
Manuel

Reputation: 15042

How to detect a cropped-off head with Google Vision API?

How can the Google Vision API be used to detect if a head is completely inside an image or partly cut off by the image frame?

3 examples:

enter image description here

To narrow down the question, the following cases should be detected:

The following is out of scope for this question:

I have checked the documentation but it doesn't say anything about head crop-off detection.

I am not asking for code but whether / how the API can be used for the described purpose. Hence neither the question contains any code nor is an answer expected to contain any code. If you are looking for code examples for API calls, take a look at the plenty example calls in the API docs.

There was a meta discussion about this question.

Image credit

Upvotes: 0

Views: 578

Answers (1)

Manuel
Manuel

Reputation: 15042

The API does provide boundingPoly and fdBoundingPoly to determine where the face (not head) is located inside the image.

Even though the API does not provide the bounds for the "head", the example below demonstrates that boundingPoly is pretty equivalent to the larger face area which can apparently be used as substitute.

Here are the API results for boundingPoly (red dots) and fdBoundingPoly (blue dots):

enter image description here

  • Image 1: shows the face bounds for a fully visible head. The boundingPoly which is described as the larger face area is apparently pretty equivalent to the "head" area.
  • Image 2: the bounding boxes are missing y coordinates for the 4 top dots (2 red, 2 blue; depicted with y=0 coordinates for the purpose of demonstration), which can be used as indication of a cropped-off head.
  • Image 3: the API does not result any faceAnnotations, so it can be easily detected as a substantially cropped-off head or an image without any partly visible head which won’t be distinguished in this case.

Upvotes: 4

Related Questions