Closed NoahAndrews closed 5 years ago
Realistically, the only way to add OpenCV support is by modifying the FtcRobotControllerActivity. I've pushed a copy with OpenCV support to the opencv
branch of my fork but I have a few issues:
And I'm sure there's a whole other list of issues as well. As of right now, the setup is very similar to that done by LASA Robotics and the electronVolts but I think it could be improved a lot.
Thoughts?
I don't see why it needs to go in the FtcRobotController activity.... why can't it be a separate class used from an OpMode?
@FROGbots-4634 Most of the code can, but if we want to view the camera feed as per Vuforia you need to hook into the activity layout. There is a way to do that dynamically but it still requires hooks into the activity.
I've hooked into it dynamically without modifying the FtcRobotController activity.
You can write to a surfaceview that is added to the R.cameraMonitorViewId during init of an OpMode:
context = hardwareMap.appContext;
final Activity activity = (Activity) hardwareMap.appContext;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
LinearLayout l = (LinearLayout) activity.findViewById(R.id.cameraMonitorViewId);
surfaceView = new MySurfaceView(context, WIDTH, HEIGHT);
l.addView(surfaceView);
}
});
EasyOpenCV is now a thing
I don't have any experience here, so this will have to be contributed by someone else.