esimov / pigo

Fast face detection, pupil/eyes localization and facial landmark points detection library in pure Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Eye/Facial Coordinates in JSON?

rgvxlens opened this issue · comments

Hi there, is it possible to print/output the Facial Coordinates/Pupil Localization pointers in the JSON file with -json itself? Or any work around for the same?

or any other way to print the exact coordinates of the pupils or the other facial features?

Currently only the face coordinates could be exported into a JSON file, but this can be extended to support the pupil and facial coordinates.

Thanks for the your quick response!

But can this still be done if I create an API for the same or a Python program? Just need to output the coordinates somewhere.

You mean would you like such a feature to be included into the library? If that's what you want I can take care of it.

Would be awesome! or maybe a way to just get specific features in the JSON? Both would be helpful, or whatever is possible according to you.

@rgvxlens i've extended the json marshalizer to include the pupils/eyes localization and landmark points detection coordinates. Currently the json export is looking something like this:

[{
	"face": {
		"x": 129,
		"y": 131,
		"size": 158
	},
	"eyes": [{
		"x": 116,
		"y": 107,
		"size": 12
	}, {
		"x": 114,
		"y": 162,
		"size": 13
	}],
	"landmark_points": [{
		"x": 103,
		"y": 185,
		"size": 19
	}, {
		"x": 91,
		"y": 168,
		"size": 19
	}, {
		"x": 103,
		"y": 147,
		"size": 19
	}, {
		"x": 115,
		"y": 152,
		"size": 19
	}, {
		"x": 113,
		"y": 175,
		"size": 19
	}, {
		"x": 153,
		"y": 134,
		"size": 19
	}, {
		"x": 184,
		"y": 113,
		"size": 19
	}, {
		"x": 192,
		"y": 133,
		"size": 19
	}, {
		"x": 179,
		"y": 134,
		"size": 19
	}, {
		"x": 183,
		"y": 160,
		"size": 19
	}]
}]

You might ignore the size in eyes and landmark_points since they are not really relevant.

Thanks for this! What does the size in the face denote?

The dimension of the detected face region.

Alright, i'll give it a look and report back. Thanks a lot and kudos to you for this amazing project.

Hey! I had a few questions, I hope you don't mind answering them:

  1. Why is my output always like this?

[{"Min":{"X":33,"Y":81},"Max":{"X":243,"Y":243}}]

The rest of the JSON file is empty other than the string above.

This is the command that I'm running:
pigo -in /home/rgvx/githubstuff/RedEyeRemover/test.jpeg -out output.jpg -cf /home/rgvx/githubstuff/pigo/cascade/facefinder -mark -pl -plc /home/rgvx/githubstuff/pigo/cascade/puploc -json

Is it a problem with the command I'm running?

  1. What is the format of the "size" value? Is it in Pixels?

Thanks!

Edit: Figured that I was on the wrong version of Pigo (the one that I got from the AUR). Ran the latest version and now I get this:

[{"face":{"x":422,"y":336,"size":483},"eyes":[{"x":378,"y":267,"size":39},{"x":380,"y":432,"size":40}]}]

`

Every value in the json file is in pixel format. The size value as I mentioned earlier in the thread represents the detected face rectangle size, but since this might be relevant only for the detected face you can ignore on pupil/eyes localization and facial landmark detection, but it's up to you.

Oh, thanks! Got it, I'm now looking into calculating/detecting the radius of the eyes with the coordinates that I've obtained. Do you have any idea about the same?

You don't need to calculate the radius of the eyes, you only need to multiply the scale value with a percentage, 0.4 should give you an approximate correct result. (https://twitter.com/simo_endre/status/1171002326812962816)

That's exactly what I'm looking for. Thank you so much mate! What exactly is that value? Can you give me a bit of a background on that? Just so that I have some background info on that.

Edit: Oh nevermind, I think the value arises from Hough Circles. I'll do a deeper research into them. Thanks a ton once again! :)

@rgvxlens i'm really glad that it worked for you! ;)