Skip to content

Instantly share code, notes, and snippets.

@paulocoutinhox
Created February 20, 2017 16:50
Show Gist options
  • Save paulocoutinhox/cc216198f49b7c5aa5268eb736a0d7e4 to your computer and use it in GitHub Desktop.
Save paulocoutinhox/cc216198f49b7c5aa5268eb736a0d7e4 to your computer and use it in GitHub Desktop.
Sample Go program showing integration with image-detect library
package main
/*
#cgo pkg-config: opencv
#cgo CFLAGS: -I/Users/paulo/Developer/workspaces/cpp/image-detect/lib/include -I/usr/include
#cgo LDFLAGS: -L/Users/paulo/Developer/workspaces/cpp/image-detect/build -limage-detect
#include "image-detect.h"
*/
import "C"
import (
"log"
"os"
)
func main() {
imageDetectHome := os.Getenv("IMAGE_DETECT_HOME")
screenImagePath := imageDetectHome + "/extras/images/screen.png"
detectImagePath := imageDetectHome + "/extras/images/detect.png"
outputImagePath := imageDetectHome + "/extras/images/diff.png"
result := C.process(C.String(screenImagePath), C.String(detectImagePath), C.String(outputImagePath))
log.Print(result)
}
@paulocoutinhox
Copy link
Author

Error that i get:

go build go-sample/main.go
# command-line-arguments
In file included from go-sample/main.go:7:
In file included from /Users/paulo/Developer/workspaces/cpp/image-detect/lib/include/image-detect.h:1:
In file included from /usr/local/include/opencv2/opencv.hpp:61:
In file included from /usr/local/include/opencv2/video/video.hpp:47:
/usr/local/include/opencv2/video/background_segm.hpp:47:10: fatal error: 'list' file not found
#include <list>
         ^
1 error generated.
make: *** [build-go-sample] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment