Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help Required in 2D transformation

Status
Not open for further replies.

khurramsh22

Newbie level 3
Newbie level 3
Joined
Sep 22, 2005
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
Hi All,

I am trying to apply 2D transformation on an image. I have got some success but with some problems. Whenever I try to rotate an image, the output image (after rotation) left some pixels empty (no color). How can I remove this bug? Out is ok in case if I am aplying scaling, shearing, translation. Scalling also show same error, when it is increasing the size of image.

I am using simple technique as follows:

A' = T * A

A' is the coordinates of the point after transformation.
T is the transformation matrix
A is the coordinates of the point before transformation.

Waiting for urgent reply
Khurram
 

:) This is not a bug, this is normal in image processing.

What happens is that some of the pixels can't get a valid pixel coordinate because their new coordinate corersponds to a floating number. All what you have to do is to increase the size of the new image to a size that is compatible with the new image size after rotation. i.e. for example, if the image is 400x400, after rotation by 45 degrees, the dimensions of the frame that'll contain this image is 400√2x400√2.

Now, the parts of the frame that don't contain any coordinates of the transformed image will not contain any color data, so they'll remain blank. You can't get overthat.

In digital image processing, you can't view the images without frames, so you can't see it nice and slanted, but you need a frame to hold the slanted image whose size must be compatible with the slanted image size.
 

Thanks for reply.

I have adjusted the size of the image by transforming the corners first.

Is there any solution of the problem that some pixels that are mixing between the image after transofrmation can be avoided. Is "Bilinear Interpolation" for the same problem?

Regards
Khurram

Added after 9 minutes:

Hi elmolla!
Please see this post.
This will give you an idea of my problem.
 

There are two simple "ways" of performing transformations like these.
The first is probably what you have, pixel-holes included:

1) For every pixel in the input image, calculate a corresponding "best" pixel in the output image. For simplicity, let's leave "best" as meaning "to the nearest pixel location".

In this case, the INPUT image is "driving" the choice of transformed coordinates.
Holes can result.

The second method would involve iterating over OUTPUT pixel locations, finding the most suitable (i.e. nearest) input pixels, etc.
Holes will not result.
 

Well, you can do the interpolation technique to approximate the place of the new pixels so that no error occurs. I can say nothing more than that by LouisSheffield.

For me, I used to approximate the position of the new pixels and use rounding to get rid of holes. This has a small effect on the sharpness of the picture.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top