AR Foundation with OpenCV for Unity
Hi,
I am trying to detect colors from the environment using AR Foundation in unity. I bought OpenCV for unity yesterday and used the MultiObjectTrackingBasedOnColorExample Scene. The scene is working fine and detecting colors but it is not supporting the AR. I want to place objects in the real world and also detect colors from the real environment. I also used ARFoundationWithOpenCVForUnityExample but it is giving this error ( Assets\ARFoundationWithOpenCVForUnityExample\ARFoundationCameraArUcoExample\ARFoundationCameraArUcoExample.cs(426,23): error CS1501: No overload for method 'detectMarkers' takes 8 arguments )
I am a beginner, So would you please guide me in this regard? Thank You.
The latest version of OpenCV has changed the Aruco.detectMarkers method, which seems to be causing this error. I think that the problem can be solved by modifying lines 390 to 391 of ARFoundationCameraArUcoExample.cs to the following code.
// undistort image.
Calib3d.undistort(rgbMat, rgbMat, camMatrix, distCoeffs);
// detect markers.
Aruco.detectMarkers(rgbMat, dictionary, corners, ids, detectorParams, rejectedCorners);
Its showing the same error. Assets\ARFoundationWithOpenCVForUnityExample\ARFoundationCameraArUcoExample\ARFoundationCameraArUcoExample.cs(428,23): error CS1501: No overload for method 'detectMarkers' takes 8 arguments
and will I be able to use the color detection functions of your asset with AR features at the same time?
This is the same problem, so replace lines 428 through 429 with the same modified code.
I haven't tried it, but I think it is possible to integrate AR Foundation with color detection functions, although I think it would require a bit more complex calculations to convert the detection results from on 2D space to coordinates in 3D space.
Could you please guide me more about the integration of AR Foundation with color detection? Also, When I detect a color, the shape that appears on it is very noisy and changes every millisecond. Could you please guide me on how I will make it steady, or instead, a square appears on the detected colour and its name, for example, red?
Kindly help me in using the AR foundation with color detection.