go fmt
This commit is contained in:
parent
d24c14b7e6
commit
0087f832bc
13 changed files with 940 additions and 983 deletions
16
opencv/cv.go
16
opencv/cv.go
|
|
@ -23,7 +23,6 @@ const (
|
||||||
CV_BLUR = C.CV_BLUR
|
CV_BLUR = C.CV_BLUR
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
/* Smoothes array (removes noise) */
|
/* Smoothes array (removes noise) */
|
||||||
func Smooth(src, dst *IplImage, smoothtype,
|
func Smooth(src, dst *IplImage, smoothtype,
|
||||||
param1, param2 int, param3, param4 float64) {
|
param1, param2 int, param3, param4 float64) {
|
||||||
|
|
@ -31,6 +30,7 @@ func Smooth(src, dst *IplImage, smoothtype,
|
||||||
C.int(param1), C.int(param2), C.double(param3), C.double(param4),
|
C.int(param1), C.int(param2), C.double(param3), C.double(param4),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
//CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst,
|
//CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst,
|
||||||
// int smoothtype CV_DEFAULT(CV_GAUSSIAN),
|
// int smoothtype CV_DEFAULT(CV_GAUSSIAN),
|
||||||
// int param1 CV_DEFAULT(3),
|
// int param1 CV_DEFAULT(3),
|
||||||
|
|
@ -42,15 +42,9 @@ func Smooth(src, dst *IplImage, smoothtype,
|
||||||
func CvtColor(src, dst *IplImage, code int) {
|
func CvtColor(src, dst *IplImage, code int) {
|
||||||
C.cvCvtColor(unsafe.Pointer(src), unsafe.Pointer(dst), C.int(code))
|
C.cvCvtColor(unsafe.Pointer(src), unsafe.Pointer(dst), C.int(code))
|
||||||
}
|
}
|
||||||
|
|
||||||
//CVAPI(void) cvCvtColor( const CvArr* src, CvArr* dst, int code );
|
//CVAPI(void) cvCvtColor( const CvArr* src, CvArr* dst, int code );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Runs canny edge detector */
|
/* Runs canny edge detector */
|
||||||
func Canny(image, edges *IplImage, threshold1, threshold2 float64, aperture_size int) {
|
func Canny(image, edges *IplImage, threshold1, threshold2 float64, aperture_size int) {
|
||||||
C.cvCanny(unsafe.Pointer(image), unsafe.Pointer(edges),
|
C.cvCanny(unsafe.Pointer(image), unsafe.Pointer(edges),
|
||||||
|
|
@ -58,10 +52,10 @@ func Canny(image, edges *IplImage, threshold1, threshold2 float64, aperture_size
|
||||||
C.int(aperture_size),
|
C.int(aperture_size),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
//CVAPI(void) cvCanny( const CvArr* image, CvArr* edges, double threshold1,
|
//CVAPI(void) cvCanny( const CvArr* image, CvArr* edges, double threshold1,
|
||||||
// double threshold2, int aperture_size CV_DEFAULT(3) );
|
// double threshold2, int aperture_size CV_DEFAULT(3) );
|
||||||
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CV_INPAINT_NS = C.CV_INPAINT_NS
|
CV_INPAINT_NS = C.CV_INPAINT_NS
|
||||||
CV_INPAINT_TELEA = C.CV_INPAINT_TELEA
|
CV_INPAINT_TELEA = C.CV_INPAINT_TELEA
|
||||||
|
|
@ -77,8 +71,6 @@ func Inpaint(src, inpaint_mask, dst *IplImage, inpaintRange float64, flags int)
|
||||||
C.int(flags),
|
C.int(flags),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
//CVAPI(void) cvInpaint( const CvArr* src, const CvArr* inpaint_mask,
|
//CVAPI(void) cvInpaint( const CvArr* src, const CvArr* inpaint_mask,
|
||||||
// CvArr* dst, double inpaintRange, int flags );
|
// CvArr* dst, double inpaintRange, int flags );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,86 +10,61 @@ package opencv
|
||||||
//#cgo windows LDFLAGS: -lopencv_core242.dll -lopencv_imgproc242.dll -lopencv_photo242.dll -lopencv_highgui242.dll -lstdc++
|
//#cgo windows LDFLAGS: -lopencv_core242.dll -lopencv_imgproc242.dll -lopencv_photo242.dll -lopencv_highgui242.dll -lstdc++
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Eigen objects *
|
* Eigen objects *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* 1D/2D HMM *
|
* 1D/2D HMM *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*********************************** Embedded HMMs *************************************/
|
/*********************************** Embedded HMMs *************************************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* A few functions from old stereo gesture recognition demosions *
|
* A few functions from old stereo gesture recognition demosions *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Additional operations on Subdivisions *
|
* Additional operations on Subdivisions *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* More operations on sequences *
|
* More operations on sequences *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*******************************Stereo correspondence*************************************/
|
/*******************************Stereo correspondence*************************************/
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
/************ Epiline functions *******************/
|
/************ Epiline functions *******************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Contour Morphing *
|
* Contour Morphing *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Texture Descriptors *
|
* Texture Descriptors *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Face eyes&mouth tracking *
|
* Face eyes&mouth tracking *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* 3D Tracker *
|
* 3D Tracker *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Skeletons and Linear-Contour Models *
|
* Skeletons and Linear-Contour Models *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Background/foreground segmentation *
|
* Background/foreground segmentation *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Calibration engine *
|
* Calibration engine *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************\
|
/*****************************************************************************\
|
||||||
* --- END --- *
|
* --- END --- *
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ func (img *IplImage)Release() {
|
||||||
/* Creates a copy of IPL image (widthStep may differ) */
|
/* Creates a copy of IPL image (widthStep may differ) */
|
||||||
func (img *IplImage) Clone() *IplImage {
|
func (img *IplImage) Clone() *IplImage {
|
||||||
p := C.cvCloneImage((*C.IplImage)(img))
|
p := C.cvCloneImage((*C.IplImage)(img))
|
||||||
return (*IplImage)(p);
|
return (*IplImage)(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sets a Channel Of Interest (only a few functions support COI) -
|
/* Sets a Channel Of Interest (only a few functions support COI) -
|
||||||
|
|
@ -80,6 +80,7 @@ func (img *IplImage)Clone() *IplImage {
|
||||||
func (img *IplImage) SetCOI(coi int) {
|
func (img *IplImage) SetCOI(coi int) {
|
||||||
C.cvSetImageCOI((*C.IplImage)(img), C.int(coi))
|
C.cvSetImageCOI((*C.IplImage)(img), C.int(coi))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieves image Channel Of Interest */
|
/* Retrieves image Channel Of Interest */
|
||||||
func (img *IplImage) GetCOI() int {
|
func (img *IplImage) GetCOI() int {
|
||||||
coi := C.cvGetImageCOI((*C.IplImage)(img))
|
coi := C.cvGetImageCOI((*C.IplImage)(img))
|
||||||
|
|
@ -90,10 +91,12 @@ func (img *IplImage)GetCOI() int {
|
||||||
func (img *IplImage) SetROI(rect Rect) {
|
func (img *IplImage) SetROI(rect Rect) {
|
||||||
C.cvSetImageROI((*C.IplImage)(img), C.CvRect(rect))
|
C.cvSetImageROI((*C.IplImage)(img), C.CvRect(rect))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resets image ROI and COI */
|
/* Resets image ROI and COI */
|
||||||
func (img *IplImage) ResetROI() {
|
func (img *IplImage) ResetROI() {
|
||||||
C.cvResetImageROI((*C.IplImage)(img))
|
C.cvResetImageROI((*C.IplImage)(img))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieves image ROI */
|
/* Retrieves image ROI */
|
||||||
func (img *IplImage) GetROI() Rect {
|
func (img *IplImage) GetROI() Rect {
|
||||||
r := C.cvGetImageROI((*C.IplImage)(img))
|
r := C.cvGetImageROI((*C.IplImage)(img))
|
||||||
|
|
@ -112,6 +115,7 @@ func CreateMatHeader(rows, cols, type_ int) *Mat {
|
||||||
)
|
)
|
||||||
return (*Mat)(mat)
|
return (*Mat)(mat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocates and initializes CvMat header and allocates data */
|
/* Allocates and initializes CvMat header and allocates data */
|
||||||
func CreateMat(rows, cols, type_ int) *Mat {
|
func CreateMat(rows, cols, type_ int) *Mat {
|
||||||
mat := C.cvCreateMat(
|
mat := C.cvCreateMat(
|
||||||
|
|
@ -144,6 +148,7 @@ func (mat *Mat)Release() {
|
||||||
func DecRefData(arr Arr) {
|
func DecRefData(arr Arr) {
|
||||||
C.cvDecRefData(unsafe.Pointer(arr))
|
C.cvDecRefData(unsafe.Pointer(arr))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Increments CvMat data reference counter */
|
/* Increments CvMat data reference counter */
|
||||||
func IncRefData(arr Arr) {
|
func IncRefData(arr Arr) {
|
||||||
C.cvIncRefData(unsafe.Pointer(arr))
|
C.cvIncRefData(unsafe.Pointer(arr))
|
||||||
|
|
@ -165,6 +170,7 @@ func GetSubRect(arr Arr, submat *Mat, rect Rect) *Mat {
|
||||||
)
|
)
|
||||||
return (*Mat)(mat_new)
|
return (*Mat)(mat_new)
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define cvGetSubArr cvGetSubRect
|
//#define cvGetSubArr cvGetSubRect
|
||||||
|
|
||||||
/* Selects row span of the input array: arr(start_row:delta_row:end_row,:)
|
/* Selects row span of the input array: arr(start_row:delta_row:end_row,:)
|
||||||
|
|
@ -249,7 +255,7 @@ func CreateMatNDHeader(sizes []int, type_ int) *MatND {
|
||||||
mat := C.cvCreateMatNDHeader(
|
mat := C.cvCreateMatNDHeader(
|
||||||
dims, (*C.int)(&sizes_c[0]), C.int(type_),
|
dims, (*C.int)(&sizes_c[0]), C.int(type_),
|
||||||
)
|
)
|
||||||
return (*MatND)(mat);
|
return (*MatND)(mat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocates and initializes CvMatND header and allocates data */
|
/* Allocates and initializes CvMatND header and allocates data */
|
||||||
|
|
@ -263,7 +269,7 @@ func CreateMatND(sizes []int, type_ int) *MatND {
|
||||||
mat := C.cvCreateMatND(
|
mat := C.cvCreateMatND(
|
||||||
dims, (*C.int)(&sizes_c[0]), C.int(type_),
|
dims, (*C.int)(&sizes_c[0]), C.int(type_),
|
||||||
)
|
)
|
||||||
return (*MatND)(mat);
|
return (*MatND)(mat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializes preallocated CvMatND header */
|
/* Initializes preallocated CvMatND header */
|
||||||
|
|
@ -305,7 +311,7 @@ func CreateSparseMat(sizes []int, type_ int) *SparseMat {
|
||||||
mat := C.cvCreateSparseMat(
|
mat := C.cvCreateSparseMat(
|
||||||
dims, (*C.int)(&sizes_c[0]), C.int(type_),
|
dims, (*C.int)(&sizes_c[0]), C.int(type_),
|
||||||
)
|
)
|
||||||
return (*SparseMat)(mat);
|
return (*SparseMat)(mat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Releases CvSparseMat */
|
/* Releases CvSparseMat */
|
||||||
|
|
@ -360,6 +366,7 @@ func GetSize(img *IplImage) Size {
|
||||||
func Copy(src, dst, mask *IplImage) {
|
func Copy(src, dst, mask *IplImage) {
|
||||||
C.cvCopy(unsafe.Pointer(src), unsafe.Pointer(dst), unsafe.Pointer(mask))
|
C.cvCopy(unsafe.Pointer(src), unsafe.Pointer(dst), unsafe.Pointer(mask))
|
||||||
}
|
}
|
||||||
|
|
||||||
//CVAPI(void) cvCopy( const CvArr* src, CvArr* dst,
|
//CVAPI(void) cvCopy( const CvArr* src, CvArr* dst,
|
||||||
// const CvArr* mask CV_DEFAULT(NULL) );
|
// const CvArr* mask CV_DEFAULT(NULL) );
|
||||||
|
|
||||||
|
|
@ -367,51 +374,41 @@ func Copy(src, dst, mask *IplImage) {
|
||||||
func Zero(img *IplImage) {
|
func Zero(img *IplImage) {
|
||||||
C.cvSetZero(unsafe.Pointer(img))
|
C.cvSetZero(unsafe.Pointer(img))
|
||||||
}
|
}
|
||||||
|
|
||||||
//CVAPI(void) cvSetZero( CvArr* arr );
|
//CVAPI(void) cvSetZero( CvArr* arr );
|
||||||
//#define cvZero cvSetZero
|
//#define cvZero cvSetZero
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Arithmetic, logic and comparison operations *
|
* Arithmetic, logic and comparison operations *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/* dst(idx) = ~src(idx) */
|
/* dst(idx) = ~src(idx) */
|
||||||
func Not(src, dst *IplImage) {
|
func Not(src, dst *IplImage) {
|
||||||
C.cvNot(unsafe.Pointer(src), unsafe.Pointer(dst))
|
C.cvNot(unsafe.Pointer(src), unsafe.Pointer(dst))
|
||||||
}
|
}
|
||||||
|
|
||||||
//CVAPI(void) cvNot( const CvArr* src, CvArr* dst );
|
//CVAPI(void) cvNot( const CvArr* src, CvArr* dst );
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Math operations *
|
* Math operations *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Matrix operations *
|
* Matrix operations *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Array Statistics *
|
* Array Statistics *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Discrete Linear Transforms and Related Functions *
|
* Discrete Linear Transforms and Related Functions *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Dynamic data structures *
|
* Dynamic data structures *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Drawing *
|
* Drawing *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
@ -433,19 +430,10 @@ func Line(image *IplImage, pt1, pt2 Point, color Scalar, thickness, line_type, s
|
||||||
// CvScalar color, int thickness CV_DEFAULT(1),
|
// CvScalar color, int thickness CV_DEFAULT(1),
|
||||||
// int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
|
// int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* System functions *
|
* System functions *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Data Persistence *
|
* Data Persistence *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,3 @@ import (
|
||||||
func TestLoadImage2(t *testing.T) {
|
func TestLoadImage2(t *testing.T) {
|
||||||
// t.Errorf("aaa")
|
// t.Errorf("aaa")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ import (
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
// cvver.h
|
// cvver.h
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -561,7 +560,6 @@ type Point3D32f struct {
|
||||||
Z float32
|
Z float32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type Point2D64f struct {
|
type Point2D64f struct {
|
||||||
X float64
|
X float64
|
||||||
Y float64
|
Y float64
|
||||||
|
|
@ -677,4 +675,3 @@ type AttrList C.CvAttrList
|
||||||
/*****************************************************************************\
|
/*****************************************************************************\
|
||||||
* --- END --- *
|
* --- END --- *
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,3 @@
|
||||||
|
|
||||||
// Bindings for Intel's OpenCV computer vision library.
|
// Bindings for Intel's OpenCV computer vision library.
|
||||||
package opencv
|
package opencv
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ package opencv
|
||||||
//#cgo windows LDFLAGS: -lopencv_core242.dll -lopencv_imgproc242.dll -lopencv_photo242.dll -lopencv_highgui242.dll -lstdc++
|
//#cgo windows LDFLAGS: -lopencv_core242.dll -lopencv_imgproc242.dll -lopencv_photo242.dll -lopencv_highgui242.dll -lstdc++
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
|
_ "fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
_ "fmt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -44,7 +44,6 @@ func WaitKey(delay int) int {
|
||||||
return int(key)
|
return int(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Window wrapper for go
|
// Window wrapper for go
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -121,6 +120,7 @@ const (
|
||||||
CV_WINDOW_NORMAL = int(C.CV_WINDOW_NORMAL)
|
CV_WINDOW_NORMAL = int(C.CV_WINDOW_NORMAL)
|
||||||
CV_WINDOW_FULLSCREEN = int(C.CV_WINDOW_FULLSCREEN)
|
CV_WINDOW_FULLSCREEN = int(C.CV_WINDOW_FULLSCREEN)
|
||||||
)
|
)
|
||||||
|
|
||||||
/* Set and Get Property of the window */
|
/* Set and Get Property of the window */
|
||||||
func (win *Window) SetProperty(prop_id int, value float64) {
|
func (win *Window) SetProperty(prop_id int, value float64) {
|
||||||
C.cvSetWindowProperty(win.name_c, C.int(prop_id), C.double(value))
|
C.cvSetWindowProperty(win.name_c, C.int(prop_id), C.double(value))
|
||||||
|
|
@ -155,7 +155,6 @@ func (win *Window)GetWindowName() string {
|
||||||
return win.name
|
return win.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// window: track bar
|
// window: track bar
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -196,7 +195,7 @@ func (win *Window)CreateTrackbar(name string,
|
||||||
return bool(rv != 0)
|
return bool(rv != 0)
|
||||||
}
|
}
|
||||||
func destroyTrackbar(barName_, winName_ *C.char) {
|
func destroyTrackbar(barName_, winName_ *C.char) {
|
||||||
C.GoOpenCV_DestroyTrackbar(barName_, winName_);
|
C.GoOpenCV_DestroyTrackbar(barName_, winName_)
|
||||||
}
|
}
|
||||||
|
|
||||||
//export goTrackbarCallback
|
//export goTrackbarCallback
|
||||||
|
|
@ -208,11 +207,17 @@ func goTrackbarCallback(barName_, winName_ *C.char, pos C.int) {
|
||||||
barName := C.GoString(barName_)
|
barName := C.GoString(barName_)
|
||||||
|
|
||||||
win, ok := allWindows[winName]
|
win, ok := allWindows[winName]
|
||||||
if !ok { return }
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
trackbarHandle, ok := win.trackbarHandle[barName]
|
trackbarHandle, ok := win.trackbarHandle[barName]
|
||||||
if !ok { return }
|
if !ok {
|
||||||
if trackbarHandle == nil { return }
|
return
|
||||||
|
}
|
||||||
|
if trackbarHandle == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if fa, ok := trackbarHandle.(func(pos int)); ok {
|
if fa, ok := trackbarHandle.(func(pos int)); ok {
|
||||||
fa(int(pos))
|
fa(int(pos))
|
||||||
|
|
@ -235,7 +240,6 @@ func (win *Window)SetTrackbarPos(name string, pos int) {
|
||||||
C.cvSetTrackbarPos(win.trackbarName[name], win.name_c, C.int(pos))
|
C.cvSetTrackbarPos(win.trackbarName[name], win.name_c, C.int(pos))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// window: mouse callback
|
// window: mouse callback
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -282,6 +286,7 @@ func (win *Window)SetMouseCallback(on_mouse MouseFunc, param ...interface{}) {
|
||||||
win.param = nil
|
win.param = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//export goMouseCallback
|
//export goMouseCallback
|
||||||
func goMouseCallback(name *C.char, event, x, y, flags C.int) {
|
func goMouseCallback(name *C.char, event, x, y, flags C.int) {
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
|
|
@ -290,8 +295,12 @@ func goMouseCallback(name *C.char, event, x, y, flags C.int) {
|
||||||
winName := C.GoString(name)
|
winName := C.GoString(name)
|
||||||
win, ok := allWindows[winName]
|
win, ok := allWindows[winName]
|
||||||
|
|
||||||
if !ok { return }
|
if !ok {
|
||||||
if win.mouseHandle == nil { return }
|
return
|
||||||
|
}
|
||||||
|
if win.mouseHandle == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if fa, ok := win.mouseHandle.(func(event, x, y, flags int)); ok {
|
if fa, ok := win.mouseHandle.(func(event, x, y, flags int)); ok {
|
||||||
fa(int(event), int(x), int(y), int(flags))
|
fa(int(event), int(x), int(y), int(flags))
|
||||||
|
|
@ -308,7 +317,6 @@ func goMouseCallback(name *C.char, event, x, y, flags C.int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// window: destroy
|
// window: destroy
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -349,6 +357,7 @@ const (
|
||||||
/* ?, any color */
|
/* ?, any color */
|
||||||
CV_LOAD_IMAGE_ANYCOLOR = int(C.CV_LOAD_IMAGE_ANYCOLOR)
|
CV_LOAD_IMAGE_ANYCOLOR = int(C.CV_LOAD_IMAGE_ANYCOLOR)
|
||||||
)
|
)
|
||||||
|
|
||||||
/* load image from file
|
/* load image from file
|
||||||
iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED
|
iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED
|
||||||
overrides the other flags
|
overrides the other flags
|
||||||
|
|
@ -555,6 +564,7 @@ func FOURCC(c1, c2, c3, c4 int8) uint32 {
|
||||||
rv := C.GoOpenCV_FOURCC_(C.int(c1), C.int(c2), C.int(c3), C.int(c4))
|
rv := C.GoOpenCV_FOURCC_(C.int(c1), C.int(c2), C.int(c3), C.int(c4))
|
||||||
return uint32(rv)
|
return uint32(rv)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
/* Open Codec Selection Dialog (Windows only) */
|
/* Open Codec Selection Dialog (Windows only) */
|
||||||
CV_FOURCC_PROMPT = int(C.CV_FOURCC_PROMPT)
|
CV_FOURCC_PROMPT = int(C.CV_FOURCC_PROMPT)
|
||||||
|
|
@ -593,5 +603,3 @@ func (writer *VideoWriter)Release() {
|
||||||
/*****************************************************************************\
|
/*****************************************************************************\
|
||||||
* --- END --- *
|
* --- END --- *
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,3 @@ import(
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// End
|
// End
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
//"github.com/lazywei/go-opencv/opencv"
|
"github.com/hybridgroup/go-opencv/opencv"
|
||||||
"../opencv" // can be used in forks, comment in real application
|
//"../opencv" // can be used in forks, comment in real application
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
//"github.com/lazywei/go-opencv/opencv"
|
"github.com/hybridgroup/go-opencv/opencv"
|
||||||
"../opencv" // can be used in forks, comment in real application
|
//"../opencv" // can be used in forks, comment in real application
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
//"github.com/lazywei/go-opencv/opencv"
|
"github.com/hybridgroup/go-opencv/opencv"
|
||||||
"../opencv" // can be used in forks, comment in real application
|
//"../opencv" // can be used in forks, comment in real application
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
//"github.com/lazywei/go-opencv/opencv"
|
"github.com/hybridgroup/go-opencv/opencv"
|
||||||
"../opencv" // can be used in forks, comment in real application
|
//"../opencv" // can be used in forks, comment in real application
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import (
|
||||||
//"path"
|
//"path"
|
||||||
//"runtime"
|
//"runtime"
|
||||||
|
|
||||||
//"github.com/lazywei/go-opencv/opencv"
|
"github.com/hybridgroup/go-opencv/opencv"
|
||||||
"../opencv" // can be used in forks, comment in real application
|
//"../opencv" // can be used in forks, comment in real application
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue