Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Convert image to cylindrical shape.

Hi,

I will try to convert my image to cylindrical shape,I am using objective c,

Here I am using below code, but getting same image without curved,

 cv::Mat cylindricalimg (Mat img)
 {
   cv::Mat dst;
   cv::Mat dstback;

   Ptr<WarperCreator> warper_creator;
   warper_creator = makePtr<CylindricalWarper>();

   Mat k=(Mat_<float>(3,3) <<2, 0, 0,  0, 1, -0,   0,0,0.001);
   Mat r=(Mat_<float>(3,3) << 1, 0, 0,    0,  1, 0,    0, 0,1);

   Ptr<detail::RotationWarper> warper=warper_creator->create(static_cast<float>(1000));
   warper->warp(img, k, r, INTER_LINEAR, BORDER_REFLECT, dst);
   warper->warpBackward(dst, k, r, INTER_LINEAR, BORDER_REFLECT, img.size(),dstback);

   return dstback;
 }

Please let me know where I have done mistake?

Thanks, In advance.

Convert image to cylindrical shape.

Hi,

I will try to convert my image to cylindrical shape,I am using objective c,

Here I am using below code, but getting same image without curved,

 cv::Mat cylindricalimg (Mat img)
 {
   //with img object i got the original image
   cv::Mat dst;
   cv::Mat dstback;

   Ptr<WarperCreator> warper_creator;
   warper_creator = makePtr<CylindricalWarper>();

   Mat k=(Mat_<float>(3,3) <<2, 0, 0,  0, 1, -0,   0,0,0.001);
   Mat r=(Mat_<float>(3,3) << 1, 0, 0,    0,  1, 0,    0, 0,1);

   Ptr<detail::RotationWarper> warper=warper_creator->create(static_cast<float>(1000));
   warper->warp(img, k, r, INTER_LINEAR, BORDER_REFLECT, dst);
   warper->warpBackward(dst, k, r, INTER_LINEAR, BORDER_REFLECT, img.size(),dstback);

   return dstback;
 }

Please let me know where I have done mistake?

Thanks, In advance.