func (roi *IplROI) ToRect() Rect { r := C.cvRect( C.int(roi.XOffset()), C.int(roi.YOffset()), C.int(roi.Width()), C.int(roi.Height()), ) return Rect(r) }
func Crop(src *IplImage, x, y, width, height int) *IplImage { r := C.cvRect(C.int(x), C.int(y), C.int(width), C.int(height)) rect := Rect(r) src.SetROI(rect) dest := CreateImage(width, height, src.Depth(), src.Channels()) Copy(src, dest, nil) src.ResetROI() return dest }