如何在picloud上使用opencv?
这个简单的numpy测试适用于
import cloud
import numpy as np
import time
data= np.random.rand(100,4)
t0= time.time()
job_id= cloud.call(np.dot,data,data.T)
cloud.join(job_id)
res= cloud.result(job_id)
print (time.time()-t0)
print res.shape
t0= time.time()
res= np.dot(data,data.T)
print (time.time()-t0)
print res.shape
但这不是
import cv
im= cv.LoadImage("D:\001_001.tif")
t0= time.time()
job_id= cloud.call(cv.Smooth,im,im)
cloud.join(job_id)
res= cloud.result(job_id)
print (time.time()-t0)
错误
Traceback (most recent call last):
File "D:test_cloud.py", line 13,
in <module>
cloud.join(job_id)
File "C:Python27libsite-packagescloudcloud.py", line 721, in join
neededJids = filter_xrange_list(resultFilter, neededJids)
File "C:Python27libsite-packagescloudutilxrange_helper.py", line 167, in
filter_xrange_list
if func(elm):
File "C:Python27libsite-packagescloudcloud.py", line 719, in resultFilter
return filterJob(jid, status) # filter out done jobs; raise exception on err
ored jobs
File "C:Python27libsite-packagescloudcloud.py", line 668, in filterJob
raise CloudException(exception, jid=jid, status=status, hint=hint)
cloud.cloud.CloudException: Job 8: Fatal Python error: Segmentation fault
Current thread 0x00007f162e1d3720:
File "/usr/local/picloud/.employee/pimployee/job_util.py", line 136 in process
_job
File "/usr/local/picloud/.employee/job_task.py", line 74 in <module>
TIP: It looks like your program crashed. If it is not clear how to solve this, p
lease file a support ticket (https://www.picloud.com/accounts/support/).
更新:也不适用于cv2接口。
import cv2
im= cv2.imread("D:\001_001.tif")
t0= time.time()
job_id= cloud.call(cv2.blur,im,im)
cloud.join(job_id)
res= cloud.result(job_id)
print (time.time()-t0)
旧cv-api使用的是IplImages,而不是numpy数组。
而不是:
import cv
im= cv.LoadImage("D:\001_001.tif")
您应该使用:
import cv2
im= cv2.imread("D:\001_001.tif")
一般来说,避免使用过时的cv模块,它在下一版本的opencv 中不可用