Implement basic calib3d
This commit is contained in:
parent
032f62c56c
commit
b491ec3c93
5 changed files with 76 additions and 11 deletions
18
AUTHORS
18
AUTHORS
|
|
@ -7,12 +7,12 @@ ChaiShushan <chaishushan@gmail.com>
|
|||
# Forked version authors:
|
||||
Chih-Wei Chang <me@cwchang.me>
|
||||
MohamedHelala <mohamed.helala@gmail.com>
|
||||
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
|
||||
|
|
|
|||
20
README.md
20
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
|
||||
|
||||
|
|
|
|||
38
opencv/calib3d/calib3d.go
Normal file
38
opencv/calib3d/calib3d.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2014 <me@cwchang.me>. 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
|
||||
}
|
||||
9
opencv/calib3d/calib3d_test.go
Normal file
9
opencv/calib3d/calib3d_test.go
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
package calib3d
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestInitIntrinsicParams2D(t *testing.T) {
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2013 jrweizhang AT gmail.com. All rights reserved.
|
||||
// Copyright 2013 <me@cwchang.me>. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue