Created
October 29, 2015 01:00
-
-
Save CptSpaceToaster/b260050d4a111c185057 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
$ python3.4 | |
Python 3.4.0 (default, Jun 19 2015, 14:20:21) | |
[GCC 4.8.2] on linux | |
>>> import numpy | |
>>> a = numpy.array([[[127, 127, 127, 255], | |
... [127, 127, 127, 255]], | |
... [[127, 127, 127, 255], | |
... [127, 127, 127, 255]]]) | |
>>> b = numpy.array([[[127, 127, 127, 255], | |
... [255, 0, 0, 255]], | |
... [[0, 255, 0, 255], | |
... [0, 0, 255, 255]]]) | |
>>> ((a - b) + 255)/2 | |
array([[[ 127.5, 127.5, 127.5, 127.5], | |
[ 63.5, 191. , 191. , 127.5]], | |
[[ 191. , 63.5, 191. , 127.5], | |
[ 191. , 191. , 63.5, 127.5]]]) | |
I would like this instead | |
array([[[ 127, 127, 127, 127], | |
[ 63, 191, 191, 127]], | |
[[ 191, 63, 191, 127], | |
[ 191, 191, 63, 127]]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment