Pythonilla tolppaan - osa 2

 sunnuntai, 30. lokakuu 2016
Pythonilla tolppaan - osa 2

import cv2
import numpy as np
from matplotlib import pyplot as plt

img = cv2.imread('img_cpl.jpg', 0)
ret,trunc = cv2.threshold(img, 61, 255, cv2.THRESH_TRUNC)
ret,tozeroinv = cv2.threshold(img, 127, 255, cv2.THRESH_TOZERO_INV)

titles = ['Original','TRUNC','TOZERO_INV']
images = [img, trunc, tozeroinv]

for i in xrange(3):
    plt.subplot(1, 3, i+1), plt.imshow(images[i], 'gray')
    plt.title(titles[i])
    plt.xticks([]),plt.yticks([])

plt.show()

Kuva otettu Hoya PL-CIR pyöröpolarisaatiosuotimella. Tolpassa on kamera.

Alkuperäinen


Trunc




Tozero_inv




import cv2
import numpy as np
from matplotlib import pyplot as plt

img = cv2.imread('img.jpg',0)
can = cv2.Canny(img,10,200)

plt.subplot(121),plt.imshow(can,cmap = 'gray')
plt.title('Edge image'), plt.xticks([]), plt.yticks([])

plt.show()










Comments

Popular posts from this blog

Modifying old SDR# TETRA demod plug-in

Mods for SDR# TETRA demod plugin 1.0.14.0 - 2