Hi guys, firstly let me thank you for this fantastic library that I´m using on my final mechanical degree project. Basically I´m using a Lego EV3 Mindstorm robot to simulate a warehouse environment, he follows a black line, calculating the center of the line all the time and detecting Aruco markers on the floor. I´m working on a small Android app using Android Studio, I use my mobile phone camera as the robot "eyes", using OpenCV library to process every frame the camera takes, so if the camera doesn´t detect any Aruco marker the robot follows the black line, but if he detects a marker on the floor he turns right/left or goes ahead until next marker. I´ve implemented all of this java code inside onCameraFrame() method, and I´m trying to know if there is a way to detect lines and markers at the same time, using parallel threads, Asynctask... I´m not programmer so I need some tips or guide through where the onCameraFrame method works detecting the center of the line and also detecting Aruco Markers and the same time. I´m using SystemClock.sleep() once the Aruco marker is detected while the robot moves /approach to the marker and then turns left or right, but I also want to draw the Aruco marker on the frame, but it doesn´t happen because drawDetectedMarkers() method is called before return mRgba the Aruco will never be draw on the frame until onCameraFrame finish, the code works like this:
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
final Mat mRgba = inputFrame.rgba();
detectAndDrawMarkers();
if (corners.size() > 0) { //if the corners array is bigger than 0 then an Aruco marker has been detected
drawDetectedMarker(mRgba);
turnID(arucoIDs); //inside this method there is a SystemClock.sleep(), freezing the screen and waiting until the robot finish the movement
} else {
followLine(mRgba);
}
return mRgba;
}
So I need help with:
1) Some way to detect the black line and detect Aruco marker at the same time. 2) Draw the Aruco marker before the frame freeze.
Here is a screenshoot of the frame, there are 2 roi, the green detects the black line center, and the blue one detects the aruco.
Thanks so much and best regards.