옵티컬 플로우 프로젝트를 수행하는 데있어 몇 가지 질문이 있습니다. 나는 Python 2 (lasagne를 사용하여 옵티컬 플로우를 배우는 데 깊은 배움을 사용하고자 함)를 사용하고, C++ 함수를 플로우의 시각화에서 파이썬의 함수로 변환하는 방법을 모른다.옵티컬 플로우 .flo 파일
나는 내가 그들의 광학 흐름을 추정해야 할 몇 가지 이미지 쌍 (http://vision.middlebury.edu/flow/data/comp/zip/other-gt-flow.zip에서) 다운로드, 그들의 지상 진실 흐름 (.flo 파일). 문제는, .flo 파일을 프로그램에 읽어 들일 때 벡터화 된 코드라는 것입니다. 웹 페이지 (http://vision.middlebury.edu/flow/data/)에 어떻게 표시되는지를 어떻게 볼 수 있습니까? 나는 다양한 출처에서 읽고 다음을 시도했지만 작동하지 않습니다.
내 예측을 .flo 파일과 비교해야하는 경우 어떤 형식으로 EPE (엔드 포인트 오류)를 평가할 때 있습니까?
코드 :
################################ Reading flow file ################################
f = open('flow10.flo', 'rb')
x = np.fromfile(f, np.int32, count=1) # not sure what this gives
w = np.fromfile(f, np.int32, count=1) # width
h = np.fromfile(f, np.int32, count=1) # height
print 'x %d, w %d, h %d flo file' % (x, w, h)
data = np.fromfile(f, np.float32) # vector
data_2D = np.reshape(data, newshape=(388,584,2)); # convert to x,y - flow
x = data_2D[...,0]; y = data_2D[...,1];
################################ visualising flow file ################################
mag, ang = cv2.cartToPolar(x,y)
hsv = np.zeros_like(x)
hsv = np.array([ hsv,hsv,hsv ])
hsv = np.reshape(hsv, (388,584,3)); # having rgb channel
hsv[...,1] = 255; # full green channel
hsv[...,0] = ang*180/np.pi/2 # angle in pi
hsv[...,2] = cv2.normalize(mag,None,0,255,cv2.NORM_MINMAX) # magnitude [0,255]
bgr = cv2.cvtColor(hsv,cv2.COLOR_HSV2BGR)
bgr = draw_hsv(data_2D)
cv2.imwrite('opticalhsv.png',bgr)