def filtering(filterType, img_Eq, param1, param2):
        if filterType == 'bilateral':
            img_filtered= cv2.bilateralFilter(img_Eq,param1,param2,param2) 
        if filterType == 'anisotropic':
            img_filtered = ad(img_Eq, niter=param2,step= param1, kappa=50,gamma=0.10, option=1)
            img_filtered=np.uint8(img_filtered)# if not frangi does not accept img_filtered because it is float between -1 and 1  
        if filterType == 'guided':
            img_filtered = guidedFilter(img_Eq, img_Eq, param1, param2)
        return img_filtered   
Esempio n. 2
0
            cv2.imwrite(str(im) + '_Frangi_bl_.tif', img_fr_roi)

            #save the data
            with open(str(im) + '_Frangi_bl_classification_results.txt',
                      'w') as output:
                output.write(str(perform_result))

        if (index == 1):
            v = []
            #Anisotropic
            for i in range(len(param_ad[0])):
                for j in range(len(param_ad[1])):
                    #Anisotropic Diffusion
                    img_filtered = ad(img_Eq,
                                      niter=param_ad[0][i],
                                      step=param_ad[1][j],
                                      kappa=50,
                                      gamma=0.10,
                                      option=1)
                    img_filtered = np.uint8(
                        img_filtered
                    )  # if not frangi does not accept img_filtered because it is float between -1 and 1

                    v.append(
                        img_as_ubyte(
                            frangi(img_filtered, (1.0, 2.1),
                                   0.5,
                                   0.5,
                                   0.125,
                                   black_ridges=True)))

            img_fr = v[0]