add support for loading yml images
This commit is contained in:
parent
d5013c69a8
commit
58bf764af9
4 changed files with 145 additions and 25 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
#include "matutils.h"
|
||||
#include "drawing.h"
|
||||
|
|
@ -185,9 +186,12 @@ RemapedImage applyRemap(const cv::Mat& image, const RemapMap &map)
|
|||
cv::Mat simpleStich(const std::vector<RemapedImage>& images)
|
||||
{
|
||||
if(images.size() < 1)
|
||||
return cv::Mat();
|
||||
return cv::Mat();
|
||||
else if(images.size() == 1)
|
||||
return images[0].image;
|
||||
|
||||
cv::Size outputSize(0,0);
|
||||
cv::Point2i topLeft(std::numeric_limits<int>::max(),std::numeric_limits<int>::max());
|
||||
for(auto& image : images)
|
||||
{
|
||||
if(outputSize.width < image.image.cols+image.origin.x)
|
||||
|
|
@ -195,6 +199,11 @@ cv::Mat simpleStich(const std::vector<RemapedImage>& images)
|
|||
if(outputSize.height < image.image.rows+image.origin.y)
|
||||
outputSize.height = image.image.rows+image.origin.y;
|
||||
|
||||
if(topLeft.x > image.origin.x)
|
||||
topLeft.x = image.origin.x;
|
||||
if(topLeft.y > image.origin.y)
|
||||
topLeft.y = image.origin.y;
|
||||
|
||||
Log(Log::DEBUG)<<"image: "<<image.image.rows<<'x'<<image.image.cols<<" at "<<image.origin.x<<'x'<<image.origin.y;
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +217,10 @@ cv::Mat simpleStich(const std::vector<RemapedImage>& images)
|
|||
image.image.copyTo(out(roi));
|
||||
}
|
||||
|
||||
return out;
|
||||
outputSize.width -= topLeft.x;
|
||||
outputSize.height -= topLeft.y;
|
||||
|
||||
return out(cv::Rect(topLeft, outputSize));
|
||||
}
|
||||
|
||||
cv::Mat stich(const std::vector<RemapedImage>& images, bool seamAdjust)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue