Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display an image with pixel values shown numerically

I'm looking for OpenCV or other Python function that displays a NumPy array as an image like this:

image

Referenced from this tutorial.

  • What function creates this kind of grey-scale image with pixel values display?
  • Is there a color image equivalent?

MATLAB has a function called showPixelValues().

like image 454
Peter Corke Avatar asked Oct 21 '25 03:10

Peter Corke


1 Answers

The best way to do this is to search "heat map" or "confusion matrix" rather than image, then there are two good options:

  1. Using matplotlib only, with imshow() and text() as building blocks the solution is actually not that hard, and here are some examples.

  2. Using seaborn which is a data visualisation package and the solution is essentially a one-liner using seaborn.heatmap() as shown in these examples.

My problem was really tunnel vision, coming at it from an image processing mindset, and not thinking about what other communities have a need to display the same thing even if they call it by a different name.

like image 65
Peter Corke Avatar answered Oct 23 '25 17:10

Peter Corke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!