用openCV做envi图像拼接接,求助,会的来

博主最新文章
博主热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)图像拼接在实际的应用场景很广,比如无人机航拍,遥感图像等等,图像拼接是进一步做图像理解基础步骤,拼接效果的好坏直接影响接下来的工作,所以一个好的图像拼接算法非常重要。
再举一个身边的例子吧,你用你的手机对某一场景拍照,但是你没有办法一次将所有你要拍的景物全部拍下来,所以你对该场景从左往右依次拍了好几张图,来把你要拍的所有景物记录下来。那么我们能不能把这些图像拼接成一个大图呢?我们利用opencv就可以做到图像拼接的效果!
比如我们有对这两张图进行拼接。
从上面两张图可以看出,这两张图有比较多的重叠部分,这也是拼接的基本要求。
那么要实现图像拼接需要那几步呢?简单来说有以下几步:
对每幅图进行特征点提取对对特征点进行匹配进行图像配准把图像拷贝到另一幅图像的特定位置对重叠边界进行特殊处理
好吧,那就开始正式实现图像配准。
第一步就是特征点提取。现在CV领域有很多特征点的定义,比如sift、surf、harris角点、ORB都是很有名的特征因子,都可以用来做图像拼接的工作,他们各有优势。本文将使用ORB和SURF进行图像拼接,用其他方法进行拼接也是类似的。
基于SURF的图像拼接
用SIFT算法来实现图像拼接是很常用的方法,但是因为SIFT计算量很大,所以在速度要求很高的场合下不再适用。所以,它的改进方法SURF因为在速度方面有了明显的提高(速度是SIFT的3倍),所以在图像拼接领域还是大有作为。虽说SURF精确度和稳定性不及SIFT,但是其综合能力还是优越一些。下面将详细介绍拼接的主要步骤。
1.特征点提取和匹配
特征点提取和匹配的方法我在上一篇文章中做了详细的介绍,在这里直接使用上文所总结的SURF特征提取和特征匹配的方法。
SurfFeatureDetector Detector(2000);
vector&KeyPoint& keyPoint1, keyPoint2;
Detector.detect(image1, keyPoint1);
Detector.detect(image2, keyPoint2);
SurfDescriptorExtractor D
Mat imageDesc1, imageDesc2;
Descriptor.compute(image1, keyPoint1, imageDesc1);
Descriptor.compute(image2, keyPoint2, imageDesc2);
FlannBasedM
vector&vector&DMatch& & matcheP
vector&DMatch& GoodMatcheP
vector&Mat& train_desc(1, imageDesc1);
matcher.add(train_desc);
matcher.train();
matcher.knnMatch(imageDesc2, matchePoints, 2);
cout && "total match points: " && matchePoints.size() && endl;
for (int i = 0; i & matchePoints.size(); i++)
if (matchePoints[i][0].distance & 0.4 * matchePoints[i][1].distance)
GoodMatchePoints.push_back(matchePoints[i][0]);
Mat first_
drawMatches(image02, keyPoint2, image01, keyPoint1, GoodMatchePoints, first_match);
imshow("first_match ", first_match);
2.图像配准
这样子我们就可以得到了两幅待拼接图的匹配点集,接下来我们进行图像的配准,即将两张图像转换为同一坐标下,这里我们需要使用findHomography函数来求得变换矩阵。但是需要注意的是,findHomography函数所要用到的点集是Point2f类型的,所有我们需要对我们刚得到的点集GoodMatchePoints再做一次处理,使其转换为Point2f类型的点集。
vector&Point2f& imagePoints1, imagePoints2;
for (int i = 0; i&GoodMatchePoints.size(); i++)
imagePoints2.push_back(keyPoint2[GoodMatchePoints[i].queryIdx].pt);
imagePoints1.push_back(keyPoint1[GoodMatchePoints[i].trainIdx].pt);
这样子,我们就可以拿着imagePoints1, imagePoints2去求变换矩阵了,并且实现图像配准。值得注意的是findHomography函数的参数中我们选泽了CV_RANSAC,这表明我们选择RANSAC算法继续筛选可靠地匹配点,这使得匹配点解更为精确。
Mat homo = findHomography(imagePoints1, imagePoints2, CV_RANSAC);
cout && "变换矩阵为:\n" && homo && endl && endl;
Mat imageTransform1, imageTransform2;
warpPerspective(image01, imageTransform1, homo, Size(MAX(corners.right_top.x, corners.right_bottom.x), image02.rows));
imshow("直接经过透视矩阵变换", imageTransform1);
imwrite("trans1.jpg", imageTransform1);
3. 图像拷贝
拷贝的思路很简单,就是将左图直接拷贝到配准图上就可以了。
int dst_width = imageTransform1.
int dst_height = image02.
Mat dst(dst_height, dst_width, CV_8UC3);
dst.setTo(0);
imageTransform1.copyTo(dst(Rect(0, 0, imageTransform1.cols, imageTransform1.rows)));
image02.copyTo(dst(Rect(0, 0, image02.cols, image02.rows)));
imshow("b_dst", dst);
4.图像融合(去裂缝处理)
从上图可以看出,两图的拼接并不自然,原因就在于拼接图的交界处,两图因为光照色泽的原因使得两图交界处的过渡很糟糕,所以需要特定的处理解决这种不自然。这里的处理思路是加权融合,在重叠部分由前一幅图像慢慢过渡到第二幅图像,即将图像的重叠区域的像素值按一定的权值相加合成新的图像。
void OptimizeSeam(Mat& img1, Mat& trans, Mat& dst)
int start = MIN(corners.left_top.x, corners.left_bottom.x);
double processWidth = img1.cols -
int rows = dst.
int cols = img1.
double alpha = 1;
for (int i = 0; i & i++)
uchar* p = img1.ptr&uchar&(i);
uchar* t = trans.ptr&uchar&(i);
uchar* d = dst.ptr&uchar&(i);
for (int j = j & j++)
if (t[j * 3] == 0 && t[j * 3 + 1] == 0 && t[j * 3 + 2] == 0)
alpha = 1;
alpha = (processWidth - (j - start)) / processW
d[j * 3] = p[j * 3] * alpha + t[j * 3] * (1 - alpha);
d[j * 3 + 1] = p[j * 3 + 1] * alpha + t[j * 3 + 1] * (1 - alpha);
d[j * 3 + 2] = p[j * 3 + 2] * alpha + t[j * 3 + 2] * (1 - alpha);
多尝试几张,验证拼接效果
最后给出完整的SURF算法实现的拼接代码。
#include "highgui/highgui.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/legacy/legacy.hpp"
#include &iostream&
using namespace
using namespace std;
void OptimizeSeam(Mat& img1, Mat& trans, Mat& dst);
typedef struct
Point2f left_
Point2f left_
Point2f right_
Point2f right_
}four_corners_t;
four_corners_t
void CalcCorners(const Mat& H, const Mat& src)
double v2[] = { 0, 0, 1 };
double v1[3];
Mat V2 = Mat(3, 1, CV_64FC1, v2);
Mat V1 = Mat(3, 1, CV_64FC1, v1);
V1 = H * V2;
cout && "V2: " && V2 && endl;
cout && "V1: " && V1 && endl;
corners.left_top.x = v1[0] / v1[2];
corners.left_top.y = v1[1] / v1[2];
v2[0] = 0;
v2[1] = src.
v2[2] = 1;
V2 = Mat(3, 1, CV_64FC1, v2);
V1 = Mat(3, 1, CV_64FC1, v1);
V1 = H * V2;
corners.left_bottom.x = v1[0] / v1[2];
corners.left_bottom.y = v1[1] / v1[2];
v2[0] = src.
v2[1] = 0;
v2[2] = 1;
V2 = Mat(3, 1, CV_64FC1, v2);
V1 = Mat(3, 1, CV_64FC1, v1);
V1 = H * V2;
corners.right_top.x = v1[0] / v1[2];
corners.right_top.y = v1[1] / v1[2];
v2[0] = src.
v2[1] = src.
v2[2] = 1;
V2 = Mat(3, 1, CV_64FC1, v2);
V1 = Mat(3, 1, CV_64FC1, v1);
V1 = H * V2;
corners.right_bottom.x = v1[0] / v1[2];
corners.right_bottom.y = v1[1] / v1[2];
int main(int argc, char *argv[])
Mat image01 = imread("g5.jpg", 1);
Mat image02 = imread("g4.jpg", 1);
imshow("p2", image01);
imshow("p1", image02);
Mat image1, image2;
cvtColor(image01, image1, CV_RGB2GRAY);
cvtColor(image02, image2, CV_RGB2GRAY);
SurfFeatureDetector Detector(2000);
vector&KeyPoint& keyPoint1, keyPoint2;
Detector.detect(image1, keyPoint1);
Detector.detect(image2, keyPoint2);
SurfDescriptorExtractor D
Mat imageDesc1, imageDesc2;
Descriptor.compute(image1, keyPoint1, imageDesc1);
Descriptor.compute(image2, keyPoint2, imageDesc2);
FlannBasedM
vector&vector&DMatch& & matcheP
vector&DMatch& GoodMatcheP
vector&Mat& train_desc(1, imageDesc1);
matcher.add(train_desc);
matcher.train();
matcher.knnMatch(imageDesc2, matchePoints, 2);
cout && "total match points: " && matchePoints.size() && endl;
for (int i = 0; i & matchePoints.size(); i++)
if (matchePoints[i][0].distance & 0.4 * matchePoints[i][1].distance)
GoodMatchePoints.push_back(matchePoints[i][0]);
Mat first_
drawMatches(image02, keyPoint2, image01, keyPoint1, GoodMatchePoints, first_match);
imshow("first_match ", first_match);
vector&Point2f& imagePoints1, imagePoints2;
for (int i = 0; i&GoodMatchePoints.size(); i++)
imagePoints2.push_back(keyPoint2[GoodMatchePoints[i].queryIdx].pt);
imagePoints1.push_back(keyPoint1[GoodMatchePoints[i].trainIdx].pt);
Mat homo = findHomography(imagePoints1, imagePoints2, CV_RANSAC);
cout && "变换矩阵为:\n" && homo && endl && endl;
CalcCorners(homo, image01);
cout && "left_top:" && corners.left_top && endl;
cout && "left_bottom:" && corners.left_bottom && endl;
cout && "right_top:" && corners.right_top && endl;
cout && "right_bottom:" && corners.right_bottom && endl;
Mat imageTransform1, imageTransform2;
warpPerspective(image01, imageTransform1, homo, Size(MAX(corners.right_top.x, corners.right_bottom.x), image02.rows));
imshow("直接经过透视矩阵变换", imageTransform1);
imwrite("trans1.jpg", imageTransform1);
int dst_width = imageTransform1.
int dst_height = image02.
Mat dst(dst_height, dst_width, CV_8UC3);
dst.setTo(0);
imageTransform1.copyTo(dst(Rect(0, 0, imageTransform1.cols, imageTransform1.rows)));
image02.copyTo(dst(Rect(0, 0, image02.cols, image02.rows)));
imshow("b_dst", dst);
OptimizeSeam(image02, imageTransform1, dst);
imshow("dst", dst);
imwrite("dst.jpg", dst);
waitKey();
void OptimizeSeam(Mat& img1, Mat& trans, Mat& dst)
int start = MIN(corners.left_top.x, corners.left_bottom.x);
double processWidth = img1.cols -
int rows = dst.
int cols = img1.
double alpha = 1;
for (int i = 0; i & i++)
uchar* p = img1.ptr&uchar&(i);
uchar* t = trans.ptr&uchar&(i);
uchar* d = dst.ptr&uchar&(i);
for (int j = j & j++)
if (t[j * 3] == 0 && t[j * 3 + 1] == 0 && t[j * 3 + 2] == 0)
alpha = 1;
alpha = (processWidth - (j - start)) / processW
d[j * 3] = p[j * 3] * alpha + t[j * 3] * (1 - alpha);
d[j * 3 + 1] = p[j * 3 + 1] * alpha + t[j * 3 + 1] * (1 - alpha);
d[j * 3 + 2] = p[j * 3 + 2] * alpha + t[j * 3 + 2] * (1 - alpha);
基于ORB的图像拼接
利用ORB进行图像拼接的思路跟上面的思路基本一样,只是特征提取和特征点匹配的方式略有差异罢了。这里就不再详细介绍思路了,直接贴代码看效果。
#include "highgui/highgui.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/legacy/legacy.hpp"
#include &iostream&
void OptimizeSeam(Mat& img1, Mat& trans, Mat& dst);
typedef struct
Point2f left_
Point2f left_
Point2f right_
Point2f right_
}four_corners_t;
four_corners_
void CalcCorners(const Mat& H, const Mat& src)
double v2[] = { 0, 0, 1 };
double v1[3];
Mat V2 = Mat(3, 1, CV_64FC1, v2);
Mat V1 = Mat(3, 1, CV_64FC1, v1);
V1 = H * V2;
cout && "V2: " && V2 &&
cout && "V1: " && V1 &&
corners.left_top.x = v1[0] / v1[2];
corners.left_top.y = v1[1] / v1[2];
v2[0] = 0;
v2[1] = src.
v2[2] = 1;
V2 = Mat(3, 1, CV_64FC1, v2);
V1 = Mat(3, 1, CV_64FC1, v1);
V1 = H * V2;
corners.left_bottom.x = v1[0] / v1[2];
corners.left_bottom.y = v1[1] / v1[2];
v2[0] = src.
v2[1] = 0;
v2[2] = 1;
V2 = Mat(3, 1, CV_64FC1, v2);
V1 = Mat(3, 1, CV_64FC1, v1);
V1 = H * V2;
corners.right_top.x = v1[0] / v1[2];
corners.right_top.y = v1[1] / v1[2];
v2[0] = src.
v2[1] = src.
v2[2] = 1;
V2 = Mat(3, 1, CV_64FC1, v2);
V1 = Mat(3, 1, CV_64FC1, v1);
V1 = H * V2;
corners.right_bottom.x = v1[0] / v1[2];
corners.right_bottom.y = v1[1] / v1[2];
int main(int argc, char *argv[])
Mat image01 = imread("t1.jpg", 1);
Mat image02 = imread("t2.jpg", 1);
imshow("p2", image01);
imshow("p1", image02);
Mat image1, image2;
cvtColor(image01, image1, CV_RGB2GRAY);
cvtColor(image02, image2, CV_RGB2GRAY);
OrbFeatureDetector
surfDetector(3000);
vector&KeyPoint& keyPoint1, keyPoint2;
surfDetector.detect(image1, keyPoint1);
surfDetector.detect(image2, keyPoint2);
OrbDescriptorExtractor
Mat imageDesc1, imageDesc2;
SurfDescriptor.compute(image1, keyPoint1, imageDesc1);
SurfDescriptor.compute(image2, keyPoint2, imageDesc2);
flann::Index flannIndex(imageDesc1, flann::LshIndexParams(12, 20, 2), cvflann::FLANN_DIST_HAMMING);
vector&DMatch& GoodMatcheP
Mat macthIndex(imageDesc2.rows, 2, CV_32SC1), matchDistance(imageDesc2.rows, 2, CV_32FC1);
flannIndex.knnSearch(imageDesc2, macthIndex, matchDistance, 2, flann::SearchParams());
for (int i = 0; i & matchDistance. i++)
if (matchDistance.at&float&(i, 0) & 0.4 * matchDistance.at&float&(i, 1))
DMatch dmatches(i, macthIndex.at&int&(i, 0), matchDistance.at&float&(i, 0));
GoodMatchePoints.push_back(dmatches);
Mat first_
drawMatches(image02, keyPoint2, image01, keyPoint1, GoodMatchePoints, first_match);
imshow("first_match ", first_match);
vector&Point2f& imagePoints1, imagePoints2;
for (int i = 0; i&GoodMatchePoints.size(); i++)
imagePoints2.push_back(keyPoint2[GoodMatchePoints[i].queryIdx].pt);
imagePoints1.push_back(keyPoint1[GoodMatchePoints[i].trainIdx].pt);
Mat homo = findHomography(imagePoints1, imagePoints2, CV_RANSAC);
cout && "变换矩阵为:\n" && homo && endl &&
CalcCorners(homo, image01);
cout && "left_top:" && corners.left_top &&
cout && "left_bottom:" && corners.left_bottom &&
cout && "right_top:" && corners.right_top &&
cout && "right_bottom:" && corners.right_bottom &&
Mat imageTransform1, imageTransform2;
warpPerspective(image01, imageTransform1, homo, Size(MAX(corners.right_top.x, corners.right_bottom.x), image02.rows));
imshow("直接经过透视矩阵变换", imageTransform1);
imwrite("trans1.jpg", imageTransform1);
int dst_width = imageTransform1.
int dst_height = image02.
Mat dst(dst_height, dst_width, CV_8UC3);
dst.setTo(0);
imageTransform1.copyTo(dst(Rect(0, 0, imageTransform1.cols, imageTransform1.rows)));
image02.copyTo(dst(Rect(0, 0, image02.cols, image02.rows)));
imshow("b_dst", dst);
OptimizeSeam(image02, imageTransform1, dst);
imshow("dst", dst);
imwrite("dst.jpg", dst);
waitKey();
void OptimizeSeam(Mat& img1, Mat& trans, Mat& dst)
int start = MIN(corners.left_top.x, corners.left_bottom.x);
double processWidth = img1.cols -
int rows = dst.
int cols = img1.
double alpha = 1;
for (int i = 0; i & i++)
uchar* p = img1.ptr&uchar&(i);
uchar* t = trans.ptr&uchar&(i);
uchar* d = dst.ptr&uchar&(i);
for (int j = j & j++)
if (t[j * 3] == 0 && t[j * 3 + 1] == 0 && t[j * 3 + 2] == 0)
alpha = 1;
alpha = (processWidth - (j - start)) / processW
d[j * 3] = p[j * 3] * alpha + t[j * 3] * (1 - alpha);
d[j * 3 + 1] = p[j * 3 + 1] * alpha + t[j * 3 + 1] * (1 - alpha);
d[j * 3 + 2] = p[j * 3 + 2] * alpha + t[j * 3 + 2] * (1 - alpha);
看一看拼接效果,我觉得还是不错的。
看一下这一组图片,这组图片产生了鬼影,为什么?因为两幅图中的人物走动了啊!所以要做图像拼接,尽量保证使用的是静态图片,不要加入一些动态因素干扰拼接。
opencv自带的拼接算法stitch
opencv其实自己就有实现图像拼接的算法,当然效果也是相当好的,但是因为其实现很复杂,而且代码量很庞大,其实在一些小应用下的拼接有点杀鸡用牛刀的感觉。最近在阅读sticth源码时,发现其中有几个很有意思的地方。
1.opencv stitch选择的特征检测方式
一直很好奇opencv stitch算法到底选用了哪个算法作为其特征检测方式,是ORB,SIFT还是SURF?读源码终于看到答案。
#ifdef HAVE_OPENCV_NONFREE
stitcher.setFeaturesFinder(new detail::SurfFeaturesFinder());
stitcher.setFeaturesFinder(new detail::OrbFeaturesFinder());
在源码createDefault函数中(默认设置),第一选择是SURF,第二选择才是ORB(没有NONFREE模块才选),所以既然大牛们这么选择,必然是经过综合考虑的,所以应该SURF算法在图像拼接有着更优秀的效果。
2.opencv stitch获取匹配点的方式
以下代码是opencv stitch源码中的特征点提取部分,作者使用了两次特征点提取的思路:先对图一进行特征点提取和筛选匹配(1-&2),再对图二进行特征点的提取和匹配(2-&1),这跟我们平时的一次提取的思路不同,这种二次提取的思路可以保证更多的匹配点被选中,匹配点越多,findHomography求出的变换越准确。这个思路值得借鉴。
matches_info.matches.clear();
Ptr&flann::IndexParams& indexParams = new flann::KDTreeIndexParams();
Ptr&flann::SearchParams& searchParams = new flann::SearchParams();
if (features2.descriptors.depth() == CV_8U)
indexParams-&setAlgorithm(cvflann::FLANN_INDEX_LSH);
searchParams-&setAlgorithm(cvflann::FLANN_INDEX_LSH);
FlannBasedMatcher matcher(indexParams, searchParams);
vector& vector&DMatch& & pair_
matcher.knnMatch(features1.descriptors, features2.descriptors, pair_matches, 2);
for (size_t i = 0; i & pair_matches.size(); ++i)
if (pair_matches[i].size() & 2)
const DMatch& m0 = pair_matches[i][0];
const DMatch& m1 = pair_matches[i][1];
if (m0.distance & (1.f - match_conf_) * m1.distance)
matches_info.matches.push_back(m0);
matches.insert(make_pair(m0.queryIdx, m0.trainIdx));
LOG("\n1-&2 matches: " && matches_info.matches.size() && endl);
pair_matches.clear();
matcher.knnMatch(features2.descriptors, features1.descriptors, pair_matches, 2);
for (size_t i = 0; i & pair_matches.size(); ++i)
if (pair_matches[i].size() & 2)
const DMatch& m0 = pair_matches[i][0];
const DMatch& m1 = pair_matches[i][1];
if (m0.distance & (1.f - match_conf_) * m1.distance)
if (matches.find(make_pair(m0.trainIdx, m0.queryIdx)) == matches.end())
matches_info.matches.push_back(DMatch(m0.trainIdx, m0.queryIdx, m0.distance));
LOG("1-&2 & 2-&1 matches: " && matches_info.matches.size() && endl);
这里我仿照opencv源码二次提取特征点的思路对我原有拼接代码进行改写,实验证明获取的匹配点确实较一次提取要多。
SiftFeatureDetector Detector(1000);
vector&KeyPoint& keyPoint1, keyPoint2;
Detector.detect(image1, keyPoint1);
Detector.detect(image2, keyPoint2);
SiftDescriptorExtractor D
Mat imageDesc1, imageDesc2;
Descriptor.compute(image1, keyPoint1, imageDesc1);
Descriptor.compute(image2, keyPoint2, imageDesc2);
FlannBasedM
vector&vector&DMatch& & matcheP
vector&DMatch& GoodMatcheP
vector&Mat& train_desc(1, imageDesc1);
matcher.add(train_desc);
matcher.train();
matcher.knnMatch(imageDesc2, matchePoints, 2);
for (int i = 0; i & matchePoints.size(); i++)
if (matchePoints[i][0].distance & 0.4 * matchePoints[i][1].distance)
GoodMatchePoints.push_back(matchePoints[i][0]);
matches.insert(make_pair(matchePoints[i][0].queryIdx, matchePoints[i][0].trainIdx));
cout&&"\n1-&2 matches: " && GoodMatchePoints.size() && endl;
FlannBasedMatcher matcher2;
matchePoints.clear();
vector&Mat& train_desc2(1, imageDesc2);
matcher2.add(train_desc2);
matcher2.train();
matcher2.knnMatch(imageDesc1, matchePoints, 2);
for (int i = 0; i & matchePoints.size(); i++)
if (matchePoints[i][0].distance & 0.4 * matchePoints[i][1].distance)
if (matches.find(make_pair(matchePoints[i][0].trainIdx, matchePoints[i][0].queryIdx)) == matches.end())
GoodMatchePoints.push_back(DMatch(matchePoints[i][0].trainIdx, matchePoints[i][0].queryIdx, matchePoints[i][0].distance));
cout&&"1-&2 & 2-&1 matches: " && GoodMatchePoints.size() && endl;
最后再看一下opencv stitch的拼接效果吧~速度虽然比较慢,但是效果还是很好的。
#include &iostream&
#include &opencv2/core/core.hpp&
#include &opencv2/highgui/highgui.hpp&
#include &opencv2/imgproc/imgproc.hpp&
#include &opencv2/stitching/stitcher.hpp&
using namespace std;
using namespace
bool try_use_gpu = false;
vector&Mat&
string result_name = "dst1.jpg";
int main(int argc, char * argv[])
Mat img1 = imread("34.jpg");
Mat img2 = imread("35.jpg");
imshow("p1", img1);
imshow("p2", img2);
if (img1.empty() || img2.empty())
cout && "Can't read image" && endl;
return -1;
imgs.push_back(img1);
imgs.push_back(img2);
Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
Stitcher::Status status = stitcher.stitch(imgs, pano);
if (status != Stitcher::OK)
cout && "Can't stitch images, error code = " && int(status) && endl;
return -1;
imwrite(result_name, pano);
Mat pano2 = pano.clone();
imshow("全景图像", pano);
if (waitKey() == 27)下次自动登录
现在的位置:
& 综合 & 正文
【OpenCV-图像处理】用sift特征点算法和ransac算法进行多幅图像的拼接
最近我玩samsung手机的时候发现很多有拍照功能的软件里面都嵌着对多幅图像进行拼接成一幅图像的功能。
玩着玩着有了灵感。。。这也是好事,因为最近搞了毕设,毕设内容要涉及到sift特征提取和ransac优化。so,整理了这方面我到现在看到的各种资料以及论文里所提出的拼接思想以及方法。具体的以及具体的方法可以参考互联网上的资料。
我推荐各位搞图像处理的朋友们多多看看在互联网上默默地为图像处理的发展而努力地大神们的博客。强烈推荐新浪博客、网易博客以及各种博客和微博。因为都喜欢自己搞研究嘛。有什么成果,或者有什么感想,他们都会用写博客来享受探讨科学的魅力。当然也有些极少人喜欢拉博客访问量喜欢转载,自己却看都不看。
ok,话题转正。
大家都知道最近最热的一个研究就是sift特征点提取和匹配,以及运用ransac算法提纯数据。还有图像融合这方面。但大家都在苦恼这sift特征点的提取和匹配。sift特征点的提取虽然看起来很费劲,但是勇敢地去翻看与sift特征点以及sift算法的资料,你会发现原来所谓的高科技都是这么来的。不要害怕,那些理论很好看懂的。看懂了你在互联网上下个matlab版的sift程序或者opencv版的sift程序后,好好儿自己搞一搞。自己搞懂了一个,下面其他人写的那些都是浮云,一个理论能有什么不一样?
不一样就在局部地优化了而已,所以,无论搞哪一行也,首先不要害怕,静下心来,鼓着勇气说我行的。然后你就慢慢来,不要急于求成。首先搞懂基本原理,然后在网上搞个简单的相关程序自己编译,编译通过了,你就懂了百分之八十。
至于ransac嘛,在网上也有很多资料的。我使用opencv搞图像拼接的,所以,在网上找了好久没找着,即使有都要钱的。接下来不久我会写出对提取出来的sift特征点集进行ransac算法估计透视变换模型参数的程序。希望到时候各位读一读指教指教。
我发现大多数大神都不喜欢交流,也不是交流,就直接说,他们不想教人家,这原因很简单,我辛辛苦苦写了程序,整整几天没合上眼找了bug,编译通过了,你一上来问我,我凭什么告诉你。都是这种心理状态。但我想为了提高我自身的水平,我会第一时间回复,希望各位大神大胆的提出问题,大胆的批评我,大胆的指正。。。我会乐意跟你们交流的。。。因为我不算什么大神。。。
期待你的到来,期待你的指正和指导。。。
【上篇】【下篇】

我要回帖

更多关于 python 图像拼接 的文章

 

随机推荐