小编Kva*_*Dub的帖子

如何在 Python 中在图像上编写线条和网格?

import numpy as np
from matplotlib import cm
from matplotlib import pyplot as plt
import Image
from scipy import ndimage
import Image, ImageDraw
import PIL
import cv
import cv2
from scipy.ndimage import measurements, morphology
from PIL import Image
from numpy import *
from scipy.ndimage import filters
import pylab
import mahotas
from mamba import*
import mambaDraw
from PIL import Image, ImageDraw

img = np.asarray(Image.open('test.tif').convert('L'))
img = 1 * (img < 127)

draw = ImageDraw.Draw(img) 
draw.line((100,200, 150,300), fill=128)

plt.imshow(img, cmap=cm.Greys_r)
plt.show()
Run Code Online (Sandbox Code Playgroud)

我想在图像上放置一些网格线,但出现以下错误: …

python opencv image matplotlib python-imaging-library

0
推荐指数
1
解决办法
5233
查看次数