jeremy-ellis-tech / Xamarin.Android.OpenCV

C# bindings for the OpenCV Android SDK
MIT License
92 stars 44 forks source link

Convert CameraControlActivity to abstract class #12

Closed RodrigodeMoura closed 7 years ago

RodrigodeMoura commented 7 years ago

Hi, Hello I'm testing the source code and I can not use the other tests. To compile the source code I had to change the classes that implement the CameraBridgeViewBase.ICvCameraViewListener2 to abstract. But I can not now call the views

how should I proceed?

tellamon commented 7 years ago

I also have the same problem. Compile errors.

...\md5156fbfecd0fba21bbd958f612a8a7c6e\MixedProcessingActivity.java(4,8): javac.exe error : error: MixedProcessingActivity is not abstract and does not override abstract method onCameraFrame(CvCameraViewFrame) in CvCameraViewListener2 ...\md5156fbfecd0fba21bbd958f612a8a7c6e\MixedProcessingActivity.java(4,8): javac.exe error : public class MixedProcessingActivity ...\md5156fbfecd0fba21bbd958f612a8a7c6e\MixedProcessingActivity.java(4,8): javac.exe error : ...\md530346968bbcdb9570d61298668f06fa9\ColorBlobDetectionActivity.java(4,8): javac.exe error : error: ColorBlobDetectionActivity is not abstract and does not override abstract method onCameraFrame(CvCameraViewFrame) in CvCameraViewListener2 ...\md530346968bbcdb9570d61298668f06fa9\ColorBlobDetectionActivity.java(4,8): javac.exe error : public class ColorBlobDetectionActivity ...\md530346968bbcdb9570d61298668f06fa9\ColorBlobDetectionActivity.java(4,8): javac.exe error : ...\md53b8dd4203a4c6bd2abc6d04f15e41ecf\ImageManipulationsActivity.java(4,8): javac.exe error : error: ImageManipulationsActivity is not abstract and does not override abstract method onCameraFrame(CvCameraViewFrame) in CvCameraViewListener2 ...\md53b8dd4203a4c6bd2abc6d04f15e41ecf\ImageManipulationsActivity.java(4,8): javac.exe error : public class ImageManipulationsActivity ...\md53b8dd4203a4c6bd2abc6d04f15e41ecf\ImageManipulationsActivity.java(4,8): javac.exe error : ...\md5908d37ccd8b289e007f6fc84fb1563a0\FaceDetectActivity.java(4,8): javac.exe error : error: FaceDetectActivity is not abstract and does not override abstract method onCameraFrame(CvCameraViewFrame) in CvCameraViewListener2 ...\md5908d37ccd8b289e007f6fc84fb1563a0\FaceDetectActivity.java(4,8): javac.exe error : public class FaceDetectActivity ...\md5908d37ccd8b289e007f6fc84fb1563a0\FaceDetectActivity.java(4,8): javac.exe error : ...\md5a47a348361c97a8caf67714b23e76fb5\CameraControlActivity.java(4,8): javac.exe error : error: CameraControlActivity is not abstract and does not override abstract method onCameraFrame(CvCameraViewFrame) in CvCameraViewListener2 ...\md5a47a348361c97a8caf67714b23e76fb5\CameraControlActivity.java(4,8): javac.exe error : public class CameraControlActivity ...\md5a47a348361c97a8caf67714b23e76fb5\CameraControlActivity.java(4,8): javac.exe error : ...\md5fd462e9eb38aaff48af4c54922600b85\CameraCalibrationActivity.java(4,8): error : error: CameraCalibrationActivity is not abstract and does not override abstract method onCameraFrame(CvCameraViewFrame) in CvCameraViewListener2 ...\md5fd462e9eb38aaff48af4c54922600b85\CameraCalibrationActivity.java(4,8): error : public class CameraCalibrationActivity ...\md5fd462e9eb38aaff48af4c54922600b85\CameraCalibrationActivity.java(4,8): error :

jeremy-ellis-tech commented 7 years ago

What JDK version are you using?

tellamon commented 7 years ago

For me, JDK 1.8.0_101 with Visual Studio 2015.

jeremy-ellis-tech commented 7 years ago

It could be an issue with JDK 1.8.x. I'd suggest trying JDK 1.7.x

RodrigodeMoura commented 7 years ago

I changed to JDK 1.7.0_55 and the problem still happend.

my environment config

JDK1.7.0_55 android-ndk-r11c

fmalbacete commented 7 years ago

I'm having the same problem. Tried JDK1.7 and JDK1.8

Andoid NDK: r14

Thanks

jeremy-ellis-tech commented 7 years ago

Hi @fmalbacete and @RodrigodeMoura, thanks for getting back. Unforunately I don't have a working windows box at the moment so trouble shooting this is very difficult. In the mean time I suggested https://github.com/minhnguyenlinknode could get in touch as he currently has a seperate issue but it able to get this library running.

minhnguyenlinknode commented 7 years ago

Hi @fmalbacete , @RodrigodeMoura ,

I can manage to get this sample running in Xamarin Android. I don't have the same issue with you. For more information, I am using Windows 10, Visual Studio 2015 Update3. I also installed OpenCVManager in PlayStore into Android device for sure.

