Ar

scalacv.vision.Ar
object Ar

Marker-based augmented reality: recover a marker's 3D pose from its detected corners, then project model geometry back onto the image to draw on top of it.

The flow is the classic one. estimatePose runs solvePnP (with the square-planar IPPE_SQUARE solver, which is both faster and more stable for a flat tag than the general iterative one) against the four corners an Aruco detection gives you, yielding a Pose3D. project then maps any Point3 model — a set of axes, a cube — through that pose and the camera Intrinsics to pixel coordinates you can draw with the ordinary Draw verbs. The high-level image.drawMarkerAxes and image.drawMarkerCube wire all three steps together.

Attributes

Source
Ar.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Ar.type

Members list

Value members

Concrete methods

def estimatePose(marker: ArucoMarker, markerLength: Double, intrinsics: Intrinsics): Option[Pose3D]

Recovers marker's pose relative to the camera. markerLength is the tag's real side length (in whatever unit you want the pose expressed in — metres is conventional). None if solvePnP fails to converge, which for four coplanar corners is rare but not impossible.

Recovers marker's pose relative to the camera. markerLength is the tag's real side length (in whatever unit you want the pose expressed in — metres is conventional). None if solvePnP fails to converge, which for four coplanar corners is rare but not impossible.

Every Mat this needs is owned for the duration of the call and freed before it returns, on the throwing path as well as the normal one — the returned Pose3D is plain Seq[Double], so nothing native escapes and the caller has nothing to release.

Attributes

Throws
IllegalArgumentException

if the marker does not have four corners or markerLength is not positive.

Source
Ar.scala
def project(points: Seq[Point3], pose: Pose3D, intrinsics: Intrinsics): Seq[Point]

Projects model points (in the marker's frame) to pixel coordinates through pose and the camera.

Projects model points (in the marker's frame) to pixel coordinates through pose and the camera.

As with estimatePose, every Mat is owned for the duration of the call and freed before it returns, including when a native call or an allocation throws; the returned Points are copies.

Attributes

Source
Ar.scala
def project(points: Seq[Point3], transform: RigidTransform, intrinsics: Intrinsics): Seq[Point]

Projects source-frame points through an object-to-camera transform. Translation and points must use the same units; a monocular motion direction needs scale recovery before metric projection. Native conversion and ownership are scoped exactly as in the Pose3D overload.

Projects source-frame points through an object-to-camera transform. Translation and points must use the same units; a monocular motion direction needs scale recovery before metric projection. Native conversion and ownership are scoped exactly as in the Pose3D overload.

Attributes

Source
Ar.scala