2012-04-20 3 views
0

I는 다음과 같은 형식으로 한 영상 데이터가 :방법 세그먼트 이미지

200406011215.goes12ir

print im.format, im.size, im.mode 

MCIDAS (1732, 2600) L

이러한 이미지 밝기 (0 -255)의 그들의 대응하는 값과 라인 요소들로 구성되어있다. 특정 속성을 가진 영역을 대상으로하는 스크립트를 만들려고합니다.

스크립트

import Image 
im = Image.open("/home/mcidas/Documents/datos/200404031215.goes12ir") 
im.show() 

제가 > 205 밝기 값 인 표시 화상의 영역을 대상으로 할 수 있는가? 나는 당신이 위의 픽셀을 필터링하는 numpy의 방송을 사용할 수 있습니다

답변

1

지정된 값을 충족 이미지)의 지역에 (원 수 있음) 확인하고 표를 그릴 수있는 방법을 생각이

사람 임계 값. 미리 이미지를 흐리게하면 훨씬 더 잘 작동합니다. (흔들림없이) 전체 작업 예제는 사용자의 요구에 적응, 아래와 같습니다 :

import numpy as np 
from pylab import * 

# Generate random data with a "bright spot" 
N = 100 
line = np.linspace(-3,3,N) 
X, Y = meshgrid(line,line) 
Z = np.exp(-((X+1)**2+(Y-1)**2)) 
Z += np.random.random(Z.shape)*.5 

subplot(121) 
imshow(Z,cmap=gray(), origin="lower", extent=[-3,3,-3,3]) 

Z2 = Z.copy() 
# Identify regions that are brighter than threshold on z_scale 
threshold = .8 
idx = Z2>threshold 

Z2[~idx] = None 
Z2[idx ] = 1 

subplot(122) 
imshow(Z2,cmap=gray(), origin="lower", extent=[-3,3,-3,3]) 

# Place a dot at the "center" of the pixels found 
CM = [X[idx].mean(), Y[idx].mean()] 
scatter(*CM, s=100,color='red') 

show() 

enter image description here