背景
运行环境
- Mac OS
- Python3.0
- Anaconda3(集成了很多包,浏览器界面编程,清爽)
步骤
导入包
1
2
3
4
5
6
7
8
9from skimage.transform import rotate
from skimage.feature import local_binary_pattern
from skimage import data, io,data_dir,filters, feature
from skimage.color import label2rgb
import skimage
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import cv2
参数设置
1 | # settings for LBP |
图像读取
1 | # 读取图像 |
灰度转换
1 | image = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY) |
LBP处理
1 | lbp = local_binary_pattern(image, n_points, radius) |
边缘提取
1 | edges = filters.sobel(image) |
此致,敬礼