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
a28c8d00
Commit
a28c8d00
authored
Jun 02, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4081 from vpisarev:30_small_fixes
parents
78e07d32
a4073ed6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
parallel_pthreads.cpp
modules/core/src/parallel_pthreads.cpp
+10
-4
ecc.cpp
modules/video/src/ecc.cpp
+10
-7
No files found.
modules/core/src/parallel_pthreads.cpp
View file @
a28c8d00
...
...
@@ -252,7 +252,14 @@ pthread_mutex_t ThreadManager::m_manager_access_mutex = PTHREAD_RECURSIVE_MUTEX_
ThreadManager
::
ptr_holder
ThreadManager
::
m_instance
;
const
char
ThreadManager
::
m_env_name
[]
=
"OPENCV_FOR_THREADS_NUM"
;
#ifdef ANDROID
// many modern phones/tables have 4-core CPUs. Let's use no more
// than 2 threads by default not to overheat the devices
const
unsigned
int
ThreadManager
::
m_default_number_of_threads
=
2
;
#else
const
unsigned
int
ThreadManager
::
m_default_number_of_threads
=
8
;
#endif
ForThread
::~
ForThread
()
{
...
...
@@ -399,11 +406,10 @@ ThreadManager::~ThreadManager()
void
ThreadManager
::
run
(
const
cv
::
Range
&
range
,
const
cv
::
ParallelLoopBody
&
body
,
double
nstripes
)
{
bool
is_work_thread
;
is_work_thread
=
m_is_work_thread
.
get
()
->
value
;
bool
is_work_thread
=
m_is_work_thread
.
get
()
->
value
;
if
(
(
getNumOfThreads
()
>
1
)
&&
!
is_work_thread
&&
(
range
.
end
-
range
.
start
>
1
)
)
if
(
(
getNumOfThreads
()
>
1
)
&&
!
is_work_thread
&&
(
range
.
end
-
range
.
start
>
1
)
&&
(
nstripes
<=
0
||
nstripes
>=
1.5
)
)
{
int
res
=
pthread_mutex_trylock
(
&
m_manager_access_mutex
);
...
...
modules/video/src/ecc.cpp
View file @
a28c8d00
...
...
@@ -402,16 +402,19 @@ double cv::findTransformECC(InputArray templateImage,
Mat
inputMaskMat
=
inputMask
.
getMat
();
//to use it for mask warping
Mat
preMask
=
inputMaskMat
.
empty
()
?
Mat
::
ones
(
hd
,
wd
,
CV_8U
)
:
inputMaskMat
;
Mat
preMask
;
if
(
inputMask
.
empty
())
preMask
=
Mat
::
ones
(
hd
,
wd
,
CV_8U
);
else
threshold
(
inputMask
,
preMask
,
0
,
1
,
THRESH_BINARY
);
//gaussian filtering is optional
src
.
convertTo
(
templateFloat
,
templateFloat
.
type
());
GaussianBlur
(
templateFloat
,
templateFloat
,
Size
(
5
,
5
),
0
,
0
);
//is in-place filtering slower?
GaussianBlur
(
templateFloat
,
templateFloat
,
Size
(
5
,
5
),
0
,
0
);
Mat
preMaskFloat
=
Mat
(
hd
,
wd
,
CV_32F
)
;
preMask
.
convertTo
(
preMaskFloat
,
preMaskFloat
.
type
()
);
GaussianBlur
(
preMaskFloat
,
preMaskFloat
,
Size
(
5
,
5
),
0
,
0
);
//is in-place filtering slower?
Mat
preMaskFloat
;
preMask
.
convertTo
(
preMaskFloat
,
CV_32F
);
GaussianBlur
(
preMaskFloat
,
preMaskFloat
,
Size
(
5
,
5
),
0
,
0
);
// Change threshold.
preMaskFloat
*=
(
0.5
/
0.95
);
// Rounding conversion.
...
...
@@ -512,7 +515,7 @@ double cv::findTransformECC(InputArray templateImage,
// calculate enhanced correlation coefficiont (ECC)->rho
last_rho
=
rho
;
rho
=
correlation
/
(
imgNorm
*
tmpNorm
);
if
(
isnan
(
rho
))
{
if
(
cvIsNaN
(
rho
))
{
CV_Error
(
Error
::
StsNoConv
,
"NaN encountered."
);
}
...
...
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