程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了任何人都可以帮我解决我的错误,我刚刚在命令提示符上运行代码时发现了我的错误代码大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决任何人都可以帮我解决我的错误,我刚刚在命令提示符上运行代码时发现了我的错误代码?

开发过程中遇到任何人都可以帮我解决我的错误,我刚刚在命令提示符上运行代码时发现了我的错误代码的问题如何解决?下面主要结合日常开发的经验,给出你关于任何人都可以帮我解决我的错误,我刚刚在命令提示符上运行代码时发现了我的错误代码的解决方法建议,希望对你解决任何人都可以帮我解决我的错误,我刚刚在命令提示符上运行代码时发现了我的错误代码有所启发或帮助;

任何人都可以帮我解决我的错误,我刚刚在命令提示符上运行代码时发现了我的错误代码

这是我的代码:

def feature_extraction(input_filE):

    #Grayscale & Resize
    img = cv2.imread(input_file,cv2.IMREAD_GRAYSCALE)
    #plt.imshow(img,cmap='gray');
    #print('original dimensi:',img.shapE)
    wIDth = 64
    height = 64
    dim = (wIDth,height)
    resized = cv2.resize(img,dim,interpolation = cv2.INTER_AREA)
    #print('resized dimensi:',resized)
    #Histogram
    histogram = np.mean(cv2.calcHist([resized],[0],None,[256],[0,256]))
    #Sobel 
    sobelX = np.mean(cv2.sobel(resized,cv2.CV_64F,1,ksize=5))
    sobelY = np.mean(cv2.sobel(resized,ksize=5))
    #sobelOR = cv2.bitwise_or(sobelX,sobelY) operator gradIEnt untuk
    #menyatukan garis horizontal dan vertikal
    #GLCM
    image = img_as_ubyte(resized)
    bins = np.array([0,16,32,48,64,80,96,112,128,144,160,176,192,208,224,240,255]) #16-bit
    inds = np.digitize(image,bins)
    max_value = inds.max()+1
    matrix_coocurrence = greycomatrix(inds,[1],np.pi/4,np.pi/2,3*np.pi/4],levels=max_value,normed=false,symmetric=falsE)
    contrast = np.mean(contrast_feature(matrix_coocurrencE))
    correlation = np.mean(correlation_feature(matrix_coocurrencE))
    energy = np.mean(energy_feature(matrix_coocurrencE))
    homogeneity = np.mean(homogeneity_feature(matrix_coocurrencE))
    return histogram,sobelX,sobelY,contrast,correlation,energy,homogeneity

"""Folder Jahe"""

features_1 = []
for filename in tqdm(os.Listdir('B:\Bahan kuliah\PROGRAM SKRIPSI\DATASET\Jahe')):
    features_1.append(fileName)
    #Read image
    input_file = ['B:\Bahan kuliah\PROGRAM SKRIPSI\DATASET'];
    #input_file = '/content/drive/MyDrive/SKRIPSI/Dataset/Jahe/'+filename
    features = feature_extraction(input_filE)
    features_1.append(features[0])
    features_1.append(features[1])
    features_1.append(features[2])
    features_1.append(features[3])
    features_1.append(features[4])
    features_1.append(features[5])
    features_1.append(features[6])
    features_1.append(0)
features_1 = np.reshape(features_1,(430,9))
df1 = pd.DataFrame(features_1)
df1.columns = ['name','Hist','SobX','SobY','Cont','Corr','Ener','Homo','Label']
df1

解决方法

在我格式化您的代码时(我无法编辑,因为您没有输入足够的文本来支持您的代码),我发现了错误:

input_file = ['B:\Bahan kuliah\PROGRAM SKRIPSI\DATASET'];

图像中的错误直接与 cv2 在您传递列表时尝试将其解析为字符串有关。要解决此问题,请将其作为字符串传递:

input_file = 'B:\Bahan kuliah\PROGRAM SKRIPSI\DATASET';

请尽力理解您的错误消息及其告诉您的内容。

大佬总结

以上是大佬教程为你收集整理的任何人都可以帮我解决我的错误,我刚刚在命令提示符上运行代码时发现了我的错误代码全部内容,希望文章能够帮你解决任何人都可以帮我解决我的错误,我刚刚在命令提示符上运行代码时发现了我的错误代码所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: