Package org.horizon36596.simloop.vision
Class CameraSighting
java.lang.Object
org.horizon36596.simloop.vision.CameraSighting
One game piece as a
SimCamera sees it this tick: where its centre lands in the image, how big
it looks, how far away it is, and what it is. This is the ground truth a synthetic frame would be
rendered from, and it is shaped to line up field-for-field with a typical per-frame detection record
(centreXPx, centreYPx, radiusPx, clipped, type) so that a test can feed sightings into a
tracker as if a detector had produced them, or compare a detector's output against them.
Pixel frame: (0, 0) top-left, +x right, +y down. Range is measured from the
lens to the piece's centre, in inches.
Immutable.
-
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the piece centre's image x, pixels from the left edge; may lie outside the image if clipped.doubleReturns the piece centre's image y, pixels from the top edge; may lie outside the image if clipped.getKind()Returns the piece's kind label, e.g."ball"— the class a detector would have to infer.intReturns the id of the piece seen — ground truth a real detector never has.doubleThe piece's apparent radius, pixels, computed as horizontal focal length times real radius over range.doubleReturns straight-line distance from the lens to the piece's centre, inches.doubleHow much of the piece the camera can see past the occluders, 0 to 1: the share of sample rays spread over the piece's disc (as the camera sees it) that reach the piece without passing through a box or a nearer piece.booleanReturns true when part of the piece's disc falls outside the image edges.toString()
-
Method Details
-
getPieceId
public int getPieceId()Returns the id of the piece seen — ground truth a real detector never has.- Returns:
- the id of the piece seen — ground truth a real detector never has
-
getKind
Returns the piece's kind label, e.g."ball"— the class a detector would have to infer.- Returns:
- the piece's kind label, e.g.
"ball"— the class a detector would have to infer
-
getCentreXPx
public double getCentreXPx()Returns the piece centre's image x, pixels from the left edge; may lie outside the image if clipped.- Returns:
- the piece centre's image x, pixels from the left edge; may lie outside the image if clipped
-
getCentreYPx
public double getCentreYPx()Returns the piece centre's image y, pixels from the top edge; may lie outside the image if clipped.- Returns:
- the piece centre's image y, pixels from the top edge; may lie outside the image if clipped
-
getRadiusPx
public double getRadiusPx()The piece's apparent radius, pixels, computed as horizontal focal length times real radius over range.This is an approximation, and it is the one a simple synthetic renderer draws. A real sphere seen through a pinhole projects exactly to a circle only on the optical axis, and even there its image radius is
f * radius / sqrt(range^2 - radius^2), about 1% larger than this at a range of 7 radii and less beyond. Off the axis the image becomes an ellipse stretched away from the image centre, by roughly1 / cosof the angle off the axis (about 30% in the corner of a 70-degree-wide 640x400 image). A test that compares a detector's blob size with this number should allow for that.- Returns:
- the apparent radius, pixels
-
getRangeInches
public double getRangeInches()Returns straight-line distance from the lens to the piece's centre, inches.- Returns:
- straight-line distance from the lens to the piece's centre, inches
-
isClipped
public boolean isClipped()Returns true when part of the piece's disc falls outside the image edges.- Returns:
- true when part of the piece's disc falls outside the image edges
-
getVisibleFraction
public double getVisibleFraction()How much of the piece the camera can see past the occluders, 0 to 1: the share of sample rays spread over the piece's disc (as the camera sees it) that reach the piece without passing through a box or a nearer piece. Always 1 fromSimCamera.observe(java.util.List, double, double, double), which has no occluders; from the overload that takesCameraOccludersit is the fraction ofSimCamera.OCCLUSION_SAMPLESrays. The image edge does not count here: that isisClipped().- Returns:
- the visible fraction, 0 to 1
-
toString
-