判断点是否在矩形框内(C++ OpenCV)

bool DoesRectangleContainPoint(cv::RotatedRect rectangle, cv::Point2f point)
{
    //转化为轮廓
    cv::Point2f corners[4];
    rectangle.points(corners);
    cv::Point2f* lastItemPointer = (corners + sizeof corners / sizeof corners[0]);
    std::vector<cv::Point2f> contour(corners, lastItemPointer);
    //判断
    double indicator = cv::pointPolygonTest(contour, point, true);
    if (indicator >= 0) return true;
    else return false;
}