Exemplo n.º 1
0
    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)))
Exemplo n.º 2
0
    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))
Exemplo n.º 3
0
    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)
            )
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
 def test_height(self):
     i = Image(720, 480)
     ic = ImageContainer(i)
     nose.tools.assert_equal(ic.height(), 480)
Exemplo n.º 6
0
 def test_width(self):
     i = Image(720, 480)
     ic = ImageContainer(i)
     nose.tools.assert_equal(ic.width(), 720)
Exemplo n.º 7
0
 def test_size(self):
     i = Image(720, 480)
     ic = ImageContainer(i)
     nose.tools.assert_equal(ic.size(), 720 * 480)
Exemplo n.º 8
0
 def test_height(self):
     i = Image(720, 480)
     ic = ImageContainer(i)
     nose.tools.assert_equal(ic.height(), 480)
Exemplo n.º 9
0
 def test_width(self):
     i = Image(720, 480)
     ic = ImageContainer(i)
     nose.tools.assert_equal(ic.width(), 720)
Exemplo n.º 10
0
 def test_size(self):
     i = Image(720, 480)
     ic = ImageContainer(i)
     nose.tools.assert_equal(ic.size(), 720 * 480)
Exemplo n.º 11
0
    def test_new(self):
        image = Image()
        img_c = ImageContainer(image)

        image = Image(100, 100)
        img_c = ImageContainer(image)