示例#1
0
    def test_distortion(self):
        epsilon = 10e-4
        # Conformal projections should have maximum angular distortion
        # equal to 0 and linear distortion equal to 1.0.  
        mad, ld, ad = di.distortion(merc, lam, phi)[1:]
        self.assertAlmostEqual(mad, 0.0, places=6)
        self.assertAlmostEqual(ld, 1.0, places=6)

        # Area preserving projections should have area distortion
        # equal to 1.0.  
        mad, ld, ad = di.distortion(cea, lam, phi)[1:]
        self.assertAlmostEqual(ad, 1.0, places=6)

        # Degrees mode output should agree with radians mode output.
        get = di.distortion(cea_ed, lam_deg, phi_deg)
        expect = list(di.distortion(cea_e, lam, phi))
        # Entry 1 is an angular measurement.
        expect[1] = rad2deg(expect[1])
        for i in range(len(expect)):
            self.assertAlmostEqual(get[i], expect[i])
示例#2
0
文件: detector.py 项目: prk3128/test
import cv2
import client
import morph
import hough
import distortion as dist

Trans = client.TrasnferClient()
Morph = morph.morph()
Hough = hough.hough(50,100)
Dist = dist.distortion()

#bright = cv2.imread("./bright.jpg")
#bright = cv2.cvtColor(bright,cv2.COLOR_BGR2GRAY)

#width, height = bright.shape[:2]

#for i in range(width):
#    for j in range(height):
#        bright[i, j] = 255-bright[i, j]

p=0
q=0

# construct camera object
cam = cv2.VideoCapture(0)

while(True) :
    ret, img = cam.read()

    #img = cv2.imread('001_crack.jpg')
#    q += 1
示例#3
0
import cv2
import numpy as np
import distortion
import auto_canny as auto
import hough
import newlib

kernel = np.ones((3, 3), np.uint8)
Hough = hough.hough()
Dist = distortion.distortion()

cam = cv2.VideoCapture(0)

while (cam.isOpened()):
    I1 = []
    I2 = []
    I3 = []
    count = 0

    ret, img = cam.read()

    img = Dist.Undistort(img)

    img = img[90:340, 175:425]

    h, w = img.shape[:2]

    img_h = Hough.HoughDetect(img)
    img_h = cv2.morphologyEx(img_h, cv2.MORPH_CLOSE, kernel, iterations=1)

    npic_1 = np.zeros((h, w), dtype=np.float32)