imshow

Matplotlib : What is the function of cmap in imshow?

﹥>﹥吖頭↗ 提交于 2019-12-18 12:29:31
问题 I'm trying to learn opencv using python and came across this code below: import cv2 import numpy as np from matplotlib import pyplot as plt BLUE = [255,0,0] img1 = cv2.imread('opencv_logo.png') replicate = cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_REPLICATE) reflect = cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_REFLECT) reflect101 = cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_REFLECT_101) wrap = cv2.copyMakeBorder(img1,10,10,10,10,cv2.BORDER_WRAP) constant= cv2.copyMakeBorder(img1

Dates in the xaxis for a matplotlib plot with imshow

末鹿安然 提交于 2019-12-18 03:10:12
问题 So I am new to programming with matplotlib. I have created a color plot using imshow() and an array. At first the axis were just the row and column number of my array. I used extent = (xmin,xmax,ymin,ymax) to get the x-axis in unix time and altitude, respectively. I want to change the x-axis from unix time (982376726,982377321) to UT(02:25:26, 02:35:21). I have created a list of the time range in HH:MM:SS. I am not sure how to replace my current x-axis with these new numbers, without changing

Matplotlib - sequence is off when using plt.imshow()

一曲冷凌霜 提交于 2019-12-17 09:57:42
问题 I write a dog-classifier in a Jupyter notebook that, every time a dog is detected in an image, should show the image and print some text describing it. Somehow, the images are always displayed after all the text was printed, no matter in which order I put plt.imshow() and print() . Does anybody know why this is the case? Thank you! Here is my code-snippet: for i in range (0, 1,1): all_counter+=1 if dog_detector(dog_files_short[i]): img = image.load_img(dog_files_short[i], target_size=(224,

Matplotlib adjust image subplots hspace and wspace [duplicate]

依然范特西╮ 提交于 2019-12-14 03:06:00
问题 This question already has answers here : How to remove gaps between *images* in matplotlib? (2 answers) Closed last year . I’m trying to build a figure with 9 image subplots on a 3×3 grid, all sharing X or Y axes, and with no space between adjacent subplots. The following code adds the required axis and collapses the space between them. So far, so good: fig, axes = plt.subplots(ncols=3, nrows=3, sharex=True, sharey=True) fig.subplots_adjust(hspace=0, wspace=0) However, plotting images inside

Matlab GUI axes extract position from datacursor

自闭症网瘾萝莉.ら 提交于 2019-12-13 08:03:27
问题 hope anyone can help me. I try to load and display a image in my GUI. After that i activate datacursormode. Now I want to extract the position from my datacursor object and save the informations into a global variable to work on this data. Here is my code: function varargout = myGui(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @myGui_OpeningFcn, ... 'gui_OutputFcn',

Getting an RGBA array from a matplotlib image

时间秒杀一切 提交于 2019-12-13 03:37:29
问题 I was using imshow to plot an array with a custom colormap and boundarynorm. However, this is going to be an automated script and I want to save the image produced by imshow without the axes. So I wasn't sure imshow was the best way to do this since its going to be running in the background. Is there an alternative where I can just set the colormap and boundarynorm and produce a rgba array that I can give to imsave ? Or am I just left with hacking the image that imshow produce and saving that

Pyplot imshow not showing square pixels when setting aspect ratio

ε祈祈猫儿з 提交于 2019-12-13 03:21:50
问题 I am having some trouble using Pyplot imshow to plot an image from a numpy ndarray called data keeping both its aspect ratio and square-shaped pixels. The shape of the ndarray is (112, 2182) . Here´s the code I´m using: import matplotlib as mpl from mpl_toolkits.axes_grid1 import make_axes_locatable import numpy as np mpl.use('Agg') import matplotlib.pyplot as plt data = np.random.random_sample((112, 2182)) plt.figure(figsize=(25, 3.5)) plt.subplots_adjust(left=0.1, right=0.9) ax = plt

Matplotlib, refresh image with imshow faster

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 20:24:53
问题 I am working on a project on which I have to plot an image of 320*250 pixels and this 60 times per second if possible, on a window of a GUI. So I try to do this with matplotlib 2.0.2 , Python 3.6 and PyQt5 (because I begin to know these tools and work on another project with this), in the following way : import sys, random, matplotlib from PyQt5 import QtCore, QtGui, QtWidgets matplotlib.use('Qt5Agg') from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas import

cv2.imshow image window placement is outside of viewable screen

痴心易碎 提交于 2019-12-12 09:35:30
问题 I am running Anaconda install of python35 with cv2 install from menpo. I am having trouble with cv2.imshow() inconsistently placing the image window outside of the viewable screen when running code similar to the one below both as a standalone script and line by line in the console (cmd, spyder, ipython)... import cv2 img = cv2.imread('Image71.jpg',0) cv2.startWindowThread() cv2.namedWindow('image') cv2.imshow('image',img) cv2.waitKey(0) cv2.destroyAllWindows() I have also tried the above

How do I change the data display format for a imshow plot in matplotlib?

北城以北 提交于 2019-12-12 02:49:21
问题 Or more specifically, how can I change the [659] on the upper-right corner to '659 degrees' or something like that ? I have checked all the threads mentioned in the following reply: matplotlib values under cursor. However, all of them seem to address the x,y location of the cursor. I am interested in changing the data-value. I could not find a reply or related documentation in the api. I have tried both format_coord(x, y) and format_cursor_data(data) but neither of them seem to be working.