Skip to content

Instantly share code, notes, and snippets.

@aggieben
Created September 15, 2009 03:39
Show Gist options
  • Save aggieben/187093 to your computer and use it in GitHub Desktop.
Save aggieben/187093 to your computer and use it in GitHub Desktop.
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