How to play with devices like accelerometer and camera using C/C++?

怎甘沉沦 提交于 2019-12-06 11:49:20

问题


As you can see in architecture diagram below android platform has been built using different layers.

  • Application are developed in Java
  • Application Framework is written using Java (according to my understanding)
  • Libraries are in C/C++

For some insane reason I have to play/deal with devices like accelerometer, compass and camera using C/C++ which means directly accessing them in 3rd layer i.e. Libraries. According to my understanding the Application Framework itself would be consuming Libraries for accessing these devices and then providing APIs for Applications.

I am looking for any documentation/tutorials/demo which can help me in this regard i.e how to access and use these devices like camera, accelerometer and compass from C/C++ code or in other words how to play with these devices directly from Libraries layer.

My last option would be to get the android source code and dig deep into it to find out what I am looking for but I would like some easy way in form of a documentation/demo/tutorial/anything that can make this a bit easy for me.


回答1:


I am looking for any documentation/tutorials/demo which can help me in this regard i.e how to access and use these devices like camera, accelerometer and compass from C/C++ code or in other words how to play with these devices directly from Libraries layer.

You don't. You access them from Java code. Reorganize your C/C++ code to support your Java code.




回答2:


For the camera, you can use opencv to access the frames with a c++ library. For the Accelerometer, I'm looking for how to access using c++.



来源:https://stackoverflow.com/questions/6491857/how-to-play-with-devices-like-accelerometer-and-camera-using-c-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!