示例#1
0
func main() {
	fmt.Println("Hello World!")
	text := C.CString("Hello World!")
	defer C.free(unsafe.Pointer(text))
	C.cvNamedWindow(text, 1)
	img := unsafe.Pointer(C.cvCreateImage(C.cvSize(640, 480), C.IPL_DEPTH_8U, 1))
	C.cvSet(img, C.cvScalar(0, 0, 0, 0), nil)
	var font C.CvFont
	C.cvInitFont(&font, C.CV_FONT_HERSHEY_SIMPLEX|C.CV_FONT_ITALIC,
		1.0, 1.0, 0, 1, 8)
	C.cvPutText(img, text, C.cvPoint(200, 400), &font,
		C.cvScalar(255, 255, 0, 0))
	C.cvShowImage(text, img)
	C.cvWaitKey(0)
}
示例#2
0
/* Sets every element of an array to a given value. */
func (img *IplImage) Set(value Scalar) {
	C.cvSet(unsafe.Pointer(img), (C.CvScalar)(value), nil)
}