我想在窗口图中同时显示图像及其直方图。我试过了:
def current_ip():
url_list = ['http://ipecho.net/plain', 'http://ipinfo.io/ip', 'http://icanhazip.com']
for i in url_list:
try:
sleep(3)
my_ip = urlopen(i, timeout=5).read()
logging.info('Getting actual IP from: %s ', i)
break
except:
logging.error('Could not get IP from: %s ', i)
my_ip = 'error'
continue
if my_ip == 'error':
logging.error('Could not get outside IP at all...')
restart_interface()
logging.debug('Restarted eth...')
sleep(3)
my_ip = current_ip()
return my_ip.rstrip()
但有了这个,我在另一个窗口中得到直方图。
实现这个目标的方式是什么?
答案 0 :(得分:1)
从docs开始,您可以选择提供histogram
功能的轴,这样就可以了
img = imread('pout.tif');
figure
subplot(1,2,1)
imshow(img)
sp2 = subplot(1,2,2)
histogram(sp2, img);
如果要存储histogram
输出,请使用
h = histogram(sp2, img);
但是,请避免使用hist
作为变量名,因为它是内置Matlab函数的名称。