作者:mottall
项目:go-c
func imageFromIplImage(iplImage *C.IplImage) (*Image, error) {
image := new(Image)
image.ptr = unsafe.Pointer(iplImage)
image.iplImage = iplImage
image.Initialized = true
size := C.cvGetSize(image.ptr)
image.size = Size{int(size.width), int(size.height)}
image.imtype = typeFromDepthAndChannels(iplImage.depth, iplImage.nChannels)
if image.imtype.NumChannels == 1 {
image.colorModel = color.GrayModel
} else if image.imtype.NumChannels == 3 {
image.colorModel = color.RGBAModel
} else {
panic("Unsupported image type - Unsupported number of channels")
}
return image, nil
}
作者:tonycomin
项目:go-opencv-
func GetSize(img *IplImage) Size {
sz := C.cvGetSize(unsafe.Pointer(img))
return Size{int(sz.width), int(sz.height)}
}
作者:tonycomin
项目:go-opencv-
func GetSizeHeight(img *IplImage) int {
size := C.cvGetSize(unsafe.Pointer(img))
w := int(size.height)
return w
}
作者:tonycomin
项目:go-opencv-
/* Returns width and height of array in elements */
func GetSizeWidth(img *IplImage) int {
size := C.cvGetSize(unsafe.Pointer(img))
w := int(size.width)
return w
}