Ask Your Question
0

OpenCV Android with python

asked 2013-11-20 06:51:02 -0600

Katri gravatar image

updated 2013-11-20 07:06:00 -0600

berak gravatar image

Hi,

I am working with OpenCV python. I wish to launch my application in a mobile device i.e. android device. But OpenCV android seems to support only Java. Is there a way where I can use my Python script for OpenCV4Android. Or does anyone know if a future version compatible with python is being released?

Thanks in advance,

edit retag flag offensive close merge delete

Comments

there is sl4a / PythonForAndroid, unfortunately, it uses hardcoded java rmi invocations for anything os related. so - no opencv bindings there ;(

i guess, you'll have to learn java

berak gravatar imageberak ( 2013-11-20 07:09:22 -0600 )edit

thanks berak, Guess I do have to learn Java. Do you think we can extend the code from python to java and then use it? btw do you have any idea id OpenCV plans to launch this with python?

Katri gravatar imageKatri ( 2013-11-21 01:29:58 -0600 )edit
  • "Do you think we can extend the code ? " - hmm, the image manipulation code, maybe. the window / console parts - no.
  • "any idea if OpenCV plans to launch this with python?" - no idea, i'm just a user like you. but i'd say, highly unlikely. it's a lot of effort needed to do so.
berak gravatar imageberak ( 2013-11-21 02:29:58 -0600 )edit

thanx berak. i guess i will go with java. seems like an easier and better option

Katri gravatar imageKatri ( 2013-11-21 02:33:14 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-03-01 15:07:50 -0600

You can try to build Python support for Android yourself :D It's not difficult. OpenCV invokes Python to automatically wrap its features for Python during build time. However, its cmake script prohibits building Python support against Android.

To short-circuit this mechanism, simply grab the auto-generated header files when you normally build OpenCV with Python support on desktop platform (I used Ubuntu), e.g. pyopencv_generated_types.h, generated0.i, put them together with /src2/cv2.cpp and cv2.cv.hpp, write a simple Android.mk (Application.mk is also used to add C++ support), and invoke ndk-build to build a dynamic library. Then you can use Python to do "import cv2"

edit flag offensive delete link more

Comments

there is no cv2.cpp and cv2.cv.hpp under src2 directory!

ParokshaX gravatar imageParokshaX ( 2014-07-23 03:27:01 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-11-20 06:51:02 -0600

Seen: 7,621 times

Last updated: Mar 01 '14