Created
September 15, 2009 03:39
-
-
Save aggieben/187093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gil::rgb8_view_t resample_image(gil::rgb8_view_t &orig_view) | |
{ | |
if ((orig_view.width() != 480 && orig_view.height() != 320) || | |
(orig_view.width() != 320 && orig_view.width() != 480)) | |
{ | |
int x_step = 1; | |
int y_step = 1; | |
if (orig_view.width() > orig_view.height()) | |
{ | |
x_step = orig_view.width() / meatloaf::configuration::NORMALIZED_DIMENSIONS.first; | |
y_step = orig_view.height() / meatloaf::configuration::NORMALIZED_DIMENSIONS.second; | |
} | |
else | |
{ | |
x_step = orig_view.width() / meatloaf::configuration::NORMALIZED_DIMENSIONS.second; | |
y_step = orig_view.height() / meatloaf::configuration::NORMALIZED_DIMENSIONS.first; | |
} | |
return gil::subsampled_view(orig_view, x_step, y_step); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment