0
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
img = np.asarray(Image.open('test.tif').convert('L')) #read and convert image
img = 1 * (img < 127) # threshold
plt.imshow(img, cmap=cm.Greys_r) # show as black and white
plt.show()
上面的代碼給出了黑色背景上的白色像素,如何計算圖像上的白色區域,然後將圖像分割成100個矩形,並找到具有最小值,最大值和平均像素數的矩形?謝謝如何使用Python計算圖像上的彩色像素區域?
你能否請告知如何計算兩個區域之間的距離,其中最小和最大白色像素在裏面?謝謝,我在讀你的書 – KvasDub