當前位置: 首頁>>代碼示例>>Python>>正文


Python Image.ROTATE_270屬性代碼示例

本文整理匯總了Python中PIL.Image.ROTATE_270屬性的典型用法代碼示例。如果您正苦於以下問題:Python Image.ROTATE_270屬性的具體用法?Python Image.ROTATE_270怎麽用?Python Image.ROTATE_270使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在PIL.Image的用法示例。


在下文中一共展示了Image.ROTATE_270屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def __init__(self, config, comm, CameraModule):

        super().__init__()

        self._comm = comm
        self._cfg = config
        self._cam = CameraModule

        self._cap = None
        self._pic_dims = None

        self._is_preview = self._cfg.getBool('Photobooth', 'show_preview')
        self._is_keep_pictures = self._cfg.getBool('Storage', 'keep_pictures')

        rot_vals = {0: None, 90: Image.ROTATE_90, 180: Image.ROTATE_180,
                    270: Image.ROTATE_270}
        self._rotation = rot_vals[self._cfg.getInt('Camera', 'rotation')] 
開發者ID:reuterbal,項目名稱:photobooth,代碼行數:19,代碼來源:__init__.py

示例2: to_column_format

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def to_column_format(self, high_density_vertical=True):
        """
        Extract slices of an image as equal-sized blobs of column-format data.

        :param high_density_vertical: Printed line height in dots
        """
        im = self._im.transpose(Image.ROTATE_270).transpose(Image.FLIP_LEFT_RIGHT)
        line_height = 24 if high_density_vertical else 8
        width_pixels, height_pixels = im.size
        top = 0
        left = 0
        while left < width_pixels:
            box = (left, top, left + line_height, top + height_pixels)
            im_slice = im.transform((line_height, height_pixels), Image.EXTENT, box)
            im_bytes = im_slice.tobytes()
            yield(im_bytes)
            left += line_height 
開發者ID:python-escpos,項目名稱:python-escpos,代碼行數:19,代碼來源:image.py

示例3: image

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def image(self, im):
        for p in range(8):
            pr = self.im.crop((0,8*p,128,8*p+8)).transpose(Image.ROTATE_270)
            bb = im.crop((0,8*p,128,8*p+8)).transpose(Image.ROTATE_270)
            diff = ImageChops.difference(pr, bb)
            di = diff.getbbox()
            if di is not None:
                (x0, y0, x1, y1) = di
                self.command(COLUMNADDR)
                self.command(y0)
                self.command(y1 - 1)
                self.command(PAGEADDR)
                self.command(p)
                self.command(p + 1)
                self.i2.start(self.a, 0)
                self.i2.write([0x40])
                self.i2.write(bb.tobytes()[y0:y1])
                self.i2.stop()
        self.im = im
        self.command(DISPLAYON) 
開發者ID:jamesbowman,項目名稱:i2cdriver,代碼行數:22,代碼來源:oled.py

示例4: rotate_image

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def rotate_image(imagedata, clockwise = True):
    """
    Rotate an image. 
    clockwise: Rotate 90 degrees clockwise, if false rotates anticlockwise
    """
    try:
        inputd = asm3.utils.bytesio(imagedata)
        im = Image.open(inputd)
        if clockwise:
            im = im.transpose(Image.ROTATE_270)
        else:
            im = im.transpose(Image.ROTATE_90)
        output = asm3.utils.bytesio()
        im.save(output, "JPEG")
        rotated_data = output.getvalue()
        output.close()
        return rotated_data
    except Exception as err:
        asm3.al.error("failed rotating image: %s" % str(err), "media.rotate_image")
        return imagedata 
開發者ID:bobintetley,項目名稱:asm3,代碼行數:22,代碼來源:media.py

示例5: get_tta_patterns

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def get_tta_patterns(src, n):
    src_lr = src.transpose(Image.FLIP_LEFT_RIGHT)
    patterns = [
        [src, None],
        [src.transpose(Image.ROTATE_90), inv(-90)],
        [src.transpose(Image.ROTATE_180), inv(-180)],
        [src.transpose(Image.ROTATE_270), inv(-270)],
        [src_lr, inv(0, True)],
        [src_lr.transpose(Image.ROTATE_90), inv(-90, True)],
        [src_lr.transpose(Image.ROTATE_180), inv(-180, True)],
        [src_lr.transpose(Image.ROTATE_270), inv(-270, True)],
    ]
    if n == 2:
        return [patterns[0], patterns[4]]
    elif n == 4:
        return [patterns[0], patterns[2], patterns[4], patterns[6]]
    elif n == 8:
        return patterns
    return [patterns[0]] 
開發者ID:tsurumeso,項目名稱:waifu2x-chainer,代碼行數:21,代碼來源:reconstruct.py

示例6: eval_angle

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def eval_angle(im,detectAngle=False):
    """
    估計圖片偏移角度
    @@param:im
    @@param:detectAngle 是否檢測文字朝向
    """
    angle = 0
    img = np.array(im)
    if detectAngle:
        angle = angle_detect(img=np.copy(img))##文字朝向檢測
        if angle==90:
            im = Image.fromarray(im).transpose(Image.ROTATE_90)
        elif angle==180:
            im = Image.fromarray(im).transpose(Image.ROTATE_180)
        elif angle==270:
            im = Image.fromarray(im).transpose(Image.ROTATE_270)
        img = np.array(im)
        
    return  angle,img 
開發者ID:bing1zhi2,項目名稱:chinese_ocr,代碼行數:21,代碼來源:model.py

