Ask Your Question

dufferdev's profile - activity

2016-01-19 12:19:24 -0500 received badge  Teacher (source)
2015-11-30 00:07:44 -0500 received badge  Enthusiast
2015-11-23 11:11:17 -0500 answered a question How to find angle between two images

You can try finding the orientation of both the images using moments. Using the two orientation you can find the angle by taking the difference between them .

cv::Point3d findOrientation(const cv::Mat& src){
      cv::Moments m = cv::moments(src, true);
      double cen_x=m.m10/m.m00;
      double cen_y=m.m01/m.m00;
     double m_11= 2*m.m11-m.m00*(cen_x*cen_x+cen_y*cen_y);// m.mu11/m.m00;    
     double m_02=m.m02-m.m00*cen_y*cen_y;// m.mu02/m.m00;
     double m_20=m.m20-m.m00*cen_x*cen_x;//m.mu20/m.m00;    
     double theta = m_20==m_02?0:atan2(m_11, m_20-m_02)/2.0;
    //  theta = (theta / PI) * 180.0; //if you want in radians.(or vice versa, not sure)
    return cv::Point3d(cen_x,cen_y,theta);


I am returning the following: (x,y)(center of mass) and theta (orientation)

2015-11-23 01:17:00 -0500 asked a question Super resolution outputs blank green frames.

I am trying to do super-resolution using OpenCV 2.4.10. Here are the main steps in the task .

    const int scale = 2;
const int iterations = 5;
const int temporalAreaRadius = 4;
cv::Ptr<cv::superres::DenseOpticalFlowExt> of = cv::superres::createOptFlow_DualTVL1();

cv::Ptr<cv::superres::SuperResolution> super_res=cv::superres::createSuperResolution_BTVL1();
super_res->set("scale", scale);
super_res->set("iterations", iterations);
super_res->set("temporalAreaRadius", temporalAreaRadius);

 for(int i = 0; i < SKIP; ++i)
cv::VideoWriter writer;

std::cout<<"starting SR"<<std::endl;
for(int i=0;;++i){
    std::cout<<"processing frame :"<<i<<std::endl;
    cv::Mat result;
    if (!writer.isOpened())
  , CV_FOURCC('X', 'V', 'I', 'D'), 25.0, result.size());
    writer << result;    

While the program executes error free, in the output all i am getting are blank green frames. Could anybody point me as why that is happening?