fmalbacete commented 7 years ago

Hi @minhnguyenlinknode, @TrekDev I was using the VS 2013, I tried VS 2015 with no success.

The sample class CameraControlActivity.cs on OpenCV.SDKDemo Project give me the error :
CameraControlActivity is not abstract and does not override abstract method onCameraFrame(CvCameraViewFrame) in CvCameraViewListener2 public class CameraControlActivity OpenCV.SDKDemo

Do you got this demo running without any changes ?

Thanks!!!

minhnguyenlinknode commented 7 years ago

Yes, it can be run without any changes in code.

jeremy-ellis-tech commented 7 years ago

@minhnguyenlinknode & @fmalbacete what versions of Xamarin.Android are you using? Also what Android SDKs do you have installed?

thuamley commented 7 years ago

Hi, I am new to Xamarin.Android and OpenCV, but exact same issue here: MacOS Sierra, 10.12.3 Xamarin.Android 7.2 (tried with Xamarin.Android 6 too) Android NDK: r14b Android SDK: 7.1.1 API 25 jdk: 1.8

I tried with various combination of SDK / JDK and Xamarin.Android and same issue. I also noticed I have the following errors (whatever jdk version is used): ''' JARTOXML: warning J2XA005: missing class error was raised while reflecting calculateCameraFrameSize [protected org.opencv.core.Size org.opencv.android.CameraBridgeViewBase.calculateCameraFrameSize(java.util.List,org.opencv.android.CameraBridgeViewBase$ListItemAccessor,int,int)] : org/opencv/R JARTOXML: warning J2XA005: missing class error was raised while reflecting deliverAndDrawFrame [protected void org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(org.opencv.android.CameraBridgeViewBase$CvCameraViewFrame)] : org/opencv/R JARTOXML: warning J2XA005: missing class error was raised while reflecting setCvCameraViewListener [public void org.opencv.android.CameraBridgeViewBase.setCvCameraViewListener(org.opencv.android.CameraBridgeViewBase$CvCameraViewListener)] : org/opencv/R JARTOXML: warning J2XA005: missing class error was raised while reflecting setCvCameraViewListener [public void org.opencv.android.CameraBridgeViewBase.setCvCameraViewListener(org.opencv.android.CameraBridgeViewBase$CvCameraViewListener2)] : org/opencv/R JARTOXML: warning J2XA005: missing class error was raised while reflecting onCameraFrame [public abstract org.opencv.core.Mat org.opencv.android.CameraBridgeViewBase$CvCameraViewListener2.onCameraFrame(org.opencv.android.CameraBridgeViewBase$CvCameraViewFrame)] : org/opencv/R JARTOXML: warning J2XA001: missing class error was raised while reflecting org.opencv.android.CameraBridgeViewBase$CvCameraViewListenerAdapter [public org.opencv.android.CameraBridgeViewBase$CvCameraViewListenerAdapter(org.opencv.android.CameraBridgeViewBase,org.opencv.android.CameraBridgeViewBase$CvCameraViewListener)] : org/opencv/R JARTOXML: warning J2XA005: missing class error was raised while reflecting onCameraFrame [public org.opencv.core.Mat org.opencv.android.CameraBridgeViewBase$CvCameraViewListenerAdapter.onCameraFrame(org.opencv.android.CameraBridgeViewBase$CvCameraViewFrame)] : org/opencv/R JARTOXML: warning J2XA005: missing class error was raised while reflecting setCameraTextureListener [public void org.opencv.android.CameraGLSurfaceView.setCameraTextureListener(org.opencv.android.CameraGLSurfaceView$CameraTextureListener)] : org/opencv/R ''' Thanks!

jeremy-ellis-tech commented 7 years ago

@thuamley I'd suggest asking @minhnguyenlinknode what versions of Xamarin/Xamarin.Android and SDKs he has installed since it is working on his environment.

RodrigodeMoura commented 7 years ago

@minhnguyenlinknode you can post your version of MixedProcessingActivity.java so I can compare it with my file version

RodrigodeMoura commented 7 years ago

@thuamley, @fmalbacete and @TrekDev

After a lot tests I found a way to build the project without change the class.

I change the node

<add-node path="/api/package[@name='org.opencv.android']/interface[@name='CameraBridgeViewBase.CvCameraViewListener2']">

on Metadata.xml file. I changed the attribute abstract="false" to true. As follow bellow

<add-node path="/api/package[@name='org.opencv.android' /interface[@name='CameraBridgeViewBase.CvCameraViewListener2']" method name="onCameraFrame" return="org.opencv.core.Mat" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public"> parameter name="p0" type="org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame"/> </method> </add-node>

I hope this help.

jeremy-ellis-tech commented 7 years ago

@RodrigodeMoura Thanks very much for testing this before I could get my Windows box up and running. I've pushed a fix to master. Could you double check it works?

PS. I do remember putting the abstract attribute in on purpose a while ago. I believe it was a weird issue with the binding generator in older versions of Xamarin. Good to know it is sorted.

thuamley commented 7 years ago

Pulled master. I confirm that I can build and run the project. Thanks a lot @RodrigodeMoura and @TrekDev

fmalbacete commented 7 years ago

It's OK, Thanks a Lot!!!