1

I have a lot of upper body/face pictures and i'm trying to create a page similar to this: http://www.mediatechsummit.com/ehome/index.php?eventid=45432&tabid=76964&

The problem is my pictures vary in size and type, some are more face while some are upper body. I want to write an algorithm that will scale/crop pictures to a specific ratio (1/1.3) using my implemented face detection - EMGU CV library.

it needs to be "smart", taking the square from face detected and decide how to keep it in the center while not loosing important parts from the picture (ears, forehead).

John Saunders
  • 160,644
  • 26
  • 247
  • 397
gidim
  • 2,314
  • 20
  • 23
  • for center cropping with specific ration check [stackoverflow..](http://stackoverflow.com/a/9478852/1225337) – Nikson Kanti Paul Sep 13 '12 at 07:54
  • thanks for the edit and the links. my rectangle are not always centered, it depends on the photo input. therefore i need a smarter solution – gidim Sep 13 '12 at 08:54
  • Check this post: http://stackoverflow.com/questions/7368709/c-sharp-detect-face-and-crop-image – SandroG Jun 03 '13 at 17:47

1 Answers1

0

cropping based on center rectangle you can assume this

main_x = ...
main_y = ....
width = ...
height = .....

then you can use a flat ratio for extend the rectangle or fix value, example:

custom_x = main_x - width 
custom_width = width * 3 
custom_height = custom_width * 1.3333333
custom_y = main_y - height 

it likes 3x3 box to extend 9x9 box

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Nikson Kanti Paul
  • 3,394
  • 1
  • 35
  • 51
  • thanks, unfortunately it's not always centered. if i use this code i will lose important parts of the picture – gidim Sep 13 '12 at 08:57