amcquistan / affine-image-transforms-python Goto Github PK
View Code? Open in Web Editor NEWThis is a tutorial in the form of a Jupyter notebook
This is a tutorial in the form of a Jupyter notebook
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!
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)
However, when I execute this code, I am not getting the same output as shown in the following image:
Instead, I am getting the following output:
I am not receiving any error messages.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.