def test_convert(self): ic1 = ImageContainer(Image()) ci = ConvertImage.create('ci', 'bypass') ic2 = ci.convert(ic1) nt.assert_not_equal(ic1, ic2) nt.assert_not_equal(ic1.c_pointer, ic2.c_pointer) nt.assert_equal(hex(mem_address(ic1.c_pointer)), hex(mem_address(ic2.c_pointer)))
def convert(self, image_container): """ :param image_container: The image container with image data to convert :type image_container: ImageContainer :return: A new ImageContainer with the converted underlying data :rtype: ImageContainer """ ci_convert = self.MAPTK_LIB["maptk_algorithm_convert_image_convert"] ci_convert.argtypes = [self.C_TYPE_PTR, ImageContainer.C_TYPE_PTR, MaptkErrorHandle.C_TYPE_PTR] ci_convert.restype = ImageContainer.C_TYPE_PTR with MaptkErrorHandle() as eh: return ImageContainer.from_c_pointer(ci_convert(self, image_container, eh))
def convert(self, image_container): """ :param image_container: The image container with image data to convert :type image_container: ImageContainer :return: A new ImageContainer with the converted underlying data :rtype: ImageContainer """ ci_convert = self.MAPTK_LIB['maptk_algorithm_convert_image_convert'] ci_convert.argtypes = [self.C_TYPE_PTR, ImageContainer.C_TYPE_PTR, MaptkErrorHandle.C_TYPE_PTR] ci_convert.restype = ImageContainer.C_TYPE_PTR with MaptkErrorHandle() as eh: return ImageContainer.from_c_pointer( ci_convert(self, image_container, eh) )
def load(self, filepath): """ Load an image into a ImageContainer :param filepath: Path to the image to load :type filepath: str :return: New ImageContainer containing the loaded image :rtype: ImageContainer """ iio_load = self.MAPTK_LIB.maptk_algorithm_image_io_load iio_load.argtypes = [self.C_TYPE_PTR, ctypes.c_char_p, MaptkErrorHandle.C_TYPE_PTR] iio_load.restype = ImageContainer.C_TYPE_PTR with MaptkErrorHandle() as eh: ic_ptr = iio_load(self, filepath, eh) return ImageContainer.from_c_pointer(ic_ptr)
def test_height(self): i = Image(720, 480) ic = ImageContainer(i) nose.tools.assert_equal(ic.height(), 480)
def test_width(self): i = Image(720, 480) ic = ImageContainer(i) nose.tools.assert_equal(ic.width(), 720)
def test_size(self): i = Image(720, 480) ic = ImageContainer(i) nose.tools.assert_equal(ic.size(), 720 * 480)
def test_new(self): image = Image() img_c = ImageContainer(image) image = Image(100, 100) img_c = ImageContainer(image)