We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello guys,I have extracted interest_points form two image with others helping.But I don't know how to match these points. My ultimate goal is to stitch two or more image. As we know,there are four steps to stitch two image. 1)Feature point extraction and description 2)Pairing feature points to find the position of matching points in two images. 3)Generate a transformation matrix from the pairing point and apply a transformation matrix to image 1 to generate a mapping image to image 2 4)Image 2 is stitched to the map image to complete the stitching import gab.opencv.*; import surf.*; ArrayList interest_points; ArrayList interest_points_r; float threshold = 640; float balanceValue = 0.9; int octaves = 4; PImage leftimg; PImage rightimg;
void setup(){
size(800,800);
leftimg=loadImage("left.png");
rightimg=loadImage("right.png");
/*leftimg.filter(GRAY);
rightimg.filter(GRAY);*/
image(leftimg, 0, 0);
loadPixels();
SURF_Factory mySURF = SURF.createInstance(leftimg, balanceValue, threshold, octaves, this);
Detector detector = mySURF.createDetector();
interest_points = detector.generateInterestPoints();
Descriptor descriptor = mySURF.createDescriptor(interest_points);
descriptor.generateAllDescriptors();
drawInterestPoints();
image(rightimg, leftimg.width, 0);
SURF_Factory mySURF_r =SURF.createInstance(rightimg, balanceValue,threshold, octaves,this);
Detector detector_r = mySURF_r.createDetector();
interest_points_r = detector_r.generateInterestPoints();
Descriptor descriptor_r = mySURF_r.createDescriptor(interest_points_r);
descriptor_r.generateAllDescriptors();
drawInterestPoints_RIGHT();
// drawDescriptors_RIGHT();
}
void drawInterestPoints(){
println("Drawing Interest Points...");
for(int i = 0; i < interest_points.size(); i++){
Interest_Point IP = (Interest_Point) interest_points.get(i);
IP.drawPosition();
}
}
void drawInterestPoints_RIGHT(){
pushMatrix();
translate( leftimg.width, 0 );
for(int i = 0; i < interest_points_r.size(); i++){
Interest_Point IP = (Interest_Point) interest_points_r.get(i);
IP.drawPosition();
}
popMatrix();
}
void drawDescriptors(){
println("Drawing Descriptors...");
for(int i = 0; i < interest_points.size(); i++){
Interest_Point IP = (Interest_Point) interest_points.get(i);
IP.drawDescriptor();
}
}
void drawDescriptors_RIGHT(){
println("Drawing Descriptors...");
translate( leftimg.width, 0 );
for(int i = 0; i < interest_points_r.size(); i++){
Interest_Point IP_r = (Interest_Point) interest_points_r.get(i);
IP_r.drawDescriptor();
}
}
I want to know how to achieve step two "2)Pairing feature points to find the position of matching points in two images."
SURF library can download from [https://code.google.com/archive/p/p-surf[code.google.com/archive/p/p-surf/]
Answers
You formatted your code but you missed the first few lines. Remember to leave an empty line above and below your code of block so for proper formatting to take place. Consider also providing your two images so people can interact directly with your code and address your question.
I believe the BoofCV library also has code used for stitching but not sure if it is performant or stable.
Kf
Prev post from OP: https://forum.processing.org/two/discussion/27413/how-to-change-the-point-of-this#latest