def create_drawing(path, orig_data=True, stroke_size=None):
     """
     :param path: path to the data file (.txt)
     :return: Drawing object.
     """
     data = Analyzer.get_data_file(path)
     if orig_data:
         pic_path = Analyzer.get_pic_path(path)
     else:
         pic_path = None
         return Drawing(Analyzer.get_strokes(data), pic_path, stroke_size)
     if pic_path is not None:
         return Drawing(Analyzer.get_strokes(data), pic_path, stroke_size)
     else:
         print("Error: missing data")
Example #2
0
    def __init__(self):
        self.width = 10
        self.height = 10
        self.checkers_count = 20
        self.back_field = Drawing(self.width, self.height, 30)

        self.checkers_field = []
        self.fill_checkers_field()
        print(self.checkers_field[0].x + self.checkers_field[0].y)
        self.back_field.draw_checkers(self.checkers_field)
        self.back_field.main()
Example #3
0
    def main():
        print("Composite pattern Shapes..")
        cir1 = Circle()
        cir1.draw("red")
        cir2 = Circle()
        cir2.draw("blue")
        tri1 = Triangle()
        tri1.draw("green")

        drawing = Drawing()
        drawing.add(cir1)
        drawing.add(tri1)
        drawing.draw("yellow")

        drawing.add(cir2)
        drawing.draw("orange")

        drawing.remove(tri1)
        drawing.draw("orange")
Example #4
0
def run():
    filesets = [
        ("data/Notre Dame/1_o.jpg", "data/Notre Dame/1_o-featuresmat.mat"),
        ("data/Notre Dame/2_o.jpg", "data/Notre Dame/2_o-featuresmat.mat"),
        # ("data/duda/img_20170130_162706.jpg", "data/duda/img_20170130_162706-featuresmat.mat"),
        # ("data/duda/c3bxl_zweaywcbm.jpg", "data/duda/c3bxl_zweaywcbm-featuresmat.mat"),
        # ("data/fountain/0000.png", "data/fountain/0000-featuresmat.mat"),
        # ("data/fountain/0001.png", "data/fountain/0001-featuresmat.mat"),
        # ("data/Mount Rushmore/9021235130_7c2acd9554_o.jpg", "data/Mount Rushmore/9021235130_7c2acd9554_o-featuresmat.mat"),
        # ("data/Mount Rushmore/9318872612_a255c874fb_o.jpg","data/Mount Rushmore/9318872612_a255c874fb_o-featuresmat.mat"),
        # ("data/Episcopal Gaudi/3743214471_1b5bbfda98_o.jpg", "data/Episcopal Gaudi/3743214471_1b5bbfda98_o-featuresmat.mat"),
        # ("data/Episcopal Gaudi/4386465943_8cf9776378_o.jpg", "data/Episcopal Gaudi/4386465943_8cf9776378_o-featuresmat.mat"),
    ]

    for fileset in filesets:
        print("=== Files: (%s, %s)" % fileset)
        (imageFilename, featureFilename) = fileset
        basePath, extPath = os.path.splitext(imageFilename)
        sourceImage = sc.ndimage.imread(imageFilename, flatten=True)

        drawing = Drawing()

        # featuresWithOrientation = siftDescriptor(fileset)
        oa = OrientationAssignment()
        (featuresWithOrientation2,
         featuresWithOrientationToDraw) = oa.compute(sourceImage,
                                                     featureFilename)
        drawing.drawFeaturesWithOrientations(imageFilename,
                                             basePath + "-with-features.jpg",
                                             featuresWithOrientationToDraw)

        # Descripting
        fd = FeatureDescripting()
        featuresWithDescriptors = fd.compute(sourceImage,
                                             featuresWithOrientation2)
        fd.saveFeatureDescriptors(basePath + "-features.mat",
                                  featuresWithDescriptors)
Example #5
0
'''
Created on 31 ott 2018

@author: marco
'''

from Drawing import Drawing
from Structure import Structure

dwg = Drawing("panel.dwg")

l = 900
h = 1500

bplst = Structure(dwg, 900, 2100)

bplst.baseStructure()
bplst.basePanel()

dwg.save()

if __name__ == '__main__':
    pass
Example #6
0
from PolygonParser import PolygonParser
from Drawing import Drawing

from Gooey import Gooey
from DrawingWindow import DrawingWindow

d = Drawing()
p = PolygonParser("tricky_polygon.svg", d)

g = Gooey()
dw = DrawingWindow(d)
dw.zoom = 1.0
g.show(dw)

g.start()

def run():
    COMPUTE_ORIENTATION = False
    COMPUTE_DESCRIPTION = False
    COMPUTE_MATCHING = True
    for fileset in filesets:
        print("=== Files: (%s, %s)" % (fileset[0][0], fileset[1][0]))
        # Loading first image
        (imageFilename1, featureFilename1) = fileset[0]
        basePath1 = os.path.splitext(imageFilename1)[0]
        sourceImage1 = sc.ndimage.imread(imageFilename1, flatten=True)

        # Loading second image
        (imageFilename2, featureFilename2) = fileset[1]
        basePath2 = os.path.splitext(imageFilename2)[0]
        sourceImage2 = sc.ndimage.imread(imageFilename2, flatten=True)

        drawing = Drawing()

        # Orientation assignment of first image
        if COMPUTE_ORIENTATION:
            oa1 = OrientationAssignment()
            (featuresWithOrientation1,
             featuresWithOrientationToDraw1) = oa1.compute(
                 sourceImage1, featureFilename1)
            drawing.drawFeaturesWithOrientations(
                imageFilename1, basePath1 + "-with-features.jpg",
                featuresWithOrientationToDraw1)

        # Orientation assignment of second image
        if COMPUTE_ORIENTATION:
            oa2 = OrientationAssignment()
            (featuresWithOrientation2,
             featuresWithOrientationToDraw2) = oa2.compute(
                 sourceImage2, featureFilename2)
            drawing.drawFeaturesWithOrientations(
                imageFilename2, basePath2 + "-with-features.jpg",
                featuresWithOrientationToDraw2)

        # Descripting - 1st img
        featuresPath1 = basePath1 + "-features.mat"
        if COMPUTE_DESCRIPTION:
            fd1 = FeatureDescripting()
            featuresWithDescriptors1 = fd1.compute(sourceImage1,
                                                   featuresWithOrientation1)
            fd1.saveFeatureDescriptors(featuresPath1, featuresWithDescriptors1)

        # Descripting - 2nd img
        featuresPath2 = basePath2 + "-features.mat"
        if COMPUTE_DESCRIPTION:
            fd2 = FeatureDescripting()
            featuresWithDescriptors2 = fd2.compute(sourceImage2,
                                                   featuresWithOrientation2)
            fd2.saveFeatureDescriptors(featuresPath2, featuresWithDescriptors2)

        # Matching
        if COMPUTE_MATCHING:
            fm = FeatureMatching()
            fm.compute(fileset[0][0], fileset[1][0], featuresPath1,
                       featuresPath2)
            fm.drawTopMatches(basePath1 + "-matches.jpg", amount=60)
            if fileset[2]:
                fm.verify(fileset[2])
Example #8
0
def loss_plot():
    drawing = Drawing()
    drawing.draw_loss_plot()
Example #9
0
def accuracy_plot():
    """Rysuje wykres pokazujący stopień dokładności przewidywań sieci"""
    drawing = Drawing()
    drawing.draw_accuracy_plot()