RICOH Blog Post: "Running OpenCV in Your RICOH THETA"

3 posts were merged into an existing topic: HDR plugin to automatically create EXR file. For VFX use

Very interesting your publication, although I don´t see your repository anywhere … I’m working on something similar and using OpenCV … Regards

1 Like

The repository is here:

2 Likes

Hey! I want to join this thread about OpenCV libraries and suggest you one good source and comment it. Can you check out for examle this article and after reply me in comment do you find it useful or not. Thanks!

Can you tell me the versions you are using of Android Studio, Gradle and OpenCV? … Have a nice day

Hi @guillengap,

  • Android Studio 3.3.2
  • Gradle 4.10.1
  • OpenCV 3.4.5
  • specify sourceCompatibility and targetCompatibility as 1.8 due to use of lambda

More info here: https://community.theta360.guide/t/library-and-version-information-for-hardware-request-challenges/4285

1 Like

If you don’t have a camera, you should use this repo:

The big gotchas are:

  • Use OpenCV 3.4.5 (NOT 4.x which is the newest version)
  • Use Java 8 as example uses lambda expression

If you can’t use Java 8 due to policy restrictions at your organization, you can change the lambda expressions to Runnables. I think the Android Studio IDE may even ask you if you want the IDE to automatically change it for you.

Hi all,

I am getting following error,

error: undefined reference to ‘cv::HOGDescriptor::detectMultiScale(cv::_InputArray const&, std::ndk1::vector<cv::Rect, std::ndk1::allocator<cv::Rect > >&, double, cv::Size, cv::Size, double, double, bool) const’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [no-camera-opencv/app/build/intermediates/ndkBuild/debug/obj/local/x86/libopencvsample.so] Error 1

Can you someone help me on this?

Thanks,
Nitin

1 Like

Are you running OpenCV 3.4.5?

Is your emulator x86?

Please provide your environment configuration.

Hi,

Yes, I am using emulator on x86 machine. I have used OpenCV that is part of github repo.

Thanks,
Nitin

Please confirm:

  • changed the include PATH in Android.mk to the source of your specific location of OpenCV
  • enabled Android NDK in Android Studio
  • tried a make clean

Yes to all 3 points mentioned above.

Thanks,
Nitin

image

image

image

I had similar environment, I revisited to ensure that my environment matches with above images and still no luck. Below is the code snippet I added to SDK,

HOGDescriptor hog;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());

vector<Rect> found, found_filtered;
hog.detectMultiScale(m_src, found, 0, Size(8,8), Size(32,32), 1.05, 2);

Thanks,
Nitin

I can’t get it working. If you get a solution, please post the fix.

This did not work for me:

externalNativeBuild {
  cmake {
    arguments "-DANDROID_STL=gnustl_shared"
  }
}

I also can’t get the build working with OpenCV 4.x

I think this is a common problem.

This is a better example of using OpenCV on the THETA

This looks like a nice article for OpenCV 4. I have not gone through it yet.


Update: 4/10/2019
Compiled OpenCV 4.1 last night on Windows as static libraries. Ran into problems using it with the plugin. Compiled OpenCV 4.1 on Linux with the following:

/OpenCV 4.1.0/opencv-opencv-0399435/platforms/android$ ./build_sdk.py --ndk_path ../../../../android-ndk-r19c-linux-x86_64/android-ndk-r19c/ --sdk_path ~/Android/Sdk/  ../../release/

Will report back on progress.

Hello,

Thank you for your effort and time. I tried everything from scratch. Took Theta V plugin, intergrated OpenCV 3.4.5 and wrote OpenCV functions in Java. Everything works like charm.

For Native static lib build, below link has good lead,

Regards,
Nitin

1 Like

@Nitin_Bhaskar, thanks for all your work and sorry that the initial build of OpenCV didn’t work. I should have tested more fully prior to putting it up as the challenge template. Great to know that building from source yields a library that can work with the full set of OpenCV commands.

Update later in day

Tested @Nitin_Bhaskar’s sample code on both emulator and physical device RICOH THETA V. Both work great.

1 Like

Thanks for testing out my APK.

I was able to integrate OpenCV-4.0.1 android SDK with no-camera-opencv example. With this integration, earlier error with hog.detectMultiScale() was not seen. I have modified this example to apply bilateral filter on input image. Please check it out.

Regards,
Nitin

2 Likes

It works for me in a THETA AVD. I don’t see that the PROCESSED_IMAGE.PNG is changed, but the output in the emulator shows the image as having a blur (Bokeh effect?) applied to the background.

2 Likes

The original no-camera-opencv that nitin started with doesn’t save the processed file to storage. It’s not required for the challenge, but obviously the developer will want to add this feature in for the plug-in they submit for the contest (not the hardware challenge). For people that want to save the processed file to storage, the no-camera-template provides an example.

2 Likes