{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Similarity transformation."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "params",
              "annotation": "ndarray of shape (K, K), with K=D+1 (D being the dimensionality)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Homogeneous transformation matrix."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "matrix",
              "annotation": "array_like of shape (K, K), with K=D+1 (D being the dimensionality), optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Homogeneous transformation matrix."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "scale",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Scale factor. Implemented only for 2D and 3D."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rotation",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Rotation angle, clockwise, as radians. Implemented only for 2D and 3D. For 3D, this is given in ZYX Euler angles."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "translation",
              "annotation": "array_like of shape (D,), optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "x, y[, z] translation parameters. Implemented only for 2D and 3D."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "dimensionality",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The dimensionality of the transform, corresponding to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "D"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " above. Ignored if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "matrix"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not None, and set to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "matrix.shape[0] - 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Otherwise, must be one of 2 or 3."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Has the following form in 2D      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "X = a0 * x - b0 * y + a1 =\n  = s * x * cos(rotation) - s * y * sin(rotation) + a1\n\nY = b0 * x + a0 * y + b1 =\n  = s * x * sin(rotation) + s * y * cos(rotation) + b1",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "s"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a scale factor and the homogeneous transformation matrix is      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "[[a0 -b0  a1]\n [b0  a0  b1]\n [0   0   1 ]]",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The similarity transformation extends the Euclidean transformation with a single scaling factor in addition to the rotation and translation parameters."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The implicit parameters are applied in the following order:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": true,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Scale;"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Rotation;"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Translation."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Returns",
    "Yields",
    "Receives",
    "Raises",
    "Warns",
    "Other Parameters",
    "Attributes",
    "Methods",
    "Notes",
    "Warnings"
  ],
  "item_file": "/dev/scikit-image/src/skimage/transform/_geometric.py",
  "item_line": 2073,
  "item_type": "ABCMeta",
  "aliases": [
    "skimage.transform.SimilarityTransform"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nimport skimage as ski\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDefine a transform with an homogeneous transformation matrix:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "tform = ski.transform.SimilarityTransform(np.diag([2., 3., 1.]))\ntform.params\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDefine a transform with parameters:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "tform = ski.transform.SimilarityTransform(\n            rotation=0.2, translation=[1, 2])\nnp.round(tform.params, 2)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nYou can estimate a transformation to map between source and destination\npoints:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "src = np.array([[150, 150],\n                [250, 100],\n                [150, 200]])\ndst = np.array([[200, 200],\n                [300, 150],\n                [150, 400]])\ntform = ski.transform.SimilarityTransform.from_estimate(src, dst)\nnp.allclose(tform.params, [[ 1.79, 0.21, -142.86],\n                           [-0.21, 1.79,   21.43],\n                           [ 0.  , 0.  ,    1.  ]], atol=0.01)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nApply the transformation to some image data.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "img = ski.data.astronaut()\nwarped = ski.transform.warp(img, inverse_map=tform.inverse)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe estimation can fail - for example, if all the input or output points\nare the same.  If this happens, you will get a transform that is not\n\"truthy\" - meaning that ``bool(tform)`` is ``False``:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "if tform:\n    print(\"Estimation succeeded.\")\nbad_src = np.ones((3, 2))\nbad_tform = ski.transform.SimilarityTransform.from_estimate(\n     bad_src, dst)\nif not bad_tform:\n    print(\"Estimation failed.\")\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nTrying to use this failed estimation transform result will give a suitable\nerror:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "bad_tform.params  # doctest: +IGNORE_EXCEPTION_DETAIL\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "matrix",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "scale",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rotation",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "translation",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "dimensionality",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "SimilarityTransform"
  },
  "references": null,
  "qa": "skimage.transform._geometric:SimilarityTransform",
  "arbitrary": [],
  "local_refs": [
    "dimensionality",
    "matrix",
    "params",
    "rotation",
    "scale",
    "translation"
  ]
}