# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

from 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

# settings for LBP
radius = 1  # LBP算法中范围半径的取值
n_points = 8 * radius # 领域像素点数

# 讀取圖像
image = cv2.imread('road.jpg')
# 显示到plt中，需要从BGR转化到RGB，若是cv2.imshow(win_name, image)，则不需要转化
image1 = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
plt.subplot(111)
plt.imshow(image1)
# 灰階轉換
image = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
plt.subplot(111)
plt.imshow(image, plt.cm.gray)
# lbp處理
lbp = local_binary_pattern(image, n_points, radius)
plt.subplot(111)
plt.imshow(lbp, plt.cm.gray)
# 邊緣提取
#edges = filters.sobel(image)
#plt.subplot(111)
#plt.imshow(edges, plt.cm.gray)
81de619a142ecdb337847df19005e59bf8f26997
<mask token>

<mask token>
plt.subplot(111)
plt.imshow(image1)
<mask token>
plt.subplot(111)
plt.imshow(image, plt.cm.gray)
<mask token>
plt.subplot(111)
plt.imshow(lbp, plt.cm.gray)

<mask token>
radius = 1
n_points = 8 * radius
image = cv2.imread('road.jpg')
image1 = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
plt.subplot(111)
plt.imshow(image1)
image = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
plt.subplot(111)
plt.imshow(image, plt.cm.gray)
lbp = local_binary_pattern(image, n_points, radius)
plt.subplot(111)
plt.imshow(lbp, plt.cm.gray)

<mask token>
from 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
radius = 1
n_points = 8 * radius
image = cv2.imread('road.jpg')
image1 = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
plt.subplot(111)
plt.imshow(image1)
image = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
plt.subplot(111)
plt.imshow(image, plt.cm.gray)
lbp = local_binary_pattern(image, n_points, radius)
plt.subplot(111)
plt.imshow(lbp, plt.cm.gray)

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

from 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

# settings for LBP
radius = 1  # LBP算法中范围半径的取值
n_points = 8 * radius # 领域像素点数

# 讀取圖像
image = cv2.imread('road.jpg')
# 显示到plt中，需要从BGR转化到RGB，若是cv2.imshow(win_name, image)，则不需要转化
image1 = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
plt.subplot(111)
plt.imshow(image1)
# 灰階轉換
image = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
plt.subplot(111)
plt.imshow(image, plt.cm.gray)
# lbp處理
lbp = local_binary_pattern(image, n_points, radius)
plt.subplot(111)
plt.imshow(lbp, plt.cm.gray)
# 邊緣提取
#edges = filters.sobel(image)
#plt.subplot(111)
#plt.imshow(edges, plt.cm.gray)