Como filtrar apenas a linha mais longa após a transformação Hough

Atualmente, estou usando o Hough Transform para obter as linhas retas. Mas há muitas linhas detectadas. Posso saber como filtrar e obter apenas a linha mais longa da saída?

      HoughLinesP(dst, lines, 1, CV_PI/180, 50, 20, 10 ); //left lane

      for( size_t i = 0; i < lines.size(); i++ )
      {
        Vec4i l = lines[i];
        double theta1,theta2, hyp, result;

        theta1 = (l[3]-l[1]);
        theta2 = (l[2]-l[0]);
        hyp = hypot(theta1,theta2);

        line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(255,0,0), 3, CV_AA);

        }

      imshow("detected lines", cdst);

}

questionAnswers(1)

yourAnswerToTheQuestion