This is more similar to that that you have written:

import pyqtgraph as pg
import numpy as np
from pyqtgraph.Qt import QtCore, QtGui

pg.setConfigOptions(imageAxisOrder='row-major')

app = QtGui.QApplication([])

win = pg.GraphicsWindow()
vb = win.addViewBox()
v1 = pg.np.random.normal(size=(100, 100))

img1 = pg.ImageItem(v1)
v2 = np.zeros_like(v1, dtype='uint8')

v2[40:60, 40:60] = 255
img2 = pg.ImageItem(v2)

vb.addItem(img1)
vb.addItem(img2)
img2.setZValue(10)
img2.setOpacity(0.5)
#img2.scale(10,10)
win.show()

QtGui.QApplication.instance().exec_()




Il giorno lunedì 18 maggio 2020 19:13:07 UTC+2, Jean-Pierre Morichon ha 
scritto:
>
> Hi All,
>
> I have a greylevel image and a binary mask.
> I would like to display the binary mask (img2 below) as overlay to the 
> greylevel image but with a specific color for the binary mask (let's say 
> red)
>
> import pyqtgraph as pg
> import numpy as np
> from pyqtgraph.Qt import QtCore, QtGui
>
> pg.setConfigOptions(imageAxisOrder='row-major')
>
> app = QtGui.QApplication([])
>
> win = pg.GraphicsWindow()
> vb = win.addViewBox()
> img1 = pg.ImageItem(pg.np.random.normal(size=(100, 100)))
> img2 = np.zeros_like(img1, dtype='uint8')
> img2[40:60, 40:60] = 255
> vb.addItem(img1)
> vb.addItem(img2)
> img2.setZValue(10)
> img2.setOpacity(0.5)
> img2.scale(10,10)
> win.show()
>
> QtGui.QApplication.instance().exec_()
>
> I have looked for a solution on the net for 3 days wi th no success: the 
> only color stuff is about colormaps but I may be wrong but this is not what 
> I am lookign for.
>
> Your help would be appreciated
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/860cfe87-5dad-4d77-8d6e-8fbd9c54805b%40googlegroups.com.

Reply via email to