小编Car*_*eto的帖子

如何使用Python鼠标单击选择的区域?

我正在使用Matplotlib和PIL使用python,需要查看图像选择并剪切我必须使用的区域,只留下所选区域的图像.我知道如何使用pil切割图像(使用im.crop)但是如何通过鼠标点击选择坐标来压缩图像?为了更好地解释,我裁剪图像如下:

import Pil 
import Image
im = Image.open("test.jpg")

crop_rectangle = (50, 50, 200, 200)
cropped_im = im.crop(crop_rectangle)

cropped_im.show()
Run Code Online (Sandbox Code Playgroud)

我需要在一个我想要使用的矩形中用鼠标点击给出坐标"crop_rectangle",我该怎么办呢?

谢谢

python image-processing matplotlib python-imaging-library

4
推荐指数
1
解决办法
6565
查看次数

如何使用python matplotlib估计卫星图像中的像素数

我正在使用卫星图像.我有一个程序(Python)来根据云顶的温度对比卫星图像,程序如下:

from pylab import *
#import pylab imread,imshow


sat=imread('1101092045G13I04.tif')
imshow(sat)
map=imread('map.tif')
map=mean(map,2,)/3
#contour(map,cmap=cm.gray)

imshow((sat+map)**2,cmap=cm.gray,origin=1)

frio=where(logical_and((418.-sat)-273.15>=-110,(418.-sat)-273.15<=-31),(418.-sat)-273.15,0)
quente=where(logical_and((660.-sat)/2-273.15>-31,(660.-sat)/2-273.15<=40),(660.-sat)/2-273.15,0)
imshow=((frio+quente))

temperatura=[-80,-70,-60,-50,-40,-30]

#cores -> 'r','b','k','c','g','m','y'

amar='#ffff00'
verm='#ff3333'
verd='#00ff00'
lara='#ff9900'
aaaa='#ff00ff'

contourf((frio+quente),temperatura,transparent='true',colors=[aaaa,verm,lara,amar,verd])
colorbar(cmap=cm.hot,shrink=0.6,orientation='horizontal',ticks=[-80, -70, -60, -50, -40, -30])


show()
#savefig('testeII.png') 
Run Code Online (Sandbox Code Playgroud)

现在我需要估算每个温度范围的像素数.我该怎么做?请帮我.

python image-processing matplotlib

2
推荐指数
1
解决办法
272
查看次数

如何使用python选择图像的一部分?

我正在使用卫星图像,我需要选择图像的一部分才能工作.我该怎么做?Im.crop看起来没有用.调整?

谢谢

python image-processing

2
推荐指数
1
解决办法
2万
查看次数