将下图左右两种不同类型的纹理区域分开,方法输出结果是一幅与该图像等大小的二值图像,左边为0,右边为1,或者相反,灰色边框线在设计的方法中不作考虑,自行去除。
2️⃣实现源码 |
---|
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
from cv2 import cv2
from sklearn.multiclass import OneVsRestClassifier
from sklearn.svm import SVR
from skimage import feature as skft
from PIL import Image,ImageDraw,ImageFont
class Texture():
#n\_point选取中心像素周围的像素点的个数
#radius选取的区域的半径
def \_\_init\_\_(self):
self.radius = 1
self.n_point = self.radius \* 8
#加载灰度图片
def loadPicture(self):
train_index = 0
test_index = 0
train_data = np.zeros((10, 171,