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.

How to shift 2 rotated images to the same angle ?(VC++)

Status
Not open for further replies.

zkai2000

Member level 5
Joined
Jul 25, 2004
Messages
94
Helped
0
Reputation
0
Reaction score
2
Trophy points
1,286
Activity points
907
2 rotated images

Hi, I have 2 images with different orientations. How do I shift them into the same angle?
Im writing the codes in VC++. Please advice

Thanks!!
 

Re: 2 rotated images

Did you load them on the Canvas or into a image box.

If on the Canvas you can write a little roteen that can rotate the image.
Else do the image in Paint shop or so and reload.

Do you want to rotate the image in run time?? :sm35:
 

Re: 2 rotated images

1. If the question is that you have 2 images and you know the ANGLE to rotate, you should check if there is a function provided by VC++ to do that. If you want to write the whole thing yourself, you are going to learn how to interpolate pixels too sicne when you rotate the pixels will fall off the grid.

2. If the question is that you have 2 images and you don't know how much to rotate and you want to write a program to find a rotation so that they match, this is a common problem in image "registration" which is usually solved by using features "matching".
 

Re: 2 rotated images

Do you want to rotate the image in run time??

Nope~~

2. If the question is that you have 2 images and you don't know how much to rotate and you want to write a program to find a rotation so that they match, this is a common problem in image "registration" which is usually solved by using features "matching".

yes yes yes!!! Do you have any further information on it? Mind sending me any useful websites? Thank you!!
 

Re: 2 rotated images

There are a whole range of methods and I believe many of them should be mentioned in Duda's book Pattern Classification.

Examples
1. You can match them manually by using pointing device(mouse) to click correspoding points in both images. For plane image (no projection), you only need 2 pairs to calculate the transform.

2. Extract distinct features (in this case minutiae) and find matching of these features in both images using graph, some annealing algorithms (graduate assignment, etc.), or etc. I believe Duda's book should explain several of these methods (though I didn't read from this book.) You can also read from papers by searching keyword "image registration" or "image matching", there will be plenty.

The best way, read other fingerprint related papers, they should mention which method they use. (Since some of image registration and matching are developed with scene analysis in mind, some of the methods might not be applicable to fingerprint image.)
 

2 rotated images

If you can use MATLAB instead, it will be better. In MATLAB it is so easy, you will just rotate the image with the function "imrotate" and compare them with "isequal" function
 

Re: 2 rotated images

As someone mentioned before, if you're trying to recover the angle of rotation, such that the two images align with respect to corresponding features, then that's called "image registration". Image registration has important applications in medical imagery. Several methods have been developed to accomplish image registration, you might try googling 'survey image registration', read about the different techniques, then try to implement one of them.

One really robust and interesting technique for image registration is maximization of mutual information (MMI) of the two images (google for it), you'll find several papers on the topic. The papers might be a bit hard to digest, so here's a brief idea of how it works. (I'm assuming here that the point of rotation is the centre of the image - i.e. there are no x- or y-displacements involved).

Assuming your images are grayscale, you'll first have to determine the histogram of each image and then normalize by divide by total number of pixels, imagining this normalised histogram to represent probability distributions of pixels in the images.

Let one of your images be fixed, and rotate the other by a small angle, the point of rotation being the centre of the image. (Whilst carrying out rotation, you will have to handle interpolation concerns, for your case, nearest neighbour interpolation might be enough - read about it). Now imagine your rotated image to be superposed on the fixed image, and calculate the mutual information defined by the formulas you'll find in the MMI research papers. Store the value of θ and corresponding value of MMI in a table. Repeat by incrementally increasing θ (say by 1 or 2 degrees) and calculating the MMI every time, as described above, covering the whole range of θ from 0 to 360 degrees.

In the end, find the theta corresponding to the largest value of MMI. If you did everything right, you should end up with the value of the angle that the 2nd image has to be rotated so that it corresponds to the first.

I hope this helps you understand the papers better (you'll still have to read them though). If you don't want to use MMI, you can use the same procedure as above but use some other measure, such as cross-correlation or entropy.

Cheers,

AK
 

Re: 2 rotated images

I wouldn't suggest maximization of mutual information for fingerprints. Maximization of mutual information originally developed to deal with image with multiple modalities, meaning they don't have distinct common features. Under the assumption that images from different sensors still have common statistical properties, mutual information can be used to measure that.

However, it is more computationally expensive, even more expensive than normal template matching. Moreover, when you have only 1 modal image the use of mutual information would not give much advantage if any.
 

Re: 2 rotated images

Well like you said, MMI is probably not going to work for fingerprint matching and the like (although it might be interesting to try, although an optimisation method such as Nelder-mead would probably be useless), but the questioner didn't specify the types of images so I thought MMI would be a better bet than most.
But you're right, if you're matching what are essentially same images, and only differ by a geometrical transformation, then there are definitely simpler and cheaper methods around.
 

Re: 2 rotated images

Dear all, thanks for the ideas!

But let's say I have already place the fingerprint image into an array, and I need to match it with another fingerprint which located in another array (different angle/orientation), can I match them using any algorithms by switching them into the same angle?

Im using VC++...
 

2 rotated images

hi,
i am also following this link, and i got a doubt..
say, when u are rotating the image.
and consider the image stored in a image[row][col]
array,
while rotation, will the address of each array element be changed or the value of each element is changed?

and how to open the djvu format file??
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top