Пример #1
0
 def __call__(array, offset=(0, 0)):
     from gamera.plugins import _string_io
     from gamera.core import Dim
     pixel_type = from_numeric._check_input(array)
     return _string_io._from_raw_string(
         offset, Dim(array.shape[1], array.shape[0]), pixel_type, DENSE,
         array.tostring())
Пример #2
0
 def __call__(array, offset=None):
     from gamera.plugins import _string_io
     from gamera.core import Point, Dim
     if offset is None:
         offset = Point(0, 0)
     pixel_type = from_numarray._check_input(array)
     return _string_io._from_raw_string(
         offset, Dim(array.shape[1], array.shape[0]), pixel_type, DENSE,
         array.tostring())
Пример #3
0
 def __call__(array, offset=(0, 0)):
     from gamera.plugins import _string_io
     from gamera.core import Dim
     pixel_type = from_numpy._check_input(array)
     return _string_io._from_raw_string(
         offset,
         Dim(array.shape[1], array.shape[0]),
         pixel_type, DENSE,
         array.tostring())
Пример #4
0
 def __call__(array, offset=None):
     from gamera.plugins import _string_io
     from gamera.core import Point, Dim
     if offset is None:
         offset = Point(0, 0)
     pixel_type = from_numarray._check_input(array)
     return _string_io._from_raw_string(
         offset,
         Dim(array.shape[1], array.shape[0]),
         pixel_type, DENSE,
         array.tostring())
Пример #5
0
    def __call__(image, offset=None):
        from gamera.plugins import _string_io
        from gamera.core import Dim, Point, RGBPixel

        if offset is None:
            offset = Point(0, 0)
        if isinstance(image, cv.cvmat):
            imgcv = cv.CloneMat(image)
            cv.CvtColor(image, imgcv, cv.CV_BGR2RGB)
            return _string_io._from_raw_string(offset,
                                               Dim(imgcv.cols, imgcv.rows),
                                               RGB, DENSE, imgcv.tostring())
        elif isinstance(image, cv.iplimage):
            imgcv = cv.CreateImage(cv.GetSize(image), image.depth,
                                   image.channels)
            cv.CvtColor(image, imgcv, cv.CV_BGR2RGB)
            return _string_io._from_raw_string(offset,
                                               Dim(imgcv.width, imgcv.height),
                                               RGB, DENSE, imgcv.tostring())
        else:
            raise TypeError("Image must be of type cv.cvmat or cv.iplimage")
Пример #6
0
 def __call__(image, offset=None):
     from gamera.plugins import _string_io
     from gamera.core import Dim, Point
     typecode = image.mode
     if offset is None:
         offset = Point(0, 0)
     if typecode in _inverse_modes:
         pixel_type = _inverse_modes[typecode]
     else:
         raise ValueError(
             "Only RGB and 8-bit Greyscale 'L' PIL image modes are supported."
         )
     try:
         return _string_io._from_raw_string(
             offset, Dim(image.size[0], image.size[1]), pixel_type,
             DENSE, image.tobytes())
     except Exception:
         # for compatibility with pil 1.1.7 and earlier
         return _string_io._from_raw_string(
             offset, Dim(image.size[0], image.size[1]), pixel_type,
             DENSE, image.tostring())
Пример #7
0
 def __call__(image, offset=None):
     from gamera.plugins import _string_io
     from gamera.core import Dim, Point
     typecode = image.mode
     if offset is None:
         offset = Point(0, 0)
     if _inverse_modes.has_key(typecode):
         pixel_type = _inverse_modes[typecode]
     else:
         raise ValueError("Only RGB and 8-bit Greyscale 'L' PIL image modes are supported.")
     try:
         return _string_io._from_raw_string(
             offset,
             Dim(image.size[0], image.size[1]),
             pixel_type, DENSE,
             image.tobytes())
     except Exception:
         # for compatibility with pil 1.1.7 and earlier
         return _string_io._from_raw_string(
             offset,
             Dim(image.size[0], image.size[1]),
             pixel_type, DENSE,
             image.tostring())
Пример #8
0
 def __call__(image, offset=None):
     from gamera.plugins import _string_io
     from gamera.core import Dim, Point
     typecode = image.mode
     if offset is None:
         offset = Point(0, 0)
     if _inverse_modes.has_key(typecode):
         pixel_type = _inverse_modes[typecode]
     else:
         raise ValueError(
             "Only RGB and 8-bit Greyscale 'L' PIL image modes are supported."
         )
     return _string_io._from_raw_string(
         offset, Dim(image.size[0], image.size[1]), pixel_type, DENSE,
         image.tostring())
Пример #9
0
 def __call__(image, offset=None):
     from gamera.plugins import _string_io
     from gamera.core import Dim, Point, RGBPixel
     
     if offset is None:
       offset = Point(0, 0)
     if isinstance(image,cv.cvmat):
       imgcv = cv.CloneMat(image)
       cv.CvtColor(image, imgcv, cv.CV_BGR2RGB)
       return  _string_io._from_raw_string(
         offset, 
         Dim(imgcv.cols,imgcv.rows), 
         RGB, DENSE, 
         imgcv.tostring())
     elif isinstance(image,cv.iplimage):
       imgcv = cv.CreateImage(cv.GetSize(image), image.depth, image.channels)
       cv.CvtColor(image, imgcv, cv.CV_BGR2RGB)
       return _string_io._from_raw_string(
         offset, 
         Dim(imgcv.width,imgcv.height), 
         RGB, DENSE, 
         imgcv.tostring())
     else:
       raise TypeError("Image must be of type cv.cvmat or cv.iplimage")