rotating a matrix without interpolation

조회 수: 19 (최근 30일)
Oded Scharf
Oded Scharf 2020년 12월 1일
댓글: Oded Scharf 2020년 12월 6일
Hey,
I want to rotate a mtrix by a certain degree without interpolating the intermediate pixels and just place NaN in them.
I tried to use imrotate but there is no option to do it without interpolating.
Any suggestions?
Thank in advence.
Oded

답변 (1개)

Walter Roberson
Walter Roberson 2020년 12월 2일
When you rotate a matrix, then the only pixels that can be calculated without any interpolation are the ones whose coordinates are such that the ratio of coordinates is exactly an integer multiple of tan() of the rotation angle. For example if the rotation is 42.7093899573615 degrees then there are some pixels whose coordinates happen to fall on the famous (5, 12, 13) pythagorean triple, and those single pixels could be copied without any interpolation. Every other pixel would require interpolation.
Are you sure you want to construct a matrix of nan that is the appropriate size to hold the rotated matrix, with the entire matrix nan except for the few scattered pixels that just happen to be at exactly the right coordinates to be carried from integer position to integer position by the rotation?
  댓글 수: 7
Walter Roberson
Walter Roberson 2020년 12월 5일
I notice that in your desired result that each location ends up sqrt(2) times the original distance. Items that were 1 unit end up on the diagonal sqrt(2) away. Items that were sqrt(2) away end up 2 away. Is that the pattern? We might be able to work with that.
Oded Scharf
Oded Scharf 2020년 12월 6일
Yeah, I think it is the right pattern

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by