endink / Mediapipe4u-plugin

340 stars 48 forks source link

OpenCV Android #168

Closed ffreality closed 1 month ago

ffreality commented 1 month ago

Comparison Product

No response

Feature Category

Packaging

Feature Description

You said in Known Issues that we had to OpenCV for some features but if we try to integrate OpenCV as external module plugin and package for Android, UE gives typdef clash error for uint8_t

So, can we say OpenCV is not necessary for everything (for example Android Hamd Tracking, Object Detection, Face Detection) or do you have a solution for that clash ?

endink commented 1 month ago

I don't quite understand if this question is related to M4U ?

Known isuuse is only for new version for M4U (not released) and windows, Android platform has no problem.

endink commented 1 month ago

Comparison Product

No response

Feature Category

Packaging

Feature Description

You said in Known Issues that we had to OpenCV for some features but if we try to integrate OpenCV as external module plugin and package for Android, UE gives typdef clash error for uint8_t

So, can we say OpenCV is not necessary for everything (for example Android Hamd Tracking, Object Detection, Face Detection) or do you have a solution for that clash ?

Google mediapipe depend on OpenCV, and UnrealEngine has a built-in Plugin OpenCV. You can use this plugin from UE as a dependency on mediapipe, but you must make sure that you compile mediapipe on OpenCV version 4.5.5.

If not, it will get a conflict, M4U uses static compilation to package opencv into a DLL to avoid this conflict, but M4U uses UE's OpenCV to turn on the camera (on windows), so you're right, opencv is not necessary for M4U (on Windows)

ffreality commented 1 month ago

Unreal's OpenCV has built-in libraries for only Win64 and Linux. It doesn't have them for Android and iOS. The conflict which I mean is not about Mediapie but Unreal Engine. If you integrate OpenCV for Android, (regardless of your version or purpose) you will get typedef clash from FAndroidPlatform.h.

If mediapipe depends on OpenCV, Android can be problematic. If this won't cause any problem on Android, we can say that you somehow solved that problem or Mediapipe for Android doesn't have OpenCV dependency.

Or this plugin is for desktop platforms but not mobile ones.

endink commented 1 month ago

For Android platform, I compile a libopencv_world.so file (OpenCV 4.5.5), I dont find any conflict with it. But I don't have any code that uses opencv directly in Unreal C++ code (on Android).

As far as I know, if you're want to use opencv in Unreal C++, you'll have to deal with header files:

#include "PreOpenCVHeaders.h"

#include "opencv2/imgproc.hpp"

#include "PostOpenCVHeaders.h"

and you need define some type to fix conflict, for example:

#define int64 cvint64
#define uint64 cvuint64
.... and more

Finally, I'm guessing it's a question about how to integrate opencv on android, which has nothing to do with the mediapipe4U plugin, and I'm going to close this issue