Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android应用程序中运行python图像处理脚本_Android_Python_Opencv - Fatal编程技术网

在android应用程序中运行python图像处理脚本

在android应用程序中运行python图像处理脚本,android,python,opencv,Android,Python,Opencv,我正在使用一个python脚本来检测使用Hough transfrom的圆,它导入了“opencv2”和“math”库。我可以在android应用程序中运行这个脚本吗?如何实现?下面的应用程序就是我想在android应用程序中运行的应用程序。`import cv2 输入数学 def resizeImage(img): dst=cv2.resize(img,None,fx=1,fy=1,interpolation=cv2.INTER_LINEAR) return dst img=c

我正在使用一个python脚本来检测使用Hough transfrom的圆,它导入了“opencv2”和“math”库。我可以在android应用程序中运行这个脚本吗?如何实现?下面的应用程序就是我想在android应用程序中运行的应用程序。`import cv2 输入数学

def resizeImage(img):
    dst=cv2.resize(img,None,fx=1,fy=1,interpolation=cv2.INTER_LINEAR)
    return dst
img=cv2.imread('20140318_174800.jpg')
grey=cv2.imread('20140318_174800.jpg',0)
ret,thresh = cv2.threshold(grey,50,255,cv2.THRESH_BINARY)

circles = cv2.HoughCircles(thresh,cv2.cv.CV_HOUGH_GRADIENT,1,75,param1=50,param2=13,minRadius=0,maxRadius=400)
for i in circles[0,:]:
    #draw the outer circle
    cv2.circle(img,(i[0],i[1]),i[2],(0,255,0),2)
    #draw the centre of the circle
    cv2.circle(img,(i[0],i[1]),2,(0,0,255),3)

##Determine co-ordinates for centre of circle
x1 = circles[0][0][0]
y1 = circles[0][0][1]
#x2 = circles[0][1][0]
#y2 = circles[0][1][1]
##Angle betwen two circles
#theta = math.degrees(math.atan((y2-y1)/(x2-x1)))

##print information
print "x1 = ",x1
print "y1 = ",y1
#print "x2 = ",x2
#print "y2 = ",y2

#print theta
print circles

##Resize image
img = resizeImage(img)
thresh = resizeImage(thresh)
##Show Images 
cv2.imshow("thresh",thresh)
cv2.imshow("img",img)

cv2.waitKey(0)
`自动取款机,你不能

您必须首先为android重新编译cv2模块,就像python4android那样(将系统调用重定向到JavaRMI),这是一项艰巨的工作