Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:11:11+00:00 2026-05-29T23:11:11+00:00

i have an image (saved as numpy-array) and i want to transform it with

  • 0

i have an image (saved as numpy-array) and i want to transform it with a transformation-matrix.
lets say the transformationatrix is:

[[  0.99729046  -0.07356456  22.57990962]
 [  0.07356456   0.99729046 -12.99879896]
 [  0.           0.           1.        ]]

i wanted to do this via `scipy.ndimage.interpolation.

image = affine_transform(image, matrix, mode="reflect")

if i just rotate it:

[[  0.99729046  -0.07356456 0.]
 [  0.07356456   0.99729046 0.]
 [  0.           0.         1.]]

it works fine, but when i want to rotate it AND translate it, of just translate it, the result lookes quite weird. and i dont know why :S

original image:
http://img408.imageshack.us/img408/9373/eiffel.jpg

transformed image:
http://img861.imageshack.us/img861/8971/blatm.jpg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:11:13+00:00Added an answer on May 29, 2026 at 11:11 pm

    I think ndimage doesn’t actually handle color images. It treats the last (3,) dimension of your array as a third spatial dimension.

    The matrix you give in is actually only the rotation matrix, and not the affine matrix. The documentation seems to not be clear on this. You’re supposed to pass in the shift vector via the offset parameter. The shift vector also includes a “color shift” as the third element.

    The same applies to the shift method that in Travis Vaught’s comment above. The correct syntax is ndimage.shift(img, (10.0, 10.0, 0.0), mode="wrap") — of course, unless you want to do some funny color shifting.

    In principle you can tell ndimage not to shift etc. the image along the color axis, as above, but operating on each color element separately should be a bit faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How is the image data saved with an uint8 array? Say that I have
In numpy/scipy I have an image stored in an array. I can display it,
I have saved an image on the database and want to display it to
I have image data and i want to get a sub image of that
I have: image 1:Many imageToTag Many:1 tag I want to issue a query that
I have image and txt file of same size say 200 KB. Now i
So I have Image like this (source: de-viz.ru ) I want to get something
So I have Image like this (source: de-viz.ru ) I want to get something
I am trying to convert a PIL image into an array using NumPy. I
Actually I have retrieved image saved on facebook but i am not getting how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.