imshow

Matplotlib: Same height for subfigures

假装没事ソ 提交于 2019-12-11 03:08:43
问题 in the following example, how can I set both subfigures to the same height? #minimal example import matplotlib.pyplot as plt import numpy as np f, (ax1, ax2) = plt.subplots(1, 2) im = np.random.random((100,100)) ax1.imshow(im) ax1.set_xlim(0, im.shape[1]) ax1.set_ylim(0, im.shape[0]) x = np.arange(100) ax2.plot(x, x**2) 回答1: You can use matplotlib.gridspec : import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np # Add subplots using gridspec instead of plt

Using imshow in opencv without running X

左心房为你撑大大i 提交于 2019-12-11 00:59:44
问题 I've got an application with a Raspberry Pi running Debian that is pretty performance demanding and I am trying to avoid starting X when booting and jumping directly into the program. This works fine, but if I would like to use the 'imshow' function in OpenCV, it does not work correctly, instead it says 'GTK-Warning: cannot open display" and exits the program. Is it feasible to display a fullscreen image/video capture with opencv using imshow or any other function without X, or is it entirely

How to control mouseover text in matplotlib

只谈情不闲聊 提交于 2019-12-10 18:55:31
问题 When you mouseover an image shown with imshow, you can mouseover the image to inspect its RGB values. The bottom-right corner of the matplotlib window (sharing space with the toolbar), shows the image coordinates and RGB values of the pixel being pointed at: x = 274.99 y = 235.584 [.241, .213, .203] However, when I mouseover a quiver plot, it only shows the x and y coords of the pointer, but not the value of the 2D vector being pointed at. Is there a way to get the vector values to show up? I

Matplotlib imshow: how to apply a mask on the matrix

时光怂恿深爱的人放手 提交于 2019-12-08 16:57:00
问题 I am trying to analyse graphically 2d data. matplotlib.imshow is very useful in that but I feel that I could make even more use of that if I could exclude some cells from my matrix, values of outside of a range of interest. My problem is that these values ''flatten'' the colormap in my range of interest. I could have more color resolution after excluding these values. I know how to apply a mask on my matrix to exclude these values, but it returns a 1d object after applying the mask: mask =

Density plot with python making a Diffraction pattern with Bessel Integrals but it wont stop running

别说谁变了你拦得住时间么 提交于 2019-12-08 01:01:56
问题 I am trying to make a circular diffraction pattern, which has a central spot surrounded by a series of rings. It involves a Bessel integral to do it which is defined in the code. My problems is that it takes too long like I waited 10 min for the code to run but didn't get anything to display. I understand it is because my Bessel integral has 1000 iterations per point can any one help with this ? Am I on the right track? I am trying to self teach myself python and computational physics via

scipy.misc.imshow RuntimeError('Could not execute image view')

我的未来我决定 提交于 2019-12-07 03:20:49
问题 I am testing scipy.misc.imshow and I got RuntimeError: Could not execute image viewer . I am using Python3.4 and running it on CentOS 7. import scipy.misc img = scipy.misc.imread('Data/cat.jpg') assert len(img.shape) == 3 img_resized = scipy.misc.imresize(img, (224, 224)) img_answer = (img_resized/255.0).astype('float32') scipy.misc.imshow(img_answer) And I got an error: sh: see: command not found Traceback (most recent call last): File "/usr/local/pycharm/helpers/pydev/pydev_run_in_console

Density plot with python making a Diffraction pattern with Bessel Integrals but it wont stop running

筅森魡賤 提交于 2019-12-06 11:21:31
I am trying to make a circular diffraction pattern, which has a central spot surrounded by a series of rings. It involves a Bessel integral to do it which is defined in the code. My problems is that it takes too long like I waited 10 min for the code to run but didn't get anything to display. I understand it is because my Bessel integral has 1000 iterations per point can any one help with this ? Am I on the right track? I am trying to self teach myself python and computational physics via Mark Newmans book Computational Physics the exercise is 5.4 of Computational Physics.Here is a link to the

Image gradually erased when overlayed with lines

雨燕双飞 提交于 2019-12-05 12:00:27
Apart from the fact there exist special functions to plot vector fields, I have encountered a strange Matlab behaviour : Plotting an image (with imagesc or imshow ) and overlaying it with colored lines (with plot or line ) leads at some point to an erasement of the background image. %% some data... % random image Image = rand(200,400); % 900 lines of random color color1 = rand(1,900); color2 = rand(2,900); color3 = rand(3,900); % some positions x = 31:60; y = 31:60; [X,Y] = meshgrid(x,y); %% plot process % plot Image (with 'imshow' or 'imagesc') imshow(Image); hold on; % plot the lines (with

scipy.misc.imshow RuntimeError('Could not execute image view')

梦想的初衷 提交于 2019-12-05 07:55:06
I am testing scipy.misc.imshow and I got RuntimeError: Could not execute image viewer . I am using Python3.4 and running it on CentOS 7. import scipy.misc img = scipy.misc.imread('Data/cat.jpg') assert len(img.shape) == 3 img_resized = scipy.misc.imresize(img, (224, 224)) img_answer = (img_resized/255.0).astype('float32') scipy.misc.imshow(img_answer) And I got an error: sh: see: command not found Traceback (most recent call last): File "/usr/local/pycharm/helpers/pydev/pydev_run_in_console.py", line 71, in <module> globals = run_file(file, None, None) File "/usr/local/pycharm/helpers/pydev

Fitting an image to screen using imshow opencv

陌路散爱 提交于 2019-12-04 16:27:59
问题 I want to display an image using opencv on Mac os X 13'. The image size is 1920 × 1080. When I run this code, I see just a part of an image. I need to fit the image to the screen. #include <stdio.h> #include <stdlib.h> #include <string.h> #include<opencv2/core/core.hpp> #include<opencv2/highgui/highgui.hpp> #include "opencv2/opencv.hpp" #include<string.h> using namespace cv; using namespace std; int main() { Mat image=imread("/Users/rafikgouiaa/Qt/projects/MakeVideo/build-MakeVideo- Desktop