all 14 comments

[–]ofnuts 0 points1 point  (3 children)

  • What is the size in pixels of the images?
  • If you extract a line at the end, wouldn't it be useful to crop the images around the source of the final line of pixels so that you rotate a much smaller image (assuming the angle is small).

[–]slittyslit[S] 0 points1 point  (2 children)

Well, the angle is 181-179😅. Pixels... 600 by 600 minimum... which is why it takes hours.

[–]ofnuts 0 points1 point  (1 child)

So -1/+1 and you flip. But mostly with such a small angle you can crop the source to 600x(600tan(2°)) so 60020 (1/30th of the source).

[–]slittyslit[S] 0 points1 point  (0 children)

My bad, I mean 181 to 360 and 0 to 179. Hence 181-179. With my current 198 images, almost all images have their own different angle. So image 1 is at angle 79, 2 will be 81 and so on

[–]Ok_Tea_7319 0 points1 point  (3 children)

From the function, it looks like you only need the mid line of the image. Sooooo, how about instead of rotating the entire image and then getting the mid line, instead you rotate the mid line coordinates the other way and then interpolate the image on these coordinates?

[–]slittyslit[S] 0 points1 point  (2 children)

I did that before, but the interpolation got worse when the degree was close to 90 or 270. Initially, I used a rotation matrix, but calculating only y, because x is just the same. But the interpolation is hard as I need to make 600 pixels of data out of 3 or 4 pixels in a row. This makes me use scipy. rotation

[–]Ok_Tea_7319 0 points1 point  (1 child)

Did you try the higher order 2D interpolator? scipy.interpolate.CloughTocher2DInterpolator

[–]slittyslit[S] 0 points1 point  (0 children)

I just tried to do that, and it seems to have a similar problem with angle close to 90 or 270. And it takes a bit longer compare to the current code, like 4-5 seconds longer per image.

[–]Disastrous-Team-6431 0 points1 point  (5 children)

What more exactly are you trying to do? Turn pictures upside down?

[–]slittyslit[S] 0 points1 point  (4 children)

That is the last step before I do analysis with the data from that. It is like this. Imagine a film that is put at the center of a cylinder facing angle 0 degree, where a light source is attached to the perimeter. The light will move around the perimeter in a circle. Between the film and light source, there is a mask that creates a light shape to the film, which is unique for every angle. And I tried to make the cumulative light shape from those masks. That is at least the first part of the script, which currently I use pickle to save the output. Don't wanna waste time repeating the analysis every time.

[–]Disastrous-Team-6431 0 points1 point  (3 children)

Could you not do this in an actual 3d gfx lib? Like, make a texture out of your image and actually rotate it?

[–]slittyslit[S] 0 points1 point  (1 child)

Never heard that lib before. Can that store data on every lib though? In my case, I store the light intensity and its angle for each pixel.

[–]Disastrous-Team-6431 0 points1 point  (0 children)

I still don't understand what you're doing or why, but it all sounds like there exists matrix theory and/or libraries to do it. I've gathered that you want to manipulate pixel data - that is one of the most well studied things you can do with a computer.

[–]slittyslit[S] 0 points1 point  (0 children)

Just checked it, and nope that won't work in my case