예제 #1
0
def test_hssa_homogeneity_measure():
    """Can we establish homogeneity measure?"""
    hs = loadImage()
    threshold = .5
    limit = 3
    sgm = hssa.HSSA(hs, threshold, limit)
    frame = sgm.heterogenous[0]
    assert frame.homogeneity > 0 and frame.homogeneity < 1
예제 #2
0
def test_limit_hssa():
    """Is HSSA working with limits?"""
    hs = loadImage()
    threshold = .98
    jthreshold = .98
    limit = 4
    sgm = hssa.HSSA(hs, threshold, jthreshold, limit)
    sgm.process()
    assert len(sgm.homogenous) > 0 and len(sgm.heterogenous) == 0
예제 #3
0
def test_hssa_frame_signature():
    """Can we establish frame signature?"""
    hs = loadImage()
    threshold = .5
    limit = 3
    sgm = hssa.HSSA(hs, threshold, limit)
    frame = sgm.heterogenous[0]
    print frame
    assert len(frame.signature) == hs.bands
예제 #4
0
def test_dumb_hssa():
    """Is HSSA working?"""
    hs = loadImage()
    threshold = .98
    jthreshold = .98
    limit = 2
    sgm = hssa.HSSA(hs, threshold, jthreshold, limit)
    while not sgm.isComplete:
        sgm.step()

    assert len(sgm.homogenous) > 0 and len(sgm.heterogenous) == 0
예제 #5
0
def test_hssa_final():
    """Production!"""
    hs = loadImage()
    threshold = .995
    jthreshold = .995
    limit = 6
    sgm = hssa.HSSA(hs, threshold, jthreshold, limit)
    sgm.process()
    sgm.post()
    representation = sgm.representation()
    print len(representation)
예제 #6
0
def test_is_dividing_working():
    """Can we divide a frame properly?"""
    hs = loadImage()
    threshold = .5
    limit = 3
    sgm = hssa.HSSA(hs, threshold, limit)
    frame = sgm.heterogenous[0]

    thirdStageLocations = []
    newFrames = frame.divide()
    newerFrames = []
    for frame in newFrames:
        newerFrames.extend(frame.divide())
    for frame in newerFrames:
        newestFrames = frame.divide()
        for nFrame in newestFrames:
            thirdStageLocations.append(nFrame.location)
    assert sorted(thirdStageLocations) == list(xrange(0, 64))
예제 #7
0
def test_hssa_init():
    """Can we create HSSA?"""
    hs = loadImage()
    threshold = .5
    limit = 3
    hssa.HSSA(hs, threshold, limit)