Question

I hope this hasn't already been answered but I haven't found this anywhere. My problem is quite simple : I'm trying to compute an oblic profile of an image using scipy. One great way to do it is to :

  1. locate the segment along which I want my profile by giving the beginning and the end of my segment,
  2. extract the minimal image containing the segment,
  3. compute the angle from which my image should be rotated to get the desired profile along a nice raw,
  4. extract said raw.

That's the theory.

I'm stuck right now on (4), because my profile should fall in raw number array.shape[0]/2, but rotate seems to add sometimes lines of zeros below the data and columns on the left. The correct raw number can thus be shifted...

Has anyone any idea how to get the right raw number, for example using the correspondence matrix used by scipy ?

Thanks.

Was it helpful?

Solution

After some time of debugging, I realized that depending on the angle - typically under and over n*45 degrees - scipy adds a row and a column to the output image.

a simple test of the angle adding one to the indices solved my problem.

I hope this can help the future reader of this topic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top