示例#1
0
文件: image.go 项目: mottalli/go-cv
/******* Rotate *******/
func (img *Image) RotateTo(dest *Image, angle float64) {
	dest.InitializeAs(img)

	center := C.CvPoint2D32f{C.float(img.Size().Width / 2), C.float(img.Size().Height / 2)}
	var rot *C.CvMat = C.cvCreateMat(2, 3, C.CV_32F)
	defer C.cvReleaseMat(&rot)
	C.cv2DRotationMatrix(center, C.double(angle), C.double(1.0), rot)

	C.cvWarpAffine(img.ptr, dest.ptr, rot, C.CV_INTER_LINEAR+C.CV_WARP_FILL_OUTLIERS, C.cvScalarAll(C.double(0.0)))
}
示例#2
0
/* Releases CvMat header and deallocates matrix data
   (reference counting is used for data) */
func (mat *Mat) Release() {
	mat_c := (*C.CvMat)(mat)
	C.cvReleaseMat(&mat_c)
}