示例7: __init__

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def __init__(self, p, degree):
        """Creates an `JointRandomRotation` instance.

        Args:
          p: the probability for rotating.
        """

        self.p = p

        methods = {90: Image.ROTATE_90, 180: Image.ROTATE_180, 270: Image.ROTATE_270}

        if degree not in methods.keys():
            raise NotImplementedError("We only support multiple of 90 degree rotations for now")

        self.method = methods[degree] 
開發者ID:mapbox,項目名稱:robosat,代碼行數:17,代碼來源:transforms.py

示例8: rotate

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def rotate(self, image, target, link, contour, angle):

		if angle == 0:
			if link is None:
				return image, target, contour
			return image, target, link, contour

		elif angle == 90:
			image = image.transpose(Image.ROTATE_90)
			target = target.transpose(Image.ROTATE_90)
			link = np.rot90(link)

			contour_f = self.contour_rotate(contour, 90, image.size[0], image.size[1])

		elif angle == 180:

			image = image.transpose(Image.ROTATE_180)
			target = target.transpose(Image.ROTATE_180)
			link = np.rot90(np.rot90(link))
			contour_f = self.contour_rotate(contour, 180, image.size[1], image.size[0])

		elif angle == 270:
			image = image.transpose(Image.ROTATE_270)
			target = target.transpose(Image.ROTATE_270)
			link = np.rot90(np.rot90(np.rot90(link)))
			contour_f = self.contour_rotate(contour, 270, image.size[0], image.size[1])

		if link is None:
				return image, target, contour_f

		return image, target, link, contour_f 
開發者ID:mayank-git-hub,項目名稱:Text-Recognition,代碼行數:33,代碼來源:dete_loader.py

示例9: rotate

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def rotate(self, img, rot):
        if rot == 0:
            img_rt = img
        elif rot == 90:
            img_rt = img.transpose(Image.ROTATE_90)
        elif rot == 180:
            img_rt = img.transpose(Image.ROTATE_180)
        elif rot == 270:
            img_rt = img.transpose(Image.ROTATE_270)
        else:
            raise ValueError('Rotation angles should be in [0, 90, 180, 270]')
        return img_rt 
開發者ID:Jiaolong,項目名稱:self-supervised-da,代碼行數:14,代碼來源:rotate_dataset.py

示例10: test_rotate_270_deg

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def test_rotate_270_deg(self):
        self._test_rotate(270, Image.ROTATE_270) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:4,代碼來源:test_image_transform.py

示例11: test_copy_alpha_channel

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def test_copy_alpha_channel(self):
        g = Image.linear_gradient('L')
        im = Image.merge('RGBA', [g, g.transpose(Image.ROTATE_90),
                                  g.transpose(Image.ROTATE_180),
                                  g.transpose(Image.ROTATE_270)])

        self.assert_image_equal(im, im._new(
            im.im.color_lut_3d('RGBA', Image.LINEAR,
                               *self.generate_identity_table(3, 17)))) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:11,代碼來源:test_color_lut.py

示例12: mask_L

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def mask_L(self):
        return self.gradient_L.transpose(Image.ROTATE_270) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:4,代碼來源:test_image_paste.py

示例13: gradient_RGBA

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def gradient_RGBA(self):
        return Image.merge('RGBA', [
            self.gradient_L,
            self.gradient_L.transpose(Image.ROTATE_90),
            self.gradient_L.transpose(Image.ROTATE_180),
            self.gradient_L.transpose(Image.ROTATE_270),
        ]) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_image_paste.py

示例14: gradient_RGBa

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def gradient_RGBa(self):
        return Image.merge('RGBa', [
            self.gradient_L,
            self.gradient_L.transpose(Image.ROTATE_90),
            self.gradient_L.transpose(Image.ROTATE_180),
            self.gradient_L.transpose(Image.ROTATE_270),
        ]) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:9,代碼來源:test_image_paste.py

示例15: __init__

# 需要導入模塊: from PIL import Image [as 別名]
# 或者: from PIL.Image import ROTATE_270 [as 別名]
def __init__(self, fps=16, skip_frames=2, scale_factor=1, rotate=0, rawrgb_path=None, **kwargs):
        """
        :param fps: Frames per seconds (default: 16)
        :param skip_frames: Number of frames to be skipped on sensor initialization/warmup (default: 2)
        :param scale_factor: The camera outputs 24x32 pixels artifacts. Use scale_factor to scale them up to a larger
            image (default: 1)
        :param rotate: Rotation angle in degrees (default: 0)
        :param rawrgb_path: Specify it if the rawrgb executable compiled from
            https://github.com/pimoroni/mlx90640-library is in another folder than
            `<directory of this file>/lib/examples`.
        """
        from PIL import Image
        super().__init__(**kwargs)

        self._rotate_values = {
            90: Image.ROTATE_90,
            180: Image.ROTATE_180,
            270: Image.ROTATE_270,
        }

        if not rawrgb_path:
            rawrgb_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib', 'examples', 'rawrgb')
        rawrgb_path = os.path.abspath(os.path.expanduser(rawrgb_path))

        assert fps > 0
        assert skip_frames >= 0
        assert os.path.isfile(rawrgb_path)

        self.fps = fps
        self.rotate = rotate
        self.skip_frames = skip_frames
        self.scale_factor = scale_factor
        self.rawrgb_path = rawrgb_path
        self._capture_proc = None 
開發者ID:BlackLight,項目名稱:platypush,代碼行數:36,代碼來源:__init__.py


注:本文中的PIL.Image.ROTATE_270屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。