Kotlin: error on converting mat to bitmap

public static void rectangle(Mat img,
                             Point pt1,
                             Point pt2,
                             Scalar color)

How do I convert a Rect object to point p1, point pt2. so that my bouding box get displayed?