Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After building with cmake, how do you load the build onto an emulator? #736

Open
KenKobayashiUCB opened this issue Nov 25, 2018 · 4 comments

Comments

@KenKobayashiUCB
Copy link

I managed to successfully build using cmake, but I am having trouble figuring out how to load the code onto an emulator through android studio.

@headupinclouds
Copy link
Collaborator

I'm not sure what you mean by "the code". If you are referring to the real-time FaceFilter app, I don't think it will be easy to run that in an emulator. You would have to create some kind of camera interface to support testing. There are unit tests that run the drishti library using the Android QEMU emulator. If you are looking for the latter, I can provide some links.

@KenKobayashiUCB
Copy link
Author

Yes, the links will be helpful. Also, sorry for not clarifying, but I did mean the real time FaceFilter App. Also for the camera interface you mentioned, do you mean that I would have to link the emulator to a webcam? or do you mean that I would have to develop some sort of UI to support a camera?

@headupinclouds
Copy link
Collaborator

headupinclouds commented Nov 27, 2018

or do you mean that I would have to develop some sort of UI to support a camera?

AFAIK, the Android emulator doesn't come with camera support. I did check at one point to see if end-to-end application level testing would be possible. I think you would have to write some code to play back video files or something like that.

Why do you need it?

If you manage your unit tests with gauze, it manage the emulator for you:

https://github.com/hunter-packages/gauze

This allows testing OpenGL ES shader pipeline in Travis CI.

See the docs (in particular the Android section):

https://gauze.readthedocs.io/en/latest/prereq/android.html

Example (gauze_main())

int gauze_main(int argc, char** argv)

Or any of the tests in the gauze repo:

https://github.com/hunter-packages/gauze/tree/master/test/gauze

The CI configs provide an example of various gauze Android Emulator settings you can pass from CMake. If you are using OpenGL, you need to use GAUZE_ANDROID_EMULATOR_GPU=host, and on Linux you want GAUZE_ANDROID_EMULATOR_GPU=swiftshader.

drishti/bin/jenkins.sh

Lines 93 to 125 in ee86763

if [[ ${TRAVIS} == "true" ]]; then
GAUZE_ANDROID_USE_EMULATOR=YES # remote test w/ emulator
else
GAUZE_ANDROID_USE_EMULATOR=NO # support local host testing on a real device
fi
if [[ `uname` == "Linux" ]]; then
GAUZE_ANDROID_EMULATOR_GPU=swiftshader
else
GAUZE_ANDROID_EMULATOR_GPU=host
fi
set -x
polly.py \
--toolchain "${TOOLCHAIN}" \
--config "${CONFIG}" \
${VERBOSE} \
--ios-multiarch --ios-combined \
--archive drishti \
--jobs 4 \
${TEST} \
"${INSTALL}" \
--fwd \
DRISHTI_BUILD_SHARED_SDK=${SHARED_SDK} \
DRISHTI_BUILD_TESTS=YES \
DRISHTI_BUILD_EXAMPLES=YES \
DRISHTI_COPY_3RDPARTY_LICENSES=ON \
DRISHTI_HAS_GPU=${GPU} \
DRISHTI_HUNTER_CONFIG_MINIMAL=${MINIMAL} \
GAUZE_ANDROID_USE_EMULATOR=${GAUZE_ANDROID_USE_EMULATOR} \
GAUZE_ANDROID_EMULATOR_GPU=${GAUZE_ANDROID_EMULATOR_GPU} \
GAUZE_ANDROID_EMULATOR_PARTITION_SIZE=40 \

@KenKobayashiUCB
Copy link
Author

Thank you, I'll take a look at the documentation. I'm running it on an emulator because I don't have an android phone handy. As for why I'm interested in running the example code, I want to see how well the library runs on mobile to see if I can apply the library to a research project I'm a part of. My plan would be for the code to run in the background to calculate distance between the phone and face and to also possibly calculate gaze. The calculated information would then be used for image processing variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants