예제 #1
0
/*
Reshape changes shape of the matrix without copying data. A value of `0` means
that channels or rows remain unchanged.
*/
func (m *Mat) Reshape(channels, rows int) *Mat {
	total := m.Cols() * m.Rows()
	n := CreateMat(rows, total/rows, m.Type())
	C.cvReshape(unsafe.Pointer(m), (*C.CvMat)(n), C.int(channels), C.int(rows))
	return n
}
예제 #2
0
/*
Reshape changes shape of the image without copying data. A value of `0` means
that channels or rows remain unchanged.
*/
func (img *IplImage) Reshape(channels, rows, _type int) *Mat {
	total := img.Width() * img.Height()
	header := CreateMat(rows, total/rows, _type)
	n := C.cvReshape(unsafe.Pointer(img), (*C.CvMat)(header), C.int(channels), C.int(rows))
	return (*Mat)(n)
}