Example #1
0
 def test_slant_extremely_reclined(self):
     assert SlantAnalyser.analyzeSlant(
         [135])[0]["slantType"] == "extremely reclined"
     assert SlantAnalyser.analyzeSlant(
         [129])[0]["slantType"] == "extremely reclined"
     assert SlantAnalyser.analyzeSlant(
         [180])[0]["slantType"] == "extremely reclined"
Example #2
0
 def test_slant_extremely_inclined(self):
     assert SlantAnalyser.analyzeSlant(
         [45])[0]["slantType"] == "extremely inclined"
     assert SlantAnalyser.analyzeSlant(
         [52])[0]["slantType"] == "extremely inclined"
     assert SlantAnalyser.analyzeSlant(
         [0])[0]["slantType"] == "extremely inclined"
Example #3
0
 def test_slant_very_reclined(self):
     assert SlantAnalyser.analyzeSlant(
         [120])[0]["slantType"] == "very reclined"
     assert SlantAnalyser.analyzeSlant(
         [113])[0]["slantType"] == "very reclined"
     assert SlantAnalyser.analyzeSlant(
         [128])[0]["slantType"] == "very reclined"
Example #4
0
 def test_slant_very_inclined(self):
     assert SlantAnalyser.analyzeSlant(
         [60])[0]["slantType"] == "very inclined"
     assert SlantAnalyser.analyzeSlant(
         [53])[0]["slantType"] == "very inclined"
     assert SlantAnalyser.analyzeSlant(
         [67])[0]["slantType"] == "very inclined"
Example #5
0
def onChange(pos):
    global img
    global gray
    global dst

    dst = np.copy(img)

    width, height = img.shape[:2]

    linesGap = cv2.getTrackbarPos("Distance between lines", "Result")
    angle = cv2.getTrackbarPos("Angle", "Result")

    a = np.tan(angle * 2 * np.pi / 360)

    print a

    print width
    print linesGap
    print np.arange(0, 2 * width, int(linesGap))

    for i in np.arange(-5 * width, 5 * width, int(linesGap)):
        x1 = i
        y1 = 0
        x2 = int((height + a * x1) / a)
        y2 = height
        cv2.line(dst, (x1, y1), (x2, y2), (0, 255, 0), 2)

    analysis = SlantAnalyser.analyzeSlant([180 - angle])

    print analysis[0]["slantType"]
    print analysis[0]["analysis"]
Example #6
0
    def onChange(self):
        self.angleCount.setNum(self.angleSlider.value())
        self.distanceCount.setNum(self.distanceSlider.value())

        img = cv2.imread("samples/sample1.png", -1)
        linesGap = self.distanceSlider.value()
        angle = self.angleSlider.value()

        a = np.tan(angle * 2 * np.pi / 360)

        width, height = img.shape[:2]

        for i in np.arange(-5 * width, 5 * width, int(linesGap)):
            x1 = i
            y1 = 0
            x2 = int((height + a * x1) / a)
            y2 = height
            cv2.line(img, (x1, y1), (x2, y2), (0, 255, 0), 2)

        analysis = SlantAnalyser.analyzeSlant([180 - angle])

        self.analysis.setText(analysis[0]["slantType"] + '\n' +
                              analysis[0]["analysis"])

        height, width, channel = img.shape
        bytesPerLine = 3 * width
        qImg = QtGui.QImage(img.data, width, height, bytesPerLine,
                            QtGui.QImage.Format_RGB888)
        qPixToCover = QtGui.QPixmap.fromImage(qImg)
        self.mainPicture.setPixmap(qPixToCover)
Example #7
0
 def test_slant_inclined(self):
     assert SlantAnalyser.analyzeSlant([75])[0]["slantType"] == "inclined"
     assert SlantAnalyser.analyzeSlant([68])[0]["slantType"] == "inclined"
     assert SlantAnalyser.analyzeSlant([82])[0]["slantType"] == "inclined"
Example #8
0
 def test_slant_vertical(self):
     assert SlantAnalyser.analyzeSlant([90])[0]["slantType"] == "vertical"
     assert SlantAnalyser.analyzeSlant([83])[0]["slantType"] == "vertical"
     assert SlantAnalyser.analyzeSlant([97])[0]["slantType"] == "vertical"
Example #9
0
 def test_slant_reclined(self):
     assert SlantAnalyser.analyzeSlant([105])[0]["slantType"] == "reclined"
     assert SlantAnalyser.analyzeSlant([98])[0]["slantType"] == "reclined"
     assert SlantAnalyser.analyzeSlant([112])[0]["slantType"] == "reclined"