GithubHelp home page GithubHelp logo

affine-image-transforms-python's People

Contributors

amcquistan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

affine-image-transforms-python's Issues

Scaling and Rotating R image

Hi when i tried running the code on jupyter, I am unable to obtain the
"rotated 90 degrees clockwise and scaled up 2X. However, the result is now obviously diminished as you can easily see discontinuity in the pixel intensities."

For me it shows up as a blank image.
I am using Python 3

Do you have any idea what might be the issue?
Hope to hear from you soon!

Python code not rotating and scaling image in affine transformations (under working with an image heading)

Problem:

I am trying to rotate and scale an image using the following Python code:

    """
        img = matplotlib.pyplot.imread('letterR.jpg')
        T = np.array([[0, 2, 0],
             [-2, 0, 0]
             [0, 0, 1]])
    """

img_transformed = np.empty((2000, 2000, 4), dtype=np.uint8)
for i, row in enumerate(img):
    for j, col in enumerate(row):
        pixel_data = img[i, j, :]
        input_coords = np.array([i, j, 1])
        i_out, j_out, _ = T @ input_coords
        img_transformed[i_out, j_out, :] = pixel_data

plt.figure(figsize=(5, 5))
plt.imshow(img_transformed)

letterR.jpg

However, when I execute this code, I am not getting the same output as shown in the following image:

expected output

Instead, I am getting the following output:

actual output

Error messages:

I am not receiving any error messages.

Additional information:

I have tried executing the code on different machines and I am getting the same results.

I am not sure why the code is not producing the expected output. I would appreciate any help that you can provide.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.