최근에는 이미지로 기계 학습을 좀 더 구체적으로 배우는 기계에 관심이 있었지만 이미지를 처리 할 수 있어야합니다. 이미지 처리 라이브러리가 어떻게 작동하는지 더 철저하게 이해하고 싶습니다. 그래서 이해할 수있는 이미지를 읽을 수있는 자체 라이브러리를 만들기로 결정했습니다.Go에 변수를 다차원 배열 크기로 넣을 수없는 이유는 무엇입니까?
package main
import (
// "fmt"
// "os"
)
// This function reads a dimension of an image you would use it like readImageDimension("IMAGENAME.PNG", "HEIGHT")
func readImageDimension(path string, which string) int{
var dimensionyes int
if(which == "" || which == " "){
panic ("You have not entered which dimension you want to have.")
} else if (which == "Height" || which == "HEIGHT" || which == "height" || which == "h" || which =="H"){
//TODO: Insert code for reading the Height of the image
return dimensionyes
} else if (which == "Width" || which == "WIDTH" || which == "width" || which == "w" || which =="W"){
//TODO: Insert code for reading the Width of the image
return dimensionyes
} else {
panic("Dimension type not recognized.")
}
}
func addImage(path string, image string, Height int, Width int){
var Size int
Size = Width * Height
var Pix [Size][3]int
}
func main() {
}
:
./imageProcessing.go:33:11: non-constant array bound Size
이 내 코드입니다 : 그러나, 나는이 이미지의 SIZE 읽기에 올 때 내가 컴파일 할 때이 오류가 팝업 등의 문제를 갖고있는 것 같다
나는 Go로 프로그래밍을 막 시작 했으므로이 문제가 nooby로 들리면 유감이다.