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
86a72593
Commit
86a72593
authored
Mar 29, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6343 from terfendail:vt/python_rng_seed_backport
parents
12a8f548
64f02aa7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
0 deletions
+9
-0
core.hpp
modules/core/include/opencv2/core/core.hpp
+3
-0
rand.cpp
modules/core/src/rand.cpp
+5
-0
tests_common.py
modules/python/test/tests_common.py
+1
-0
No files found.
modules/core/include/opencv2/core/core.hpp
View file @
86a72593
...
...
@@ -2593,6 +2593,9 @@ CV_EXPORTS_W double kmeans( InputArray data, int K, CV_OUT InputOutputArray best
//! returns the thread-local Random number generator
CV_EXPORTS
RNG
&
theRNG
();
//! sets state of the thread-local Random number generator
CV_EXPORTS_W
void
setRNGSeed
(
int
seed
);
//! returns the next unifomly-distributed random number of the specified type
template
<
typename
_Tp
>
static
inline
_Tp
randu
()
{
return
(
_Tp
)
theRNG
();
}
...
...
modules/core/src/rand.cpp
View file @
86a72593
...
...
@@ -806,6 +806,11 @@ RNG& theRNG()
}
void
cv
::
setRNGSeed
(
int
seed
)
{
theRNG
()
=
RNG
(
static_cast
<
uint64
>
(
seed
));
}
void
cv
::
randu
(
InputOutputArray
dst
,
InputArray
low
,
InputArray
high
)
{
theRNG
().
fill
(
dst
,
RNG
::
UNIFORM
,
low
,
high
);
...
...
modules/python/test/tests_common.py
View file @
86a72593
...
...
@@ -42,6 +42,7 @@ class NewOpenCVTests(unittest.TestCase):
return
self
.
image_cache
[
filename
]
def
setUp
(
self
):
cv2
.
setRNGSeed
(
10
)
self
.
image_cache
=
{}
def
hashimg
(
self
,
im
):
...
...
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