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 }
func GetSize(img *IplImage) Size { sz := C.cvGetSize(unsafe.Pointer(img)) return Size{int(sz.width), int(sz.height)} }
func GetSizeHeight(img *IplImage) int { size := C.cvGetSize(unsafe.Pointer(img)) w := int(size.height) return w }
/* 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 }