{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The given matrix and offset are used to find for each point in the output the corresponding coordinates in the input by an affine transformation. The value of the input at those coordinates is determined by spline interpolation of the requested order. Points outside the boundaries of the input are filled according to the given mode."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionchanged",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionchanged 0.18.0"
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Previously, the exact interpretation of the affine transformation depended on whether the matrix was supplied as a 1-D or a 2-D array. If a 1-D array was supplied to the matrix parameter, the output pixel value at index "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "o"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " was determined from the input image at position "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "matrix * (o + offset)"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For complex-valued "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "input"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", this function transforms the real and imaginary components independently."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 1.6.0"
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Complex-valued support added."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Array API Standard Support"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "affine_transform",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "affine_transform"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SCIPY_ARRAY_API=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "====================  ====================  ====================\nLibrary               CPU                   GPU\n====================  ====================  ====================\nNumPy                 ✅                     n/a                 \nCuPy                  n/a                   ✅                   \nPyTorch               ✅                     ⛔                   \nJAX                   ⚠️ no JIT             ⛔                   \nDask                  ⚠️ computes graph     n/a                 \n====================  ====================  ====================",
          "execution_status": null
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "dev-arrayapi",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " for more information."
                }
              ]
            }
          ]
        }
      ],
      "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": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "affine_transform",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The transformed input."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Apply an affine 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": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "input",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The input array."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "matrix",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The inverse coordinate transformation matrix, mapping output coordinates to input coordinates. If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ndim"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the number of dimensions of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "input"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the given matrix must have one of the following shapes:"
                    }
                  ]
                },
                {
                  "__type": "Blockquote",
                  "__tag": 4059,
                  "children": [
                    {
                      "__type": "BulletList",
                      "__tag": 4053,
                      "ordered": false,
                      "start": 1,
                      "children": [
                        {
                          "__type": "ListItem",
                          "__tag": 4054,
                          "children": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "InlineCode",
                                  "__tag": 4051,
                                  "value": "(ndim, ndim)"
                                },
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": ": the linear transformation matrix for each       output coordinate."
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "ListItem",
                          "__tag": 4054,
                          "children": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "InlineCode",
                                  "__tag": 4051,
                                  "value": "(ndim,)"
                                },
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": ": assume that the 2-D transformation matrix is       diagonal, with the diagonal specified by the given value. A more       efficient algorithm is then used that exploits the separability       of the problem."
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "ListItem",
                          "__tag": 4054,
                          "children": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "InlineCode",
                                  "__tag": 4051,
                                  "value": "(ndim + 1, ndim + 1)"
                                },
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": ": assume that the transformation is       specified using homogeneous coordinates "
                                },
                                {
                                  "__type": "FootnoteReference",
                                  "__tag": 4066,
                                  "label": "1"
                                },
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": ". In this case, any       value passed to "
                                },
                                {
                                  "__type": "InlineCode",
                                  "__tag": 4051,
                                  "value": "offset"
                                },
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": " is ignored."
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "ListItem",
                          "__tag": 4054,
                          "children": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "InlineCode",
                                  "__tag": 4051,
                                  "value": "(ndim, ndim + 1)"
                                },
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": ": as above, but the bottom row of a       homogeneous transformation matrix is always "
                                },
                                {
                                  "__type": "InlineCode",
                                  "__tag": 4051,
                                  "value": "[0, 0, ..., 1]"
                                },
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": ",       and may be omitted."
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "offset",
              "annotation": "float or sequence, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The offset into the array where the transform is applied. If a float, "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "offset"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the same for each axis. If a sequence, "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "offset"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " should contain one value for each axis."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "output_shape",
              "annotation": "tuple of ints, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Shape tuple."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "output",
              "annotation": "array or dtype, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The array in which to place the output, or the dtype of the returned array. By default an array of the same dtype as input will be created."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "order",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The order of the spline interpolation, default is 3. The order has to be in the range 0-5."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "mode",
              "annotation": "{'reflect', 'grid-mirror', 'constant', 'grid-constant', 'nearest', 'mirror', 'grid-wrap', 'wrap'}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "mode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " parameter determines how the input array is extended beyond its boundaries. Default is 'constant'. Behavior for each valid value is as follows (see additional plots and details on "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "boundary modes <ndimage-interpolation-modes>",
                      "domain": null,
                      "role": "ref",
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "):"
                    }
                  ]
                },
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "'reflect' ("
                          },
                          {
                            "__type": "InlineRole",
                            "__tag": 4003,
                            "value": "d c b a | a b c d | d c b a",
                            "domain": null,
                            "role": null,
                            "inventory": null
                          },
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": ")"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The input is extended by reflecting about the edge of the last     pixel. This mode is also sometimes referred to as half-sample     symmetric."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "'grid-mirror'"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "This is a synonym for 'reflect'."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "'constant' ("
                          },
                          {
                            "__type": "InlineRole",
                            "__tag": 4003,
                            "value": "k k k k | a b c d | k k k k",
                            "domain": null,
                            "role": null,
                            "inventory": null
                          },
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": ")"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The input is extended by filling all values beyond the edge with     the same constant value, defined by the "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "cval"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " parameter. No     interpolation is performed beyond the edges of the input."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "'grid-constant' ("
                          },
                          {
                            "__type": "InlineRole",
                            "__tag": 4003,
                            "value": "k k k k | a b c d | k k k k",
                            "domain": null,
                            "role": null,
                            "inventory": null
                          },
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": ")"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The input is extended by filling all values beyond the edge with     the same constant value, defined by the "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "cval"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " parameter. Interpolation     occurs for samples outside the input's extent  as well."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "'nearest' ("
                          },
                          {
                            "__type": "InlineRole",
                            "__tag": 4003,
                            "value": "a a a a | a b c d | d d d d",
                            "domain": null,
                            "role": null,
                            "inventory": null
                          },
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": ")"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The input is extended by replicating the last pixel."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "'mirror' ("
                          },
                          {
                            "__type": "InlineRole",
                            "__tag": 4003,
                            "value": "d c b | a b c d | c b a",
                            "domain": null,
                            "role": null,
                            "inventory": null
                          },
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": ")"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The input is extended by reflecting about the center of the last     pixel. This mode is also sometimes referred to as whole-sample     symmetric."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "'grid-wrap' ("
                          },
                          {
                            "__type": "InlineRole",
                            "__tag": 4003,
                            "value": "a b c d | a b c d | a b c d",
                            "domain": null,
                            "role": null,
                            "inventory": null
                          },
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": ")"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The input is extended by wrapping around to the opposite edge."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "'wrap' ("
                          },
                          {
                            "__type": "InlineRole",
                            "__tag": 4003,
                            "value": "d b c d | a b c d | b c a b",
                            "domain": null,
                            "role": null,
                            "inventory": null
                          },
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": ")"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The input is extended by wrapping around to the opposite edge, but in a     way such that the last point and initial point exactly overlap. In this     case it is not well defined which sample will be chosen at the point of     overlap."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "cval",
              "annotation": "scalar, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Value to fill past edges of input if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "mode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is 'constant'. Default is 0.0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "prefilter",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Determines if the input array is prefiltered with "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "spline_filter",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " before interpolation. The default is True, which will create a temporary "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "float64",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " array of filtered values if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "order > 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If setting this to False, the output will be slightly blurred if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "order > 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", unless the input is prefiltered, i.e. it is the result of calling "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "spline_filter",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " on the original input."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Given an output image pixel index vector "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "o"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the pixel value is determined from the input image at position "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "np.dot(matrix, o) + offset"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This does 'pull' (or 'backward') resampling, transforming the output space to the input to locate data. Affine transformations are often described in the 'push' (or 'forward') direction, transforming input to output. If you have a matrix for the 'push' transformation, use its inverse ("
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "numpy.linalg.inv",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "numpy",
                "version": "*",
                "kind": "api",
                "path": "numpy.linalg:inv"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") in this function."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/ndimage/_interpolation.py",
  "item_line": 479,
  "item_type": "function",
  "aliases": [
    "scipy.ndimage.affine_transform"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Use `affine_transform` to stretch an image::\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.ndimage import affine_transform\nfrom scipy.datasets import face\nfrom matplotlib import pyplot as plt\nimport numpy as np\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "im = face(gray=True)\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "matrix = (0.5, 2)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "im2 = affine_transform(im, matrix)\nplt.imshow(im2)\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nRotate an image by 90 degrees and project it onto an expanded canvas::\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "matrix = ((0, 1), (1, 0))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "im3 = affine_transform(im, matrix, output_shape=(1024, 1024))\nplt.imshow(im3)\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nOffset the rotation so that the image is centred::\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "output_shape = (1200, 1200)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "offset = (np.array(im.shape) - output_shape) / 2\nim4 = affine_transform(im, matrix, offset=offset, output_shape=output_shape)\nplt.imshow(im4)\n",
        "execution_status": "unexpected_exception"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "input",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "matrix",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "offset",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0.0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "output_shape",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "output",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "order",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "3"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "mode",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "constant"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "cval",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0.0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "prefilter",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "True"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "affine_transform"
  },
  "references": [
    ".. [1] https://en.wikipedia.org/wiki/Homogeneous_coordinates"
  ],
  "qa": "scipy.ndimage._interpolation:affine_transform",
  "arbitrary": [],
  "local_refs": [
    "affine_transform",
    "cval",
    "input",
    "matrix",
    "mode",
    "offset",
    "order",
    "output",
    "output_shape",
    "prefilter"
  ]
}