I know this question has already been answered a lot of time but i can't figure if what 'im doing is good or bad.
I got a file with defect position and image ID. image size are 96*96. Origin is (48,48)
imgID X Y
1 5 6
1 87 76
2 45 23
From this i calculate R and T
x,y = df.X-48,df.Y-48
r = np.sqrt(x**2+y**2)
t = np.arctan2(y,x)
df["r"]=r
df["t"]=t
Then i create empty matrix of size 96*96 for each image, and for image 1 (for exemple) i assign value 0 at each coordinate (R,T)
When i plot my matrix my result are strange.. Am i missing something important?
Not sure if you are insistent on a Python solution, or you just want to get the job done. If the former, please just ignore me and my answer will sink to the bottom. If the latter, you can do that with ImageMagick which is installed on most Linux distros and is available for macOS and Windows.
So, starting with this colorwheel.png
:
Just use the following command in Terminal, or Command Prompt if on Windows:
magick colorwheel.png -distort depolar 0 result.png
It's a little "off" because my input image is not exactly square or centred, but you get the idea :-)
Replace -distort depolar
with -distort polar
to do the inverse transformation.
For versions prior to v7, replace magick
with convert
in the commands above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.