# FindProjection

Generates a projection matrix that describes the perspective from which a camera views the scene.

This action requires that you choose at least four points in the scene. The points must be on the same plane, but cannot be on a straight line. For example, you can choose four points at ground level as long as the points are not in a line.

This action can be used in several ways:

- With a single camera, set the parameters `screenpoints0` and `worldpoints`. Use the resulting projection matrix as the value of the Projection parameter in your session configuration. Media Server uses the projection to calculate real-world 3D coordinates for objects in the scene. Object class recognition and vehicle model recognition can reduce the number of false positive results by checking whether the size of an object or vehicle, in pixels, corresponds to the correct real-world size. Media Server takes into account the position of the object in the scene and its distance from the camera.

  TIP: Micro Focus recommends that you set the Projection parameter using the configuration builder in the Media Server graphical user interface. The GUI allows you to draw the points on the scene image.

- With two cameras monitoring the same scene from different perspectives, you can:

  - set `screenpoints0`, `screenpoints1`, and `worldpoints` to obtain a projection matrix for each camera. When an object is viewed at the same time on both cameras, each projection maps the location of the object from different screen points to the same real-world coordinates.
  - set `screenpoints0` and `screenpoints1`, but not `worldpoints`, to obtain a single projection matrix that maps locations in the second scene (`screenpoints1`) to locations in the first scene (`screenpoints0`).

Type: synchronous

Parameter | Description | Required
--- | --- | ---
`screenpoints0` | A comma-separated list of at least four points made up of x- and y-coordinates. | Yes
`screenpoints1` | A comma-separated list of at least four points made up of x- and y-coordinates. Use this parameter when you have multiple cameras covering the same scene from different perspectives. The points must represent the same physical locations as the points in `screenpoints0`, and must be provided in the same order. | Required unless you set `worldpoints`
`tiltedhorizon` | A Boolean value (default false) that specifies whether the horizon in `projection0` can be tilted (not parallel to the `screenpoints0` x-axis). | No
`worldpoints` | A comma-separated list of at least four points made up of x-, y-, and z-coordinates. The points must represent the same physical locations as the points in `screenpoints0`, and must be provided in the same order. | Required unless you set `screenpoints1`

## Example

The following example generates a single projection matrix using four points - the corners of a 3m x 3m square, at ground level.

    /action=FindProjection&screenpoints0=997,782,1295,770,1256,609,997,615
                          &worldpoints=0,0,0,3,0,0,3,3,0,0,3,0

The `screenpoints0` parameter provides the x- and y-coordinates of pixels in the scene image.

The `worldpoints` parameter provides arbitrary real-world 3D coordinates (each point has an x-, y-, and z-coordinate).

## Response

A sample response appears below.

    <autnresponse>
      <action>FINDPROJECTION</action>
      <response>SUCCESS</response>
      <responsedata>
        <projection0>
          12.0269 0.041904 -12020.4 -0.652671 -18.9201 15430.2 0 0 0 0 1 426.708
        </projection0>
      </responsedata>
    </autnresponse>

_FT_HTML5_bannerTitle.htm