면책 조항 : 프로그래밍에 익숙하지 않습니다. 이 기능을 하나의 출력이 2다른 함수에 함수의 반환 값 python
def img_to_color(path_file):
# takes an image and calculates avg red/green/blue value
color_avg = [red, green, blue]
return color_avg
def extract_RGB(path_folder):
j = 0
RGB = []
file_count = len(os.listdir(path_folder))
files = os.listdir(path_folder)
while j < file_count:
img_to_color(path_folder + "/" + files[j])
RGB.append(color_avg)
j = j+1
X_training.append(trainingDataFolder(pfad, RGB))
그러나 RGB 내가 함수를 호출에도 불구하고 [] 유지 작동 img_to_color 기능을 작동하도록 전달되지 않습니다 보인다 다음 코드는 작동하지 않습니다.
이 X_training''무엇입니까? 선언 된 곳은 어디입니까? 'red','green','blue'도 마찬가지입니다. –
빨강, 초록, 파랑의 계산을 제외하고 더 짧게 만들었습니다. 이 함수는 정상적으로 작동합니다. X_training도 존재합니다 (글로벌로 선언되었습니다). –