-
Notifications
You must be signed in to change notification settings - Fork 298
Porting ViSP to android #307
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
Conversation
took opencv's cmake files as reference. started editing those VISP cmake files whose corresponding OpenCV cmake file had android build flags
I think that we should start to port ViSP without the support of any 3rd party. There is already apriltag that is embedded in ViSP source code and that could be a good candidate for a first demo (see tutorial). The pseudo-code of the demo could be:
Than in a second time, we could add the support of OpenCV 3rd party. |
defined 3 extra macros
hi @fspindle I'm on mid way adding and editing cmake files for android build. Since these files are much similar to the OpenCV analogues, I made a README file where you can refer the file changes I'm making. Can you check:
thanks |
hi @fspindle I had some doubts regarding the core module
|
took opencv's cmake files as reference. started editing those VISP cmake files whose corresponding OpenCV cmake file had android build flags
defined 3 extra macros
resolved the wordexp() error in vpIOTools extra CFlags in the android.toolchain file itself
Hi Akshay, Thanks for the work you are doing. I will check your PR ASAP. You are right, Concerning,
and later in the file something similar to
|
resolved 64 bit offset issues
hi @fspindle Thanks for the advice, made the edits in But soon after that, few files in Now the build works well for Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work. I have no time yet to have a trial, but it seems promising.
Minor comment: The logo platforms/android/service/engine/res/drawable/icon.png should be the one of ViSP https://visp.inria.fr/files/2015/12/visp-logo-sans-texte-128x128.png or this one https://visp.inria.fr/files/2015/12/visp-logo-140x140.png
cmake/GenAndroidMK.cmake
Outdated
endif () | ||
else () | ||
ocv_get_libname(lib_name "${_output}") | ||
visp_get_libname(lib_name "${_output}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be here vp_get_libname
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory") | ||
endif() | ||
endif(NOT CMAKE_TOOLCHAIN_FILE) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put endif()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
else(NOT CMAKE_TOOLCHAIN_FILE) | ||
#Android: set output folder to ${CMAKE_BINARY_DIR} | ||
set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH "root for library output, set this to change where android libs are compiled to" ) | ||
# Crosscompiling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove space set(LIBRARY_OUTPUT_PATH_ROOT ...)
cmake/GenConfig.cmake
Outdated
if(HAVE_CUDA) | ||
vp_cmake_configure("${CMAKE_CURRENT_LIST_DIR}/templates/VISPConfig-CUDA.cmake.in" CUDA_CONFIGCMAKE @ONLY) | ||
endif() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ViSP doesn't use CUDA.
Should be removed as well as templates/VISPConfig-CUDA.cmake.in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the interest of this new file. There is already cmake/VISPGenerateConfig.cmake
cmake/GenConfig.cmake
Outdated
DESTINATION "${VISP_CONFIG_INSTALL_PATH}" COMPONENT dev) | ||
endif() | ||
endfunction() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see more this function in cmake/VISPUtils.cmake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transferred the function to VISPUtils.cmake
@@ -0,0 +1,92 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project name="OpenCV Manager" default="help"> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ViSP Manager
<string name="about">About</string> | ||
<string name="checkUpdate">Check for update</string> | ||
<string name="intro">OpenCV library is used by other applications for image enhancement, panorama stitching, object detection, recognition and tracking and so on. OpenCV Manager provides the best version of the OpenCV for your hardware. See opencv.org for details.</string> | ||
</resources> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ViSP
* @return Returns OpenCV libraries names separated by symbol ";" in loading order | ||
*/ | ||
String getLibraryList(String version); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ViSP
} | ||
}; | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ViSP
adb install <path-to-OpenCV-sdk>/apk/OpenCV_<version>_Manager_<app_version>_<platform>.apk | ||
|
||
Example: OpenCV_3.4.0-dev_Manager_3.40_armeabi-v7a.apk | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ViSP
Hi @fspindle Just finished making the OpenCV to VISP edits you mentioned. Also I'm trying to make a demo AprilTag detection app(get the source code here). I'll try to target only latest android version(API>=24) since older versions aren't maintained now and are buggy. Following the tutorial you referred, creating a I read that OpenCV android sdk has its own camera framework(they don't use the default one). I'll try to figure out how it works and update you. Thanks |
Ok to consider the latest Android version. In ViSP there is no aRGB to grey conversion, but if SSE3 is available on Android there is an optimized version of RGBa to grey conversion that could be a a good starting to implement a new To speed up the Apriltag detection, before reconsidering a new camera framework, you can try to use:
On 640 by 480 images, I succeeded to make detection realtime on Raspberry Pi 3 setting |
Small precision, Android is most likely run on ARM platform and SSE intrinsics are x86 only. Maybe this conversion could be done directly with Android API? |
Hi all Finally got a working demo for single image AprilTag detection on x86 arch, tested on API-24(get the source code and prebuilt apk's here). But there are some issues
I'm trying real time detection( Lastly I had some doubts:
Looking for your advice |
Hi all Tweaked a few detection parameters(and some changes on Camera Preview on java side) and finally got a demo for realtime
Get the demo video here and the source code here Akshay |
Thanks for the app demo. Very good work. Regarding your previous message and questions, I would prefer that you try to improve the framerate of the demo instead of porting to multiple architectures that could be done later. I think that using I'm not sure to understand your question about Some ideas:
|
Hi @fspindle While working to improve framerate, I read that we can get the live camera feed in YUV And I read that ViSP supports a host of functions for conversion from various formats(YUV, YCbCr, etc) to RGBa. We can get an Now I'm trying to implement
Thanks |
Hi all Recently I was trying to demonstrate a better tag detection using But the images are not well calibrated(get the video here, resulting lines across markers are skewed). Even to calibrate the camera we need OpenCV. So should I try adding OpenCV support(some changes in the build script) or start a |
Hi @fspindle
As per as previous conversation #304, I've learnt how to build a C++ package for android platform using
android.toolchain.cmake
and I'm on my way to build OpenCV for Android(having some 3rd party library issues, you can get the source code here).Meanwhile I began adding android build flags to ViSP's cmake files. As you said, I'm referring OpenCV's cmake files.
There are few ViSP libraries for which there's no corresponding cmake file in the OpenCV source, which I could've referred to. So it'll take time to find such libraries and edit their cmake files.
Also I wanted to have quick android demo showing any of the ViSP's module. But I don't know which one to start with, which is independent of other modules - so as make least edits.
I'll appreciate any advice from you regarding the edits made and whether I'm going in right direction or not.
Thanks
Akshay