Re: imrotate
- From: AK <danrop1CAPTCHA@xxxxxxxxx>
- Date: Tue, 5 Jun 2007 14:59:08 -0400
nazih ouwayed wrote:
Hi,
I tried to rotate a square image using imrotate command.I found
Matlab padding the corners of the rotated image with black pixels.
Does anyone know how to delete the black pixels or replace them by
white pixels?
thank you by advance,
Nazih,
Hi,
It's possible that I've misunderstood your problem, but if you mean
what I think you mean, then "deleting" the black (i.e. zero-valued)
pixels that appear when MATLAB rotates an image doesn't make any
sense. The image "box" still has to remain rectangular with edges
parallel to the screen, and there will always be some empty space
near the corners after rotation (and if the rotated image is of the
same size, the information that goes off the image boundaries gets
lost). The only exception is when the rotation is a multiple of 90
degrees, but that's easily understood.
If you want to change these corner region pixels to white, then
here's a simple trick:
Suppose L is a uint8 grayscale image that you want to rotate, say by
20 degrees. I assume you don't want to lose any image information, so
the final image will be larger than the original one. White "is" 255.
Perform the following steps
I = ones(size(L));
Lr = imrotate(L, 20);
Ir = imrotate(I, 20);
Lr(Ir==0) = 255;
Hope that helps
.
- Follow-Ups:
- Re: imrotate
- From: nazih ouwayed
- Re: imrotate
- References:
- imrotate
- From: nazih ouwayed
- imrotate
- Prev by Date: Re: Change Background of Cell
- Next by Date: Scatter Plot (Finding R^2, trendline, and equation of trendline)
- Previous by thread: imrotate
- Next by thread: Re: imrotate
- Index(es):
Relevant Pages
|