def runtraininganalysis(arr,coor):
    left=coor[1]
    right=coor[3]
    top=coor[0]
    bottom=coor[2]
    features=[]
    if bottom-top>4 and right-left>4:
        image=arr[top:bottom,left:right]
        image=arrayToImage(image)
        g=imageTransforms.gaussblur(image)
        gauss={}
        gauss[RGB]=Imagetoarray(g)
        gauss[grayscale]=Imagetoarray(imageTransforms.grayScale(g))
        del g
        features.append(calculatefeatures(gauss))
        s=imageTransforms.smooth(image)
        smooth={}
        smooth[RGB]=Imagetoarray(s)
        smooth[grayscale]=Imagetoarray(imageTransforms.grayScale(s))
        features.append(calculatefeatures(smooth))
        del s
        s=imageTransforms.sharpen(image)
        sharpen={}
        sharpen[RGB]=Imagetoarray(s)
        sharpen[grayscale]=Imagetoarray(imageTransforms.grayScale(s))
        features.append(calculatefeatures(sharpen))
        normal={}
        normal[RGB]=Imagetoarray(image)
        normal[grayscale]=Imagetoarray(imageTransforms.grayScale(image))
        features.append(calculatefeatures(normal))
    if features:
        return features
    else:
        return None
def getImageClass(w,imgs,size=8):
    x,y,step = getWalkerParameters(w,size,factor=1)
    p = .9*size*size
    z=mode(w.ravel())[0][0]
    IC = ImageClass()
    for j in x:
        for i in y:
            try:
                img = w[i:i+step,j:j+step]
                m = mode(img.ravel())
                c=m[1][0]
                m=m[0][0]
                if c > p and m!=z:
                    print i,i+step,j,j+step,m,c,p
                    IC.addVector(int(m),calculatefeatures(imgs,left=j,right=j+step,top=i+step,bottom=i))
                else:
                    print i,i+step,j,j+step,"skipped",m,c,p
            except:
                print i,i+step,j,j+step,"failed"
    return IC