::warpRoi(Size src_size, const Mat &K, const Mat &R)
{
projector_.**setCameraParams**(K, R);
Point dst_tl, dst_br;
**detectResultRoi**(src_size, dst_tl, dst_br);
return Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1));
}
The code of projector_.**setCameraParams**(K, R):( warper_inl.hpp )
void ProjectorBase::setCameraParams(const Mat &K, const Mat &R, const Mat &T)
{
CV_Assert(K.size() == Size(3, 3) && K.type() == CV_32F);
CV_Assert(R.size() == Size(3, 3) && R.type() == CV_32F);
CV_Assert((T.size() == Size(1, 3) || T.size() == Size(3, 1)) && T.type() == CV_32F);
Mat_ ::detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
{
float tl_uf = std::numeric_limits
In the opencv module (stitch_detail.cpp):
warper->warp(img, K, cameras[img_idx].R, INTER_LINEAR, BORDER_REFLECT, img_warped);
**Img_warped** is the output image, **img** is the input image. With the **cameras[img_idx].R** , we can compute the rotation of each axis :theta_x, theta_y, theta_z. But how to compute the translation of each axis? Does anybody has some tips?
As far as I know, the **cameras[img_idx].t** does not contain the translation information. I had modified the t, but nothing happen.
(stitch_detail.cpp):
if (blender.empty())
{
blender = Blender::createDefault(0, try_gpu);
Size dst_sz = resultRoi(corners, sizes).size();
float blend_width = sqrt(static_cast(dst_sz.area())) * 5 / 100.f;
if (blend_width < 1.f)
blender = Blender::createDefault(Blender::NO, try_gpu);
**blender->prepare(corners, sizes);**
}
// Blend the current image
blender->feed(img_warped_s, mask_warped, corners[img_idx]);
I find corners and sizes can influence the result. The corners is a `vector`, it is a set of the left-and-top points of sub-images. The sizes is a `vector`, it is a set of the size of each sub-image. They are modified in **warper->warpRoi** (stitch_detail.cpp)
// Update corner and size
Size sz = full_img_sizes[i];
if (std::abs(compose_scale - 1) > 1e-1)
{
sz.width = cvRound(full_img_sizes[i].width * compose_scale);
sz.height = cvRound(full_img_sizes[i].height * compose_scale);
}
Mat K;
cameras[i].K().convertTo(K, CV_32F);
**Rect roi = warper->warpRoi(sz, K, cameras[i].R); //**
corners[i] = roi.tl();
sizes[i] = roi.size();
}
The code of warper->warpRoi:( warper_inl.hpp )
template
Rect RotationWarperBase