필터 지우기
필터 지우기

How to rotate an image without losing any pixels?

조회 수: 5 (최근 30일)
Nafeesath Musfira
Nafeesath Musfira 2015년 4월 16일
댓글: Nafeesath Musfira 2015년 4월 17일
Hi, I used imrotate to rotate my hand image. I had marked the wrist points with an intensity value 100 and wrist points with intensity value 150; so that I don't loose the coordinate points after rotation. My image is:
And the resultant image I got after rotating it 21.8014 degree is this:
Two of three white dots are missing. Please suggest some solution, is there any method to preserve those points with rotated coordinates?

답변 (1개)

Image Analyst
Image Analyst 2015년 4월 16일
If you use the 'nearest' option of imrotate(), there is a chance the single white dots won't copy over. If you use the default interpolated mode then, unless the white dot falls exactly on an output pixel, the white dot will land between output pixels and thus be spread over 4 pixels resulting in a lower intensity - perhaps not bright enough to notice. To avoid holes in the image imrotate basically scans the output and figures out where in the input image to pull a pixel from. This way ensures that every pixel in the output image will have a value. The other way is to scan the input image and send every input value to an output location. Doing it this way means that you will have some "holes" in the output image where no input pixels ever got assigned to. If you do this then you can be sure that your single white dots end up somewhere, but you'll have to write the code yourself, including the part where you "fill in" holes (missing pixels). No I don't have any code for this but it's easy for you to do yourself.
  댓글 수: 4
Image Analyst
Image Analyst 2015년 4월 16일
It could be that the white dots were never the nearest pixel and so they didn't get sent over. Read carefully what I wrote above.
Nafeesath Musfira
Nafeesath Musfira 2015년 4월 17일
Sorry, but I didn't get what sending input pixels to output location means.Can you please explain?

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

Community Treasure Hunt

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

Start Hunting!

Translated by