Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
c7fc9dc4
Commit
c7fc9dc4
authored
Jun 29, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6707 from tech2077:master
parents
bbc327aa
f861d0d6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
cv2.cpp
modules/python/src2/cv2.cpp
+47
-0
No files found.
modules/python/src2/cv2.cpp
View file @
c7fc9dc4
...
...
@@ -1268,6 +1268,52 @@ static PyObject *pycvCreateTrackbar(PyObject*, PyObject *args)
ERRWRAP2
(
createTrackbar
(
trackbar_name
,
window_name
,
value
,
count
,
OnChange
,
Py_BuildValue
(
"OO"
,
on_change
,
Py_None
)));
Py_RETURN_NONE
;
}
static
void
OnButtonChange
(
int
state
,
void
*
param
)
{
PyGILState_STATE
gstate
;
gstate
=
PyGILState_Ensure
();
PyObject
*
o
=
(
PyObject
*
)
param
;
PyObject
*
args
;
if
(
PyTuple_GetItem
(
o
,
1
)
!=
NULL
)
{
args
=
Py_BuildValue
(
"(iO)"
,
state
,
PyTuple_GetItem
(
o
,
1
));
}
else
{
args
=
Py_BuildValue
(
"(i)"
,
state
);
}
PyObject
*
r
=
PyObject_Call
(
PyTuple_GetItem
(
o
,
0
),
args
,
NULL
);
if
(
r
==
NULL
)
PyErr_Print
();
Py_DECREF
(
args
);
PyGILState_Release
(
gstate
);
}
static
PyObject
*
pycvCreateButton
(
PyObject
*
,
PyObject
*
args
,
PyObject
*
kw
)
{
const
char
*
keywords
[]
=
{
"buttonName"
,
"onChange"
,
"userData"
,
"buttonType"
,
"initialButtonState"
,
NULL
};
PyObject
*
on_change
;
PyObject
*
userdata
=
NULL
;
char
*
button_name
;
int
button_type
=
0
;
bool
initial_button_state
=
false
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"sO|Oii"
,
(
char
**
)
keywords
,
&
button_name
,
&
on_change
,
&
userdata
,
&
button_type
,
&
initial_button_state
))
return
NULL
;
if
(
!
PyCallable_Check
(
on_change
))
{
PyErr_SetString
(
PyExc_TypeError
,
"onChange must be callable"
);
return
NULL
;
}
if
(
userdata
==
NULL
)
{
userdata
=
Py_None
;
}
ERRWRAP2
(
createButton
(
button_name
,
OnButtonChange
,
Py_BuildValue
(
"OO"
,
on_change
,
userdata
),
button_type
,
initial_button_state
));
Py_RETURN_NONE
;
}
#endif
///////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -1300,6 +1346,7 @@ static int convert_to_char(PyObject *o, char *dst, const char *name = "no_name")
static
PyMethodDef
special_methods
[]
=
{
#ifdef HAVE_OPENCV_HIGHGUI
{
"createTrackbar"
,
pycvCreateTrackbar
,
METH_VARARGS
,
"createTrackbar(trackbarName, windowName, value, count, onChange) -> None"
},
{
"createButton"
,
(
PyCFunction
)
pycvCreateButton
,
METH_VARARGS
|
METH_KEYWORDS
,
"createButton(buttonName, onChange [, userData, buttonType, initialButtonState]) -> None"
},
{
"setMouseCallback"
,
(
PyCFunction
)
pycvSetMouseCallback
,
METH_VARARGS
|
METH_KEYWORDS
,
"setMouseCallback(windowName, onMouse [, param]) -> None"
},
#endif
{
NULL
,
NULL
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment