2016-06-13 1 views
0

Julia에서 .h5 파일을 회색조로 변환하려면 어떻게해야합니까?hdf5 파일을 회색조로 변환

LoadError: PyError (:PyObject_Call) <type 'exceptions.TypeError'> 
TypeError(u'Image data can not convert to float',) 
+1

코드에 대한 전체 예제를 게시 할 수 있습니까? 예를 들어 여기에 하나 이상의 패키지를 사용하고있는 것으로 추측되지만 어떤 패키지인지는 분명하지 않습니다. 당신의 객체'stack'이 생성 /로드 된 방법 또한 명확하지 않습니다. –

답변

2

내 생각 엔 당신은 또한 usingImage을 정의하는 다른 패키지와 Images.jl의 정의이 충돌 것입니다 :

은 내가이 오류가이

img = stack[:,:,100] #just some hdf5 file 
img = convert(Image{Images.Gray}, img) 

을 시도했다. 다른 꾸러미가 PythonImage이라고 상상해 봅시다. 이런 식으로 시도 :

using Colors # that way you don't have to say `Images.Gray` 
import PythonImage, Images # `import` rather than `using` prevents conflicts 

imgg = convert(Images.Image{Gray}, img) 

# ...if you need the other one, use `PythonImage.Image` 

또는 수 using Imagesimport PythonImage (또는 그 반대). 당신이 할 수없는 유일한 일은 그들 모두를위한 using이며 모든 것이 작동 할 것으로 기대합니다.