Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Last active July 7, 2019 17:48
Show Gist options
  • Save WillKoehrsen/52c48a4c983258d56f9b29dd67ae1e83 to your computer and use it in GitHub Desktop.
Save WillKoehrsen/52c48a4c983258d56f9b29dd67ae1e83 to your computer and use it in GitHub Desktop.
PIXEL_NORMALIZATION_FACTOR = 12.5
PIXEL_OFFSET_FACTOR = 150
for row_index in range(row_count):
for column_index in range(column_count):
for color_channel_index in range(color_channel_count):
normalized_pixel_value = (
original_pixel_array[row_index][column_index][color_channel_index]
* PIXEL_NORMALIZATION_FACTOR
)
transformed_pixel_array[row_index][column_index][color_channel_index] = (
normalized_pixel_value + PIXEL_OFFSET_FACTOR
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment