pillow

    1熱度

    1回答

    我嘗試以下,期待看到源圖像的灰度版本: from PIL import Image import numpy as np img = Image.open("img.png").convert('L') arr = np.array(img.getdata()) field = np.resize(arr, (img.size[1], img.size[0])) out = field

    1熱度

    2回答

    在PIL/Pillow中是否有一個函數用於灰度圖像,將圖像分成包含組成原始圖像的組件的子圖像?例如,一個png灰度圖像,其中有一組塊。這裏,圖像類型總是與背景具有高對比度。 我不想使用openCV,我只需要一些常規的斑點檢測,並希望Pillow/PIL可能有這樣做的事情。

    0熱度

    1回答

    我使用Python 2.7,Django 1.9。 我想從這個模型/形式對用戶得到的圖像: models.py from PIL import Image class UserProfile(models.Model): user = models.OneToOneField(User) website = models.URLField(blank=True, null

    1熱度

    1回答

    我讀通過枕頭的圖像並且將其轉換爲numpy的陣列。 A = numpy.asarray(Image.open( ImageNameA).convert("L")) B = numpy.asarray(Image.open( ImageNameB).convert("L")) print A [[255 255 255 ..., 255 255 255]

    0熱度

    2回答

    我正在編寫一個程序,它將圖像轉換爲png並將大小轉換爲512,我想獲得更多輸入。 from PIL import Image import string import random put = input("enter your image path:") im = Image.open(put) size = (512,512) if im.size > size:

    0熱度

    1回答

    下面的函數,一個更大類的一部分工作正常在所有影像上工作得很好,除了這一個 - >http://www.worldbank.org/content/dam/wbr/About/Pres/jyk-hs-offical.png def _fetch_image_size(self, image_url): size = None if '.svg' not in image_url:

    0熱度

    1回答

    此代碼在我的Ubuntu系統上完美工作,但是當我在Windows(7 x64型)上運行它時,圖像不顯示。 此代碼是一個比較複雜的系統,需要枕頭的圖像平滑組合成所需的格式 誰能幫助請的一部分嗎?我可能會缺少依賴或什麼? import wx from PIL import Image class Example(wx.Frame): """ class descripti

    0熱度

    1回答

    我開始使用numpy和PILlow處理圖像文件。而且,當涉及到將圖像轉換爲數組時,通常會放鬆自己,然後再處理數組。 有人可以解釋當我將圖像轉換爲數組時發生了什麼。如: ab = numpy.asarray(img.convert('L')) 而且,爲什麼要轉換爲數組?這提供了什麼功能,我可以用數組做什麼? 感謝

    1熱度

    1回答

    我有點失落,爲什麼發生這種情況將不勝感激。所以我試圖取得圖像的中間值,並從它們中創建一個新圖像,但是當試圖使newpix獲取我的紅色綠色和藍色中值像素的值時,錯誤: TypeError:需要整數(得到類型元組) 發生 from PIL import Image, ImageChops,ImageDraw,ImageFilter import math import glob import o

    0熱度

    1回答

    枕頭可字節數組轉換爲圖像: img = Image.fromarray((data).astype('uint8'), 'P') 但它將是一個灰度圖像。 我知道PIL有img.putpalette(some_palette)方法 如何獲取WEB調色板以將其應用於圖像?