0

I have an image that is created by numpy array (x,y) = temperature with OpenCv and then used pixmap to show in pyqt5.

I need to create a color bar with following conditions: set a start temperature, let's say 0

  • All above 0 coordinates should go from light green to dark green.
  • All under 0 coordinates should go from blue to dark blue.

The idea is to create some sort of interface box in pyqt so that by adjusting a start temp the color of an image will be changed. All pixels of temp 0> will be in a range of green and 0<= will be in a range of green.

Q: Is there a way to do this in pyqt5? If so how? How to make an image change it's color?

Tried to look up at pyplt as analog of matplotlib, heatmaps, but this was not exactly what expected. Ideas was to work with hsv, pixmap2image2np and then change the colors there but I don't know how to make it to different colors.

  • 1
    Your question is not clear, 1. why don't you use matplotlib's colormap and embed it in PyQt? 2. If it is some special colormap then you could place an image of what you want to obtain. – eyllanesc Mar 24 '22 at 18:16
  • @eyllanesc How do I embed it to PyQt? The idea is to create some sort of interface in pyqt so that by adjusting a start temp the color of an image will be changed. All pixels of temp 0> will be in a range of green and 0<= will be in a range of green. – Maria Hussey Mar 24 '22 at 18:34
  • https://stackoverflow.com/questions/12459811/how-to-embed-matplotlib-in-pyqt-for-dummies – eyllanesc Mar 24 '22 at 18:35
  • Another possibility is to use a Qimage.Format_Indexed8 and set the colormap with QImage.setColorTable ; beforehand you'll just have to convert the temperature field into np.int8 (i.e. rescale the min-max range to 0-255). – Demi-Lune Mar 24 '22 at 22:15

0 Answers0