Beispiel #1
0
func (img *Image) ScalarAt(pos ...int) Scalar {
	n := len(pos)
	var s C.CvScalar
	if n == 1 {
		s = C.cvGet1D(img.ptr, C.int(pos[0]))
	} else if n == 2 {
		s = C.cvGet2D(img.ptr, C.int(pos[0]), C.int(pos[1]))
	} else if n == 3 {
		s = C.cvGet3D(img.ptr, C.int(pos[0]), C.int(pos[1]), C.int(pos[2]))
	}

	return Scalar{float64(s.val[0]), float64(s.val[1]), float64(s.val[2]), float64(s.val[3])}
}
Beispiel #2
0
/* Get1D return a specific element from a 1-dimensional matrix. */
func (m *Mat) Get1D(x int) Scalar {
	ret := C.cvGet1D(unsafe.Pointer(m), C.int(x))
	return Scalar(ret)
}
Beispiel #3
0
/* Get1D return a specific element from a 1-dimensional matrix. */
func (img *IplImage) Get1D(x int) Scalar {
	ret := C.cvGet1D(unsafe.Pointer(img), C.int(x))
	return Scalar(ret)
}