ransac, Homography and QuadrilateralTransformation

41 views
Skip to first unread message

chocolate...@gmail.com

unread,
Oct 24, 2014, 4:41:34 PM10/24/14
to accor...@googlegroups.com
I I try to obtain the corners to extract a part of image when this part is similar to a model, I obtain the homography matrix but I don't know the next step...

I try to make a program for read the car plate, My plan:

- Use aforge directview for controler the video camera,

- use a image model to plaque for search the plate in a video frame with Accord (freak or surf, KNearestNeighborMatching, RansacHomographyEstimator and .... for obtain the projectedModelPoints in the videoFrame.

- extract the plaque with aforge filter QuadrilateralTransformation(projectedModelPoints),

- use filters for preparing the imageExtractPlaque for read with tesserac.

- read the imageExtractPlaque with tesseract

my code:

FastRetinaKeypointDetector _detector = new FastRetinaKeypointDetector(40);
FastRetinaKeypoint[] modelkeyPoints;

MatrixH homography;

Bitmap model = Properties.Resources.Glosette;
modelkeyPoints = _detector.ProcessImage(model).ToArray();

//an idea determinate the corners to model to search in the frame..
GraphicsUnit units = GraphicsUnit.Point;
Rectangle modelRectangle = Rectangle.Round(model.GetBounds(ref units));


Bitmap videoFrame = new Bitmap(videoSourcePlayer1.GetCurrentVideoFrame());

FastRetinaKeypoint[] videokeyPoints = _detector.ProcessImage(videoFrame).ToArray();


var matcher = new KNearestNeighborMatching<byte[]>(5, Distance.BitwiseHamming);

IntPoint[][] matches = matcher.Match(modelkeyPoints, videokeyPoints);

IntPoint[] modelPoints = matches[0];
IntPoint[] videoPoints = matches[1];

RansacHomographyEstimator ransac = new RansacHomographyEstimator(0.001, 0.99);

//I obtain the matrix with the similitud points
homography = ransac.Estimate(modelPoints, videoPoints);


/*Here I don't have idea how obtain the corners of model in the videoFrame for after continue with QuadrilateralTransformation */


QuadrilateralTransformation extract = new QuadrilateralTransformation(corners);

Bitmap temp = extract.Apply(observedImage.ToBitmap());

//if is neded...
Mirror filter = new Mirror(true, false);

pictureBox1.Image = filter.Apply(temp);

Reply all
Reply to author
Forward
0 new messages