예제 #1
0
def MainFunction():
    #CRIEA Start!
    if os.path.exists("Output/"):
        if Init.SystemJudge() == 0:
            os.system("rm -r Output")
        else:
            os.system("rmdir /s /q directory")

    NameArr = Pretreatment.FigureInput(1)
    try:
        if NameArr == -1:
            return
    except:
        pass

    #Figure traversal
    for kase in range(0, len(NameArr)):
        img = np.array(Image.open(NameArr[kase]).convert("L"))
        img = Pretreatment.BFSmooth(img)

        [Tobimg, NodeInfo] = Algorithm.Toboggan(img)
        [Upground, Background] = Algorithm.HandSeed(Tobimg, img, Surround)
        Seeds = Upground | Background
        ProbBlock = []
        VarL = 0

        if Method == "Lap":
            NodeInfo, VarL = Functions.SeedFirst(NodeInfo, Seeds)
            LapEqu = Algorithm.Laplacian(NodeInfo, VarL)
            ProbBlock = Functions.LinearEquation(LapEqu,
                                                 len(NodeInfo) - VarL, VarL)
        """