imshow

Image is not displaying in Google Colab while using imshow()

Image is not displaying in Google Colab while using imshow() Question: I am working on a project which requires functions from OpenCV to plot images. I am trying to display image using the below code in Google Colab. But nothing shows up in the output. Can anybody help me with this? %pylab notebook import cv2 …

Total answers: 9

How to fix warning "QObject::moveToThread:" for Opencv3 in python3 using Virtual environment?

How to fix warning "QObject::moveToThread:" for Opencv3 in python3 using Virtual environment? Question: I am using opencv-python==3.3.0.10 and python==3.5.2. I have tried to solve above warning with many references available on the same platform but none of is working in my scenario. I was checking below code and i found irritating warning again and again. …

Total answers: 1

How can I generate and display a grid of images in PyTorch with plt.imshow and torchvision.utils.make_grid?

How can I generate and display a grid of images in PyTorch with plt.imshow and torchvision.utils.make_grid? Question: I am trying to understand how torchvision interacts with mathplotlib to produce a grid of images. It’s easy to generate images and display them iteratively: import torch import torchvision import matplotlib.pyplot as plt w = torch.randn(10,3,640,640) for i …

Total answers: 2

Image titles not displaying in loop

Image titles not displaying in loop Question: I wish to display images in a loop with the image name as a title. Each image displays in the loop but the title does not. In the function below, the img_list contains lists with the following [image, image_title]. def display_images(img_list, cmap=’gray’, cols = 2, fig_size = (10, …

Total answers: 1

How to remove gaps between image subplots

How to remove gaps between image subplots Question: Inspired by this question, I’ve been trying to get images plotted without gaps. In my toy example I have four images that I want to place in two rows. They have different shapes: different number of rows, same number of columns. Despite the differences, they should fit …

Total answers: 2

Adjusting gridlines and ticks in matplotlib imshow

Adjusting gridlines and ticks in matplotlib imshow Question: I’m trying to plot a matrix of values and would like to add gridlines to make the boundary between values clearer. Unfortunately, imshow decided to locate the tick marks in the middle of each voxel. Is it possible to a) remove the ticks but leave the label …

Total answers: 5

Matplotlib : display array values with imshow

Matplotlib : display array values with imshow Question: I’m trying to create a grid using a matplotlib function like imshow. From this array: [[ 1 8 13 29 17 26 10 4], [16 25 31 5 21 30 19 15]] I would like to plot the value as a color AND the text value itself …

Total answers: 2

matplotlib imshow – default colour normalisation

matplotlib imshow – default colour normalisation Question: I have consistently had problems with my colour maps when using imshow, some colours seem to just become black. I have finally realised that imshow seems to, by default, normalise the matrix of floating point values I give it. I would have expected an array such as [[0,0.25],[0.5,0.75]] …

Total answers: 1

Python xticks in subplots

How to set xticks in subplots Question: If I plot a single imshow plot I can use fig, ax = plt.subplots() ax.imshow(data) plt.xticks( [4, 14, 24], [5, 15, 25] ) to replace my xtick labels. Now, I am plotting 12 imshow plots using f, axarr = plt.subplots(4, 3) axarr[i, j].imshow(data) How can I change my …

Total answers: 2

Python – OpenCV – imread – Displaying Image

Python – OpenCV – imread – Displaying Image Question: I am currently working on reading an image and displaying it to a window. I have successfully done this, but upon displaying the image, the window only allows me to see a portion of the full image. I tried saving the image after loading it, and …

Total answers: 3