Discussion:
[pyqtgraph] Problem when displaying an image having all its pixels forced at the same value
m***@gmail.com
2018-10-11 19:52:44 UTC
Permalink
Hello,

I have a problem when displaying an image having all its pixels forced at
the same value, for example 0.
This trivial example illustrates the problem :

import numpy as np
import pyqtgraph as pg

imageData = np.zeros(shape=(150,150), dtype=np.int)
pg.image(imageData)


The result is :

runfile('C:/Users/Marc/.spyder-py3/temp.py',
wdir='C:/Users/Marc/.spyder-py3')
C:\Users\Marc\Anaconda3\lib\site-packages\pyqtgraph\graphicsItems\ImageItem.py:464:
RuntimeWarning: invalid value encountered in double_scalars
bins = np.arange(mn, mx+1.01*step, step, dtype=np.int)
Traceback (most recent call last):

File
"C:\Users\Marc\Anaconda3\lib\site-packages\pyqtgraph\graphicsItems\HistogramLUTItem.py",
line 195, in imageChanged
h = self.imageItem().getHistogram()

File
"C:\Users\Marc\Anaconda3\lib\site-packages\pyqtgraph\graphicsItems\ImageItem.py",
line 464, in getHistogram
bins = np.arange(mn, mx+1.01*step, step, dtype=np.int)

ValueError: arange: cannot compute length


Any idea on the way to solve this without disabling the nice histogram
functionality ?
My real application is displaying images updated slighly more than one time
per second, and sometimes a constant image is generated.
As a work around when I find such an image, I add a small value to one of
the pixels, but this is not a nice solution because the auto adujstment of
the luminance scale displays a white dot on a black image ;-)

Marc
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/d4069e99-fd2c-4b97-9f20-bb3ad72f950d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jim Crowell
2018-10-12 11:38:30 UTC
Permalink
https://groups.google.com/d/topic/pyqtgraph/ofKMx-oWbx8/discussion
Post by m***@gmail.com
Hello,
I have a problem when displaying an image having all its pixels forced at
the same value, for example 0.
import numpy as np
import pyqtgraph as pg
imageData = np.zeros(shape=(150,150), dtype=np.int)
pg.image(imageData)
runfile('C:/Users/Marc/.spyder-py3/temp.py',
wdir='C:/Users/Marc/.spyder-py3')
RuntimeWarning: invalid value encountered in double_scalars
bins = np.arange(mn, mx+1.01*step, step, dtype=np.int)
File
"C:\Users\Marc\Anaconda3\lib\site-packages\pyqtgraph\graphicsItems\HistogramLUTItem.py",
line 195, in imageChanged
h = self.imageItem().getHistogram()
File
"C:\Users\Marc\Anaconda3\lib\site-packages\pyqtgraph\graphicsItems\ImageItem.py",
line 464, in getHistogram
bins = np.arange(mn, mx+1.01*step, step, dtype=np.int)
ValueError: arange: cannot compute length
Any idea on the way to solve this without disabling the nice histogram
functionality ?
My real application is displaying images updated slighly more than one
time per second, and sometimes a constant image is generated.
As a work around when I find such an image, I add a small value to one of
the pixels, but this is not a nice solution because the auto adujstment of
the luminance scale displays a white dot on a black image ;-)
Marc
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/a3f19f18-b2a4-4043-ac7a-673e75c09307%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...