I am trying to align an image according to a base image and according to the position of 2 circles on the left of each page.
The link for base image: http://tinypic.com/view.php?pic=nmi053&s=6
The link for unregistered image: http://tinypic.com/view.php?pic=2zsbmuu&s=6
The code I have so far is listed below but the only thing I have a problem with is how to use imtransfrom function to register the image.
No products are associated with this question.
Have you tried imregister()? It will condense all that code down into a single line of code. Go ahead, make it easy on yourself.
Here's a modification of the original approach using ABSOR, available here
[LI, numI] = bwlabel( imfill(BWIremove,'holes') );
[LJ, numJ] = bwlabel( imfill(BWJremove,'holes') );
centroidsI = regionprops(LI,'Centroid');
centroidsJ = regionprops(LJ,'Centroid');
% Create a transformation structure for an affine % transformation.
S=absor(cJ.', cI.'); t_concord=maketform('affine', S.M(1:2,:).');
registered = imtransform(IMJ,t_concord,....);
Because you're only using 2 landmarks to perform the registration, the alignment will probably not be as perfect as with imregister, although as I've said, I have my doubts about how well imregister would work across a larger population of questionnaires.
There are things you could do to improve the tilt angle estimate though, like find more landmarks, or use regionprops(...,'Orientation') on the answer boxes.
Play games and win prizes!Learn more