Position line-scan camera

Position line-scan camera

Calculates the position of a line-scan camera with respect to the world coordinate system. The tool needs a picture of Kuvio line-scan calibration plate, which is taken with a calibrated camera. It is important that the intrinsic calibration parameters in the image are correct. See line-scan camera calibration.

The normal procedure for positioning a line-scan camera is as follows:

  • Place the line-scan calibration plate on the surface being inspected and align it as needed.
  • Position the camera approximately.
  • Add an image source, open its image output and select the camera to be positioned.
  • Start capturing pictures continuously.
  • By looking at the image, rotate and tilt the camera so that all calibration bars have the same width in the image. It may also be useful to use a gray level profile or the caliper to guide this process.
  • Stop capturing images.
  • Connect the image source to a line-scan positioning tool.
  • Trigger the image source once.
  • Copy the calculated extrinsic parameters from the outputs of the line-scan positioning tool to the corresponding parameters in the image source.
  • This will place the origin of the world coordinate system at the center of the calibration plate. If this choice is not suitable for the application, the world origin can be adusted:

  • Open the image output of the line-scan camera positioning tool on an image display.
  • Drag the worldFrame input parameter on top of the image display and move it horizontally as needed. It is usually not a good idea to rotate or move the frame vertically.
  • Copy the worldFrame output parameter of the line-scan camera positioning tool to the frame input of the image source.
  • Inputs

    image
    A picture of the standard VisionAppster line-scan calibration plate taken with a calibrated camera. The image may be obtained directly from a calibrated camera or from a .kuva file. Other file formats don't contain calibration information.
    markerHeight
    Height of the markers on the calibration plate in world units.
    markerSpacing
    The spacing (distance between centers) of calibration bars on the line-scan calibration plate in world units.
    markerCount
    Number of markers on the calibration plate on each side of the center. So there are 2 * markerCount markers in total.
    threshold
    Threshold used in detecting the markers. The bigger the threshold, a larger contrast is required for reliable detection. The smaller the threshold, the larger is the probability for false detection. A number between 50 and 100 works usually fine.
    sampleWidth
    The number of scan lines to sum up and average symmetrically around the vertical center of the image. The other scan lines are not used in positioning.
    worldFrame
    The position of the world coordinate system in the coordinate system of the calibration plate. Note that the input image does not yet contain a valid world coordinate system. This frame is only valid in the context of the new world coordinate system, which is present in the image output.

    Outputs

    image
    The input image with the calibration plate's coordinate system attached.
    frame
    The position of the calibration plate in the camera coordinate system. Drawing this frame on top of an image using its world coordinate system is not meaningful. Similarly, this frame does not work as an input to tools that expect a frame in the world coordinate system. To permanently store camera position, this parameter can be copied to the frame input parameter of Image Source. This will move the world origin to the center of the calibration plate.
    worldFrame
    The position of the world coordinate frame in the camera coordinate system. Drawing this frame on top of an image using its world coordinate system is not meaningful. Similarly, this frame does not work as an input to tools that expect a frame in the world coordinate system. To permanently store camera position, this parameter can be copied to the frame input parameter of Image Source. This will move the world origin to the place defined by the worldFrame input parameter.
    rotationAngles
    A 1-by-2 matrix containing rotation angles of the camera line about Z (roll) and Y (yaw) axes system of the calibration plate, in degrees.
    detectedMarkerCount
    A 1-by-2 matrix containing the number of detected markers on left and right sides of the calibration plate. Ideally both values should be equal to markerCount if the image is such that all markers are visible.
    errorMeasure
    A measure of how successful the positioning procedure was. The smaller the value, the better. A value between 0 and 1 is good, between 1 and 2 is fair and larger than 2 is poor. If the positioning fails completely, the value is infinite. In that case it is likely that the calibration plate was not detected at all.