Biometric passport (ePassport) crop ratio and guides. Issue 1259

This commit is contained in:
DrSlony
2012-02-21 23:01:35 +00:00
parent 33d2ff3efb
commit 59623f63ab
5 changed files with 28 additions and 4 deletions

View File

@@ -833,6 +833,7 @@ TP_COLORSHIFT_LABEL;Przesunięcie koloru
TP_CROP_DPI;DPI=
TP_CROP_FIXRATIO;Zablokuj proporcje:
TP_CROP_GTDIAGONALS;Przekątna
TP_CROP_GTEPASSPORT;Paszport biometryczny
TP_CROP_GTGRID;Siatka
TP_CROP_GTHARMMEANS1;Złoty podział 1
TP_CROP_GTHARMMEANS2;Złoty podział 2
@@ -1130,7 +1131,6 @@ ZOOMPANEL_ZOOM100;Powiększ do 100% <b>1</b>
ZOOMPANEL_ZOOMFITSCREEN;Dopasuj do ekranu <b>F</b>
ZOOMPANEL_ZOOMIN;Przybliż <b>+</b>
ZOOMPANEL_ZOOMOUT;Oddal <b>-</b>
#00 Polish
#01 24.12.2007
#02 Mateusz Ludwin
@@ -1146,6 +1146,9 @@ ZOOMPANEL_ZOOMOUT;Oddal <b>-</b>
#12 2012-01-14 DrSlony
#13 2012-01-30 DrSlony
!!!!!!!!!!!!!!!!!!!!!!!!!
! Untranslated keys follow; remove the ! prefix after an entry is translated.
!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@@ -833,6 +833,7 @@ TP_COLORSHIFT_LABEL;Przesuniecie koloru
TP_CROP_DPI;DPI=
TP_CROP_FIXRATIO;Zablokuj proporcje:
TP_CROP_GTDIAGONALS;Przekatna
TP_CROP_GTEPASSPORT;Paszport biometryczny
TP_CROP_GTGRID;Siatka
TP_CROP_GTHARMMEANS1;Zloty podzial 1
TP_CROP_GTHARMMEANS2;Zloty podzial 2
@@ -1130,7 +1131,6 @@ ZOOMPANEL_ZOOM100;Powieksz do 100% <b>1</b>
ZOOMPANEL_ZOOMFITSCREEN;Dopasuj do ekranu <b>F</b>
ZOOMPANEL_ZOOMIN;Przybliz <b>+</b>
ZOOMPANEL_ZOOMOUT;Oddal <b>-</b>
#00 Polish
#01 24.12.2007
#02 Mateusz Ludwin
@@ -1146,6 +1146,9 @@ ZOOMPANEL_ZOOMOUT;Oddal <b>-</b>
#12 2012-01-14 DrSlony
#13 2012-01-30 DrSlony
!!!!!!!!!!!!!!!!!!!!!!!!!
! Untranslated keys follow; remove the ! prefix after an entry is translated.
!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@@ -822,6 +822,7 @@ TP_COLORSHIFT_GREENMAGENTA;Green-Magenta
TP_COLORSHIFT_LABEL;Color Shift
TP_CROP_FIXRATIO;Fix Ratio:
TP_CROP_GTDIAGONALS;Rule of diagonals
TP_CROP_GTEPASSPORT;Biometric Passport
TP_CROP_GTGRID;Grid
TP_CROP_GTHARMMEANS1;Harmonic means 1
TP_CROP_GTHARMMEANS2;Harmonic means 2

View File

@@ -134,7 +134,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
/****************
* Crop Ratio
*****************/
int NumberOfCropRatios = 25; //!!! change this value when adding new crop ratios
int NumberOfCropRatios = 26; //!!! change this value when adding new crop ratios
cropratio.resize (NumberOfCropRatios);
cropratio[0].label = "3:2"; cropratio[0].value = 3.0/2.0;
@@ -162,6 +162,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
cropratio[22].label = "11:17 - Tabloid"; cropratio[22].value = 11.0/17.0;
cropratio[23].label = "13:19"; cropratio[23].value = 13.0/19.0;
cropratio[24].label = "17:22"; cropratio[24].value = 17.0/22.0;
cropratio[25].label = "45:35 - ePassport"; cropratio[25].value = 45.0/35.0;
@@ -184,6 +185,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
guide->append_text (M("TP_CROP_GTHARMMEANS3"));
guide->append_text (M("TP_CROP_GTHARMMEANS4"));
guide->append_text (M("TP_CROP_GTGRID"));
guide->append_text (M("TP_CROP_GTEPASSPORT"));
guide->set_active (0);
w->set_range (0, maxw);
@@ -290,6 +292,8 @@ void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) {
guide->set_active (6);
else if (pp->crop.guide == "Grid")
guide->set_active (7);
else if (pp->crop.guide == "ePassport")
guide->set_active (8);
x->set_value (pp->crop.x);
y->set_value (pp->crop.y);
@@ -370,12 +374,14 @@ void Crop::write (ProcParams* pp, ParamsEdited* pedited) {
pp->crop.guide = "Harmonic means 4";
else if (guide->get_active_row_number()==7)
pp->crop.guide = "Grid";
else if (guide->get_active_row_number()==8)
pp->crop.guide = "ePassport";
if (pedited) {
pedited->crop.enabled = !enabled->get_inconsistent();
pedited->crop.ratio = ratio->get_active_row_number() != 8;
pedited->crop.orientation = orientation->get_active_row_number() != 2;
pedited->crop.guide = guide->get_active_row_number() != 7;
pedited->crop.guide = guide->get_active_row_number() != 8;
pedited->crop.fixratio = !fixr->get_inconsistent();
pedited->crop.w = wDirty;
pedited->crop.h = hDirty;

View File

@@ -155,6 +155,17 @@ void drawCrop (Cairo::RefPtr<Cairo::Context> cr, int imx, int imy, int imw, int
}
}
}
else if (cparams.guide=="ePassport") {
/* Official measurements do not specify exact ratios, just min/max measurements within which the eyes and chin-crown distance must lie. I averaged those measurements to produce these guides.
* The first horizontal guide is for the crown, the second is rougly for the nostrils, the third is for the chin.
* http://www.homeoffice.gov.uk/agencies-public-bodies/ips/passports/information-photographers/
* "(...) the measurement of the face from the bottom of the chin to the crown (ie the top of the head, not the top of the hair) is between 29mm and 34mm."
*/
horiz_ratios.push_back (7.0/45.0);
horiz_ratios.push_back (26.0/45.0);
horiz_ratios.push_back (37.0/45.0);
vert_ratios.push_back (0.5);
}
// Horizontals
for (int i=0; i<horiz_ratios.size(); i++) {