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
a490b64e
Commit
a490b64e
authored
Mar 25, 2016
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function setRNGSeed and seed setup in python tests
parent
05384f05
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
core.hpp
modules/core/include/opencv2/core.hpp
+8
-0
rand.cpp
modules/core/src/rand.cpp
+6
-0
tests_common.py
modules/python/test/tests_common.py
+1
-0
No files found.
modules/core/include/opencv2/core.hpp
View file @
a490b64e
...
...
@@ -2170,6 +2170,14 @@ is much faster to use this function to retrieve the generator and then use RNG::
*/
CV_EXPORTS
RNG
&
theRNG
();
/** @brief Sets state of default random number generator.
The function sets state of default random number generator to custom value.
@param new state for default random number generator
@sa RNG, randu, randn
*/
CV_EXPORTS_W
void
setRNGSeed
(
int
seed
);
/** @brief Generates a single uniformly-distributed random number or an array of random numbers.
Non-template variant of the function fills the matrix dst with uniformly-distributed
...
...
modules/core/src/rand.cpp
View file @
a490b64e
...
...
@@ -734,6 +734,12 @@ cv::RNG& cv::theRNG()
return
getCoreTlsData
().
get
()
->
rng
;
}
void
cv
::
setRNGSeed
(
int
seed
)
{
getCoreTlsData
().
get
()
->
rng
.
state
=
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 @
a490b64e
...
...
@@ -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