Jupyter Notebook Location and Pixel Value

I am using Python 2.7.x with a Jupyter Notebook, matplotlib and% pylab with the %pylab inline internal flag to print images under active cells. I would like to be able to move the cursor over the image and know its location and pixel value. An example could be: (x, y, val) = (123,285,230) but I don’t really understand any of the features of this example.

+5
source share
1 answer

The %matpotlib inline displays output results as png images. It may be possible to write some JavaScript for a Jupyter laptop to get the color and pixel on the mouse above the image at the output of the cell.

However, the easiest way is to use the %matplotlib notebook backend, which saves the matplotlib live image when building it on output, and therefore the usual built-in mouseover function is easily accessible.

enter image description here

Pay attention to the collector in the lower right corner of the image, which displays the x , y and the value of the current pixel.

+9
source

Source: https://habr.com/ru/post/1266701/


All Articles