Python: Displaying a binary array as image
I have a mask image which is technically a matrix full of True/False values. I would like to view this as an image. First, I converted it into a binary array with (astype(np.uint8)
)
print('Part Mask', p['masks'][class_id].astype(np.uint8))
but I still can't view it as an image under Python notebook. OpenCV goes crazy and crashes the kernel.
Does anyone know how to view such a structure as an image on Python notebook without crashing the kernel?
[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
...
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]]
or this would work as well ():
[[False False False ... False False False]
[False False False ... False False False]
[False False False ... False False False]
...
[False False False ... False False False]
[False False False ... False False False]
[False False False ... False False False]]
Thanks in advance.
EDIT: I cannot copy paste the whole code here but basically I have a prediction tensor p
, and p[masks][class_id]
is what I want to visualize (showing the mask of each class).
enumerator = 0
# run through the instances
for class_id in p['class_ids']:
#print('Image:', image) # the original input image
#print('Mask:', merged_mask) # whole masked image
print('ID: ', class_names[class_id] + str(enumerator))
#print('Outline Poses: ', ) # mask boundary coordinates
#print('Pose:',) # mask center coordinates
print('Part Mask', p['masks'][class_id].astype(np.uint8)) # how to visualize this as an image?
print('Confidence: ', p['scores'][class_id])
print('BB: ', p['rois'][class_id]) # get the BB
print('--------------------------')
enumerator = enumerator + 1
P.S: Matplotlib does not work either. This is the kind of image I get when I try to print:
python
|
show 1 more comment
I have a mask image which is technically a matrix full of True/False values. I would like to view this as an image. First, I converted it into a binary array with (astype(np.uint8)
)
print('Part Mask', p['masks'][class_id].astype(np.uint8))
but I still can't view it as an image under Python notebook. OpenCV goes crazy and crashes the kernel.
Does anyone know how to view such a structure as an image on Python notebook without crashing the kernel?
[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
...
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]]
or this would work as well ():
[[False False False ... False False False]
[False False False ... False False False]
[False False False ... False False False]
...
[False False False ... False False False]
[False False False ... False False False]
[False False False ... False False False]]
Thanks in advance.
EDIT: I cannot copy paste the whole code here but basically I have a prediction tensor p
, and p[masks][class_id]
is what I want to visualize (showing the mask of each class).
enumerator = 0
# run through the instances
for class_id in p['class_ids']:
#print('Image:', image) # the original input image
#print('Mask:', merged_mask) # whole masked image
print('ID: ', class_names[class_id] + str(enumerator))
#print('Outline Poses: ', ) # mask boundary coordinates
#print('Pose:',) # mask center coordinates
print('Part Mask', p['masks'][class_id].astype(np.uint8)) # how to visualize this as an image?
print('Confidence: ', p['scores'][class_id])
print('BB: ', p['rois'][class_id]) # get the BB
print('--------------------------')
enumerator = enumerator + 1
P.S: Matplotlib does not work either. This is the kind of image I get when I try to print:
python
Have you tried matplotlib?
– Dinari
Nov 26 '18 at 8:34
Got another error with that, but perhaps it was because of something else, could you suggest a way with matplotlib?
– Schütze
Nov 26 '18 at 8:36
Please do not even think of pasting the whole code here. Create a Minimal, Complete, and Verifiable example instead.
– Goyo
Nov 26 '18 at 9:30
Not sure if this was a bot answer or not @Goyo. I said myself I cannot paste the code here, you don't need to link me that page.
– Schütze
Nov 26 '18 at 9:36
1
No, it's not. But you do not need to care, just think whether the advice makes sense or not. You have an example of matplotlib working with sample data. It does not work with your data but we don't know why. Knowing that it comes from a masked prediction tensor does not help. Having an actual hardcoded sample does.
– Goyo
Nov 26 '18 at 9:49
|
show 1 more comment
I have a mask image which is technically a matrix full of True/False values. I would like to view this as an image. First, I converted it into a binary array with (astype(np.uint8)
)
print('Part Mask', p['masks'][class_id].astype(np.uint8))
but I still can't view it as an image under Python notebook. OpenCV goes crazy and crashes the kernel.
Does anyone know how to view such a structure as an image on Python notebook without crashing the kernel?
[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
...
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]]
or this would work as well ():
[[False False False ... False False False]
[False False False ... False False False]
[False False False ... False False False]
...
[False False False ... False False False]
[False False False ... False False False]
[False False False ... False False False]]
Thanks in advance.
EDIT: I cannot copy paste the whole code here but basically I have a prediction tensor p
, and p[masks][class_id]
is what I want to visualize (showing the mask of each class).
enumerator = 0
# run through the instances
for class_id in p['class_ids']:
#print('Image:', image) # the original input image
#print('Mask:', merged_mask) # whole masked image
print('ID: ', class_names[class_id] + str(enumerator))
#print('Outline Poses: ', ) # mask boundary coordinates
#print('Pose:',) # mask center coordinates
print('Part Mask', p['masks'][class_id].astype(np.uint8)) # how to visualize this as an image?
print('Confidence: ', p['scores'][class_id])
print('BB: ', p['rois'][class_id]) # get the BB
print('--------------------------')
enumerator = enumerator + 1
P.S: Matplotlib does not work either. This is the kind of image I get when I try to print:
python
I have a mask image which is technically a matrix full of True/False values. I would like to view this as an image. First, I converted it into a binary array with (astype(np.uint8)
)
print('Part Mask', p['masks'][class_id].astype(np.uint8))
but I still can't view it as an image under Python notebook. OpenCV goes crazy and crashes the kernel.
Does anyone know how to view such a structure as an image on Python notebook without crashing the kernel?
[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
...
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]]
or this would work as well ():
[[False False False ... False False False]
[False False False ... False False False]
[False False False ... False False False]
...
[False False False ... False False False]
[False False False ... False False False]
[False False False ... False False False]]
Thanks in advance.
EDIT: I cannot copy paste the whole code here but basically I have a prediction tensor p
, and p[masks][class_id]
is what I want to visualize (showing the mask of each class).
enumerator = 0
# run through the instances
for class_id in p['class_ids']:
#print('Image:', image) # the original input image
#print('Mask:', merged_mask) # whole masked image
print('ID: ', class_names[class_id] + str(enumerator))
#print('Outline Poses: ', ) # mask boundary coordinates
#print('Pose:',) # mask center coordinates
print('Part Mask', p['masks'][class_id].astype(np.uint8)) # how to visualize this as an image?
print('Confidence: ', p['scores'][class_id])
print('BB: ', p['rois'][class_id]) # get the BB
print('--------------------------')
enumerator = enumerator + 1
P.S: Matplotlib does not work either. This is the kind of image I get when I try to print:
python
python
edited Nov 26 '18 at 11:44
Schütze
asked Nov 26 '18 at 8:32
SchützeSchütze
55527
55527
Have you tried matplotlib?
– Dinari
Nov 26 '18 at 8:34
Got another error with that, but perhaps it was because of something else, could you suggest a way with matplotlib?
– Schütze
Nov 26 '18 at 8:36
Please do not even think of pasting the whole code here. Create a Minimal, Complete, and Verifiable example instead.
– Goyo
Nov 26 '18 at 9:30
Not sure if this was a bot answer or not @Goyo. I said myself I cannot paste the code here, you don't need to link me that page.
– Schütze
Nov 26 '18 at 9:36
1
No, it's not. But you do not need to care, just think whether the advice makes sense or not. You have an example of matplotlib working with sample data. It does not work with your data but we don't know why. Knowing that it comes from a masked prediction tensor does not help. Having an actual hardcoded sample does.
– Goyo
Nov 26 '18 at 9:49
|
show 1 more comment
Have you tried matplotlib?
– Dinari
Nov 26 '18 at 8:34
Got another error with that, but perhaps it was because of something else, could you suggest a way with matplotlib?
– Schütze
Nov 26 '18 at 8:36
Please do not even think of pasting the whole code here. Create a Minimal, Complete, and Verifiable example instead.
– Goyo
Nov 26 '18 at 9:30
Not sure if this was a bot answer or not @Goyo. I said myself I cannot paste the code here, you don't need to link me that page.
– Schütze
Nov 26 '18 at 9:36
1
No, it's not. But you do not need to care, just think whether the advice makes sense or not. You have an example of matplotlib working with sample data. It does not work with your data but we don't know why. Knowing that it comes from a masked prediction tensor does not help. Having an actual hardcoded sample does.
– Goyo
Nov 26 '18 at 9:49
Have you tried matplotlib?
– Dinari
Nov 26 '18 at 8:34
Have you tried matplotlib?
– Dinari
Nov 26 '18 at 8:34
Got another error with that, but perhaps it was because of something else, could you suggest a way with matplotlib?
– Schütze
Nov 26 '18 at 8:36
Got another error with that, but perhaps it was because of something else, could you suggest a way with matplotlib?
– Schütze
Nov 26 '18 at 8:36
Please do not even think of pasting the whole code here. Create a Minimal, Complete, and Verifiable example instead.
– Goyo
Nov 26 '18 at 9:30
Please do not even think of pasting the whole code here. Create a Minimal, Complete, and Verifiable example instead.
– Goyo
Nov 26 '18 at 9:30
Not sure if this was a bot answer or not @Goyo. I said myself I cannot paste the code here, you don't need to link me that page.
– Schütze
Nov 26 '18 at 9:36
Not sure if this was a bot answer or not @Goyo. I said myself I cannot paste the code here, you don't need to link me that page.
– Schütze
Nov 26 '18 at 9:36
1
1
No, it's not. But you do not need to care, just think whether the advice makes sense or not. You have an example of matplotlib working with sample data. It does not work with your data but we don't know why. Knowing that it comes from a masked prediction tensor does not help. Having an actual hardcoded sample does.
– Goyo
Nov 26 '18 at 9:49
No, it's not. But you do not need to care, just think whether the advice makes sense or not. You have an example of matplotlib working with sample data. It does not work with your data but we don't know why. Knowing that it comes from a masked prediction tensor does not help. Having an actual hardcoded sample does.
– Goyo
Nov 26 '18 at 9:49
|
show 1 more comment
2 Answers
2
active
oldest
votes
Matplotlib should work for you:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(10)
binary = image > 0
plt.imshow(binary)
plt.show()
With result:
Edit:
Your image is of shape (510,7)
, what you got above is exactly what you should expect:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(510)[:,:7]
binary = image > 0
plt.imshow(binary)
plt.show()
Results:
See edit. This prints something very weird.
– Schütze
Nov 26 '18 at 8:59
1
Post your code, This seems like a problem with the notebook your using, the figure does not get the size it should get.
– Dinari
Nov 26 '18 at 9:02
I don't think what you created withnp.eye()
there is the same with my data though. Mine is(510, 7) <class 'numpy.ndarray'>
– Schütze
Nov 26 '18 at 10:25
Probaly not, butbinary = image > 0
create a binary array which I am using to plot. The content of the array does not matter, as long as it is Binary.
– Dinari
Nov 26 '18 at 10:27
1
You have an image of(510,7)
, it will look like a very narrow rectangle, I don't know if it is messed up, as we do not know what is the expected result.
– Dinari
Nov 26 '18 at 11:27
|
show 5 more comments
Maybe you may use PIL
from PIL import Image
data = [...]
width = len(data[0])
height = len(data)
output_image = Image.new(mode='1', size=(width, height))
for x in range(height):
for y in range(width):
pixel_value = data[x][y]
output_image.putpixel((x,y), pixel_value)
output_image
with data = [[0,0,0,0], [0,0,1,1], [1,1,1,0], [0,1,1,0]]
i have such image ->
Gave an error atoutput_image.putpixel((x,y), pixel_value)
sayingSystemError: new style getargs format but argument is not a tuple
– Schütze
Nov 26 '18 at 9:04
What version of PIL you use ?
– Nick
Nov 26 '18 at 9:21
Version I have is 5.1.0
– Schütze
Nov 26 '18 at 9:27
I have version 5.3.0 and python3.6 , and all works. Try to update PIL version
– Nick
Nov 26 '18 at 9:29
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53477228%2fpython-displaying-a-binary-array-as-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Matplotlib should work for you:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(10)
binary = image > 0
plt.imshow(binary)
plt.show()
With result:
Edit:
Your image is of shape (510,7)
, what you got above is exactly what you should expect:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(510)[:,:7]
binary = image > 0
plt.imshow(binary)
plt.show()
Results:
See edit. This prints something very weird.
– Schütze
Nov 26 '18 at 8:59
1
Post your code, This seems like a problem with the notebook your using, the figure does not get the size it should get.
– Dinari
Nov 26 '18 at 9:02
I don't think what you created withnp.eye()
there is the same with my data though. Mine is(510, 7) <class 'numpy.ndarray'>
– Schütze
Nov 26 '18 at 10:25
Probaly not, butbinary = image > 0
create a binary array which I am using to plot. The content of the array does not matter, as long as it is Binary.
– Dinari
Nov 26 '18 at 10:27
1
You have an image of(510,7)
, it will look like a very narrow rectangle, I don't know if it is messed up, as we do not know what is the expected result.
– Dinari
Nov 26 '18 at 11:27
|
show 5 more comments
Matplotlib should work for you:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(10)
binary = image > 0
plt.imshow(binary)
plt.show()
With result:
Edit:
Your image is of shape (510,7)
, what you got above is exactly what you should expect:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(510)[:,:7]
binary = image > 0
plt.imshow(binary)
plt.show()
Results:
See edit. This prints something very weird.
– Schütze
Nov 26 '18 at 8:59
1
Post your code, This seems like a problem with the notebook your using, the figure does not get the size it should get.
– Dinari
Nov 26 '18 at 9:02
I don't think what you created withnp.eye()
there is the same with my data though. Mine is(510, 7) <class 'numpy.ndarray'>
– Schütze
Nov 26 '18 at 10:25
Probaly not, butbinary = image > 0
create a binary array which I am using to plot. The content of the array does not matter, as long as it is Binary.
– Dinari
Nov 26 '18 at 10:27
1
You have an image of(510,7)
, it will look like a very narrow rectangle, I don't know if it is messed up, as we do not know what is the expected result.
– Dinari
Nov 26 '18 at 11:27
|
show 5 more comments
Matplotlib should work for you:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(10)
binary = image > 0
plt.imshow(binary)
plt.show()
With result:
Edit:
Your image is of shape (510,7)
, what you got above is exactly what you should expect:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(510)[:,:7]
binary = image > 0
plt.imshow(binary)
plt.show()
Results:
Matplotlib should work for you:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(10)
binary = image > 0
plt.imshow(binary)
plt.show()
With result:
Edit:
Your image is of shape (510,7)
, what you got above is exactly what you should expect:
import numpy as np
from matplotlib import pyplot as plt
image = np.eye(510)[:,:7]
binary = image > 0
plt.imshow(binary)
plt.show()
Results:
edited Nov 26 '18 at 11:23
answered Nov 26 '18 at 8:37
DinariDinari
1,694523
1,694523
See edit. This prints something very weird.
– Schütze
Nov 26 '18 at 8:59
1
Post your code, This seems like a problem with the notebook your using, the figure does not get the size it should get.
– Dinari
Nov 26 '18 at 9:02
I don't think what you created withnp.eye()
there is the same with my data though. Mine is(510, 7) <class 'numpy.ndarray'>
– Schütze
Nov 26 '18 at 10:25
Probaly not, butbinary = image > 0
create a binary array which I am using to plot. The content of the array does not matter, as long as it is Binary.
– Dinari
Nov 26 '18 at 10:27
1
You have an image of(510,7)
, it will look like a very narrow rectangle, I don't know if it is messed up, as we do not know what is the expected result.
– Dinari
Nov 26 '18 at 11:27
|
show 5 more comments
See edit. This prints something very weird.
– Schütze
Nov 26 '18 at 8:59
1
Post your code, This seems like a problem with the notebook your using, the figure does not get the size it should get.
– Dinari
Nov 26 '18 at 9:02
I don't think what you created withnp.eye()
there is the same with my data though. Mine is(510, 7) <class 'numpy.ndarray'>
– Schütze
Nov 26 '18 at 10:25
Probaly not, butbinary = image > 0
create a binary array which I am using to plot. The content of the array does not matter, as long as it is Binary.
– Dinari
Nov 26 '18 at 10:27
1
You have an image of(510,7)
, it will look like a very narrow rectangle, I don't know if it is messed up, as we do not know what is the expected result.
– Dinari
Nov 26 '18 at 11:27
See edit. This prints something very weird.
– Schütze
Nov 26 '18 at 8:59
See edit. This prints something very weird.
– Schütze
Nov 26 '18 at 8:59
1
1
Post your code, This seems like a problem with the notebook your using, the figure does not get the size it should get.
– Dinari
Nov 26 '18 at 9:02
Post your code, This seems like a problem with the notebook your using, the figure does not get the size it should get.
– Dinari
Nov 26 '18 at 9:02
I don't think what you created with
np.eye()
there is the same with my data though. Mine is (510, 7) <class 'numpy.ndarray'>
– Schütze
Nov 26 '18 at 10:25
I don't think what you created with
np.eye()
there is the same with my data though. Mine is (510, 7) <class 'numpy.ndarray'>
– Schütze
Nov 26 '18 at 10:25
Probaly not, but
binary = image > 0
create a binary array which I am using to plot. The content of the array does not matter, as long as it is Binary.– Dinari
Nov 26 '18 at 10:27
Probaly not, but
binary = image > 0
create a binary array which I am using to plot. The content of the array does not matter, as long as it is Binary.– Dinari
Nov 26 '18 at 10:27
1
1
You have an image of
(510,7)
, it will look like a very narrow rectangle, I don't know if it is messed up, as we do not know what is the expected result.– Dinari
Nov 26 '18 at 11:27
You have an image of
(510,7)
, it will look like a very narrow rectangle, I don't know if it is messed up, as we do not know what is the expected result.– Dinari
Nov 26 '18 at 11:27
|
show 5 more comments
Maybe you may use PIL
from PIL import Image
data = [...]
width = len(data[0])
height = len(data)
output_image = Image.new(mode='1', size=(width, height))
for x in range(height):
for y in range(width):
pixel_value = data[x][y]
output_image.putpixel((x,y), pixel_value)
output_image
with data = [[0,0,0,0], [0,0,1,1], [1,1,1,0], [0,1,1,0]]
i have such image ->
Gave an error atoutput_image.putpixel((x,y), pixel_value)
sayingSystemError: new style getargs format but argument is not a tuple
– Schütze
Nov 26 '18 at 9:04
What version of PIL you use ?
– Nick
Nov 26 '18 at 9:21
Version I have is 5.1.0
– Schütze
Nov 26 '18 at 9:27
I have version 5.3.0 and python3.6 , and all works. Try to update PIL version
– Nick
Nov 26 '18 at 9:29
add a comment |
Maybe you may use PIL
from PIL import Image
data = [...]
width = len(data[0])
height = len(data)
output_image = Image.new(mode='1', size=(width, height))
for x in range(height):
for y in range(width):
pixel_value = data[x][y]
output_image.putpixel((x,y), pixel_value)
output_image
with data = [[0,0,0,0], [0,0,1,1], [1,1,1,0], [0,1,1,0]]
i have such image ->
Gave an error atoutput_image.putpixel((x,y), pixel_value)
sayingSystemError: new style getargs format but argument is not a tuple
– Schütze
Nov 26 '18 at 9:04
What version of PIL you use ?
– Nick
Nov 26 '18 at 9:21
Version I have is 5.1.0
– Schütze
Nov 26 '18 at 9:27
I have version 5.3.0 and python3.6 , and all works. Try to update PIL version
– Nick
Nov 26 '18 at 9:29
add a comment |
Maybe you may use PIL
from PIL import Image
data = [...]
width = len(data[0])
height = len(data)
output_image = Image.new(mode='1', size=(width, height))
for x in range(height):
for y in range(width):
pixel_value = data[x][y]
output_image.putpixel((x,y), pixel_value)
output_image
with data = [[0,0,0,0], [0,0,1,1], [1,1,1,0], [0,1,1,0]]
i have such image ->
Maybe you may use PIL
from PIL import Image
data = [...]
width = len(data[0])
height = len(data)
output_image = Image.new(mode='1', size=(width, height))
for x in range(height):
for y in range(width):
pixel_value = data[x][y]
output_image.putpixel((x,y), pixel_value)
output_image
with data = [[0,0,0,0], [0,0,1,1], [1,1,1,0], [0,1,1,0]]
i have such image ->
edited Nov 26 '18 at 9:23
answered Nov 26 '18 at 8:40
NickNick
2998
2998
Gave an error atoutput_image.putpixel((x,y), pixel_value)
sayingSystemError: new style getargs format but argument is not a tuple
– Schütze
Nov 26 '18 at 9:04
What version of PIL you use ?
– Nick
Nov 26 '18 at 9:21
Version I have is 5.1.0
– Schütze
Nov 26 '18 at 9:27
I have version 5.3.0 and python3.6 , and all works. Try to update PIL version
– Nick
Nov 26 '18 at 9:29
add a comment |
Gave an error atoutput_image.putpixel((x,y), pixel_value)
sayingSystemError: new style getargs format but argument is not a tuple
– Schütze
Nov 26 '18 at 9:04
What version of PIL you use ?
– Nick
Nov 26 '18 at 9:21
Version I have is 5.1.0
– Schütze
Nov 26 '18 at 9:27
I have version 5.3.0 and python3.6 , and all works. Try to update PIL version
– Nick
Nov 26 '18 at 9:29
Gave an error at
output_image.putpixel((x,y), pixel_value)
saying SystemError: new style getargs format but argument is not a tuple
– Schütze
Nov 26 '18 at 9:04
Gave an error at
output_image.putpixel((x,y), pixel_value)
saying SystemError: new style getargs format but argument is not a tuple
– Schütze
Nov 26 '18 at 9:04
What version of PIL you use ?
– Nick
Nov 26 '18 at 9:21
What version of PIL you use ?
– Nick
Nov 26 '18 at 9:21
Version I have is 5.1.0
– Schütze
Nov 26 '18 at 9:27
Version I have is 5.1.0
– Schütze
Nov 26 '18 at 9:27
I have version 5.3.0 and python3.6 , and all works. Try to update PIL version
– Nick
Nov 26 '18 at 9:29
I have version 5.3.0 and python3.6 , and all works. Try to update PIL version
– Nick
Nov 26 '18 at 9:29
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53477228%2fpython-displaying-a-binary-array-as-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried matplotlib?
– Dinari
Nov 26 '18 at 8:34
Got another error with that, but perhaps it was because of something else, could you suggest a way with matplotlib?
– Schütze
Nov 26 '18 at 8:36
Please do not even think of pasting the whole code here. Create a Minimal, Complete, and Verifiable example instead.
– Goyo
Nov 26 '18 at 9:30
Not sure if this was a bot answer or not @Goyo. I said myself I cannot paste the code here, you don't need to link me that page.
– Schütze
Nov 26 '18 at 9:36
1
No, it's not. But you do not need to care, just think whether the advice makes sense or not. You have an example of matplotlib working with sample data. It does not work with your data but we don't know why. Knowing that it comes from a masked prediction tensor does not help. Having an actual hardcoded sample does.
– Goyo
Nov 26 '18 at 9:49