diff --git a/AUTHORS b/AUTHORS index fcb511b..810f970 100644 --- a/AUTHORS +++ b/AUTHORS @@ -7,12 +7,12 @@ ChaiShushan # Forked version authors: Chih-Wei Chang MohamedHelala -Adrian Zankich <> -vanillahsu <> -Alexander Kirillov <> -Aditya Bhargava <> -Bradley Griffiths <> -Ashkan Kiani <> -Peter Bui <> -satojkovic <> -TEE JIA HEN <> +Adrian Zankich +vanillahsu +Alexander Kirillov +Aditya Bhargava +Bradley Griffiths +Ashkan Kiani +Peter Bui +satojkovic +TEE JIA HEN diff --git a/README.md b/README.md index c8ef54f..8074be0 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,29 @@ go get code.google.com/p/go-opencv/trunk/opencv cd ${GoOpenCVRoot}/trunk/samples && go run hellocv.go ``` +## Usage + +Currently there are no too many readily instruction for usage. At this point, you can always refers to OpenCV's documentation. I'll try to keep all the bindings have the same signature as in OpenCV's C interface. However, please do note that sometimes the signature might slightly differ from the C interface due to Golang's type declaration conventions, for example: + +``` +# The original signature in C interface. +void cvInitIntrinsicParams2D( +const CvMat* object_points, const CvMat* image_points, +const CvMat* npoints, CvSize image_size, CvMat* camera_matrix, +double aspect_ratio=1. ) + +# We might put all *Mat types together, however +func InitIntrinsicParams2D(objectPoints, imagePoints, nPoints, cameraMatrix *Mat ... + +# Or we might use "explicitly return" instead of C-style's pointer +func InitIntrinsicParams2D(objectPoints, imagePoints, nPoints, *Mat ...) (cameraMatrix *Mat) +``` + ## TODOs - [ ] Better documents - [ ] Split the big package into sub-packages corresponding to the modules described in [OpenCV API Reference](http://docs.opencv.org/modules/core/doc/intro.html) -- [ ] Clean up the codes +- [ ] Clean up the codes with better coding style ## Example diff --git a/opencv/calib3d/calib3d.go b/opencv/calib3d/calib3d.go new file mode 100644 index 0000000..ee02884 --- /dev/null +++ b/opencv/calib3d/calib3d.go @@ -0,0 +1,38 @@ +// Copyright 2014 . All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Bindings for OpenCV's Calib3d (Camera Calibration +// and 3D Reconstruction) module +package calib3d + +//#include "../opencv.h" +//#cgo linux pkg-config: opencv +//#cgo darwin pkg-config: opencv +//#cgo freebsd pkg-config: opencv +//#cgo windows LDFLAGS: -lopencv_core242.dll -lopencv_imgproc242.dll -lopencv_photo242.dll -lopencv_highgui242.dll -lstdc++ +import "C" +import "unsafe" + +/* +void cvInitIntrinsicParams2D( +const CvMat* object_points, const CvMat* image_points, +const CvMat* npoints, CvSize image_size, CvMat* camera_matrix, +double aspect_ratio=1. ) +*/ + +func InitIntrinsicParams2D(objPoints, imgPoints, nPoints *Mat, imgWidth, imgHeight int, aspectRatio float64) (cameraMatrix *Mat) { + cameraMatrix = CreateMat(3, 3, CV_64F) + + size := C.cvSize(C.int(imgWidth), C.int(imgHeight)) + + C.cvInitIntrinsicParams2D( + unsafe.Pointer(objPoints), + unsafe.Pointer(imgPoints), + unsafe.Pointer(nPoints), + size, + unsafe.Pointer(cameraMatrix), + aspectRatio) + + return cameraMatrix +} diff --git a/opencv/calib3d/calib3d_test.go b/opencv/calib3d/calib3d_test.go new file mode 100644 index 0000000..34bfa8c --- /dev/null +++ b/opencv/calib3d/calib3d_test.go @@ -0,0 +1,9 @@ +package calib3d + +import ( + "testing" +) + +func TestInitIntrinsicParams2D(t *testing.T) { + +} diff --git a/opencv/imgproc.go b/opencv/imgproc.go index 90ebb5c..93b8070 100644 --- a/opencv/imgproc.go +++ b/opencv/imgproc.go @@ -1,4 +1,4 @@ -// Copyright 2013 jrweizhang AT gmail.com. All rights reserved. +// Copyright 2013 . All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.