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
d9c74f63
Commit
d9c74f63
authored
Jun 25, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All tests writing temporary files are updated to use cv::tempfile() function
parent
ec3a7665
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
115 additions
and
53 deletions
+115
-53
test_cornerssubpix.cpp
modules/calib3d/test/test_cornerssubpix.cpp
+0
-0
system.cpp
modules/core/src/system.cpp
+53
-14
test_arithm.cpp
modules/core/test/test_arithm.cpp
+0
-0
test_io.cpp
modules/core/test/test_io.cpp
+4
-3
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+0
-0
test_fast.cpp
modules/features2d/test/test_fast.cpp
+0
-0
test_mser.cpp
modules/features2d/test/test_mser.cpp
+0
-0
test_nearestneighbors.cpp
modules/features2d/test/test_nearestneighbors.cpp
+0
-0
perf_video.cpp
modules/gpu/perf/perf_video.cpp
+1
-1
perf_video.cpp
modules/gpu/perf_cpu/perf_video.cpp
+1
-1
test_video.cpp
modules/gpu/test/test_video.cpp
+1
-1
test_ffmpeg.cpp
modules/highgui/test/test_ffmpeg.cpp
+0
-0
test_grfmt.cpp
modules/highgui/test/test_grfmt.cpp
+23
-9
test_video_io.cpp
modules/highgui/test/test_video_io.cpp
+6
-6
test_video_pos.cpp
modules/highgui/test/test_video_pos.cpp
+7
-9
test_grabcut.cpp
modules/imgproc/test/test_grabcut.cpp
+0
-0
test_watershed.cpp
modules/imgproc/test/test_watershed.cpp
+0
-0
test_em.cpp
modules/legacy/test/test_em.cpp
+1
-1
test_stereomatching.cpp
modules/legacy/test/test_stereomatching.cpp
+0
-0
test_emknearestkmeans.cpp
modules/ml/test/test_emknearestkmeans.cpp
+1
-1
test_precomp.hpp
modules/ml/test/test_precomp.hpp
+0
-0
test_save_load.cpp
modules/ml/test/test_save_load.cpp
+0
-0
test_latentsvmdetector.cpp
modules/objdetect/test/test_latentsvmdetector.cpp
+0
-0
test_inpaint.cpp
modules/photo/test/test_inpaint.cpp
+0
-3
gen.py
modules/python/src2/gen.py
+0
-2
run.py
modules/ts/misc/run.py
+17
-2
No files found.
modules/calib3d/test/test_cornerssubpix.cpp
View file @
d9c74f63
modules/core/src/system.cpp
View file @
d9c74f63
...
@@ -473,20 +473,59 @@ string format( const char* fmt, ... )
...
@@ -473,20 +473,59 @@ string format( const char* fmt, ... )
string
tempfile
(
const
char
*
suffix
)
string
tempfile
(
const
char
*
suffix
)
{
{
char
buf
[
L_tmpnam
];
#if defined WIN32 || defined _WIN32
char
*
name
=
0
;
char
temp_dir
[
MAX_PATH
+
1
]
=
{
0
};
#ifdef ANDROID
char
temp_file
[
MAX_PATH
+
1
]
=
{
0
};
strcpy
(
buf
,
"/sdcard/__opencv_temp_XXXXXX"
);
name
=
mktemp
(
buf
);
::
GetTempPathA
(
sizeof
(
temp_dir
),
temp_dir
);
#else
if
(
0
!=
::
GetTempFileNameA
(
temp_dir
,
"__opencv_temp."
,
0
,
temp_file
))
name
=
tmpnam
(
buf
);
return
string
();
#endif
if
(
*
name
==
'\\'
)
string
name
=
temp_file
;
++
name
;
if
(
suffix
)
string
n
(
name
);
{
if
(
suffix
!=
0
)
if
(
suffix
[
0
]
!=
'.'
)
n
+=
(
n
[
n
.
size
()
-
1
]
==
'.'
&&
suffix
[
0
]
==
'.'
?
suffix
+
1
:
suffix
);
return
name
+
"."
+
suffix
;
return
n
;
else
return
name
+
suffix
;
}
else
return
name
;
# else
# ifdef ANDROID
//char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX";
char
defaultTemplate
[]
=
"/data/local/tmp/__opencv_temp.XXXXXX"
;
# else
char
defaultTemplate
[]
=
"/tmp/__opencv_temp.XXXXXX"
;
# endif
string
fname
;
const
char
*
temp_dir
=
getenv
(
"OPENCV_TEMP_PATH"
);
if
(
temp_dir
==
0
||
temp_dir
[
0
]
==
0
)
fname
=
defaultTemplate
;
else
{
fname
=
temp_dir
;
char
ech
=
fname
[
fname
.
size
()
-
1
];
if
(
ech
!=
'/'
&&
ech
!=
'\\'
)
fname
+=
"/"
;
fname
+=
"__opencv_temp.XXXXXX"
;
}
const
int
fd
=
mkstemp
((
char
*
)
fname
.
c_str
());
if
(
fd
==
-
1
)
return
""
;
close
(
fd
);
remove
(
fname
.
c_str
());
if
(
suffix
)
{
if
(
suffix
[
0
]
!=
'.'
)
fname
=
fname
+
"."
+
suffix
;
else
fname
+=
suffix
;
}
return
fname
;
# endif
}
}
static
CvErrorCallback
customErrorCallback
=
0
;
static
CvErrorCallback
customErrorCallback
=
0
;
...
...
modules/core/test/test_arithm.cpp
View file @
d9c74f63
modules/core/test/test_io.cpp
View file @
d9c74f63
...
@@ -389,7 +389,8 @@ protected:
...
@@ -389,7 +389,8 @@ protected:
{
{
try
try
{
{
FileStorage
fs
(
"test.xml"
,
FileStorage
::
WRITE
);
string
fname
=
cv
::
tempfile
(
".xml"
);
FileStorage
fs
(
fname
,
FileStorage
::
WRITE
);
vector
<
int
>
mi
,
mi2
,
mi3
,
mi4
;
vector
<
int
>
mi
,
mi2
,
mi3
,
mi4
;
vector
<
Mat
>
mv
,
mv2
,
mv3
,
mv4
;
vector
<
Mat
>
mv
,
mv2
,
mv3
,
mv4
;
Mat
m
(
10
,
9
,
CV_32F
);
Mat
m
(
10
,
9
,
CV_32F
);
...
@@ -403,7 +404,7 @@ protected:
...
@@ -403,7 +404,7 @@ protected:
fs
<<
"mv3"
<<
mv3
;
fs
<<
"mv3"
<<
mv3
;
fs
<<
"empty"
<<
empty
;
fs
<<
"empty"
<<
empty
;
fs
.
release
();
fs
.
release
();
fs
.
open
(
"test.xml"
,
FileStorage
::
READ
);
fs
.
open
(
fname
,
FileStorage
::
READ
);
fs
[
"mi"
]
>>
mi2
;
fs
[
"mi"
]
>>
mi2
;
fs
[
"mv"
]
>>
mv2
;
fs
[
"mv"
]
>>
mv2
;
fs
[
"mi3"
]
>>
mi4
;
fs
[
"mi3"
]
>>
mi4
;
...
@@ -439,7 +440,7 @@ protected:
...
@@ -439,7 +440,7 @@ protected:
int N = 1000, M = 1200000;
int N = 1000, M = 1200000;
Mat mat(M, N, CV_32F);
Mat mat(M, N, CV_32F);
rng.fill(mat, RNG::UNIFORM, 0, 1);
rng.fill(mat, RNG::UNIFORM, 0, 1);
FileStorage fs(
"test.xml"
, FileStorage::WRITE);
FileStorage fs(
cv::tempfile(".xml")
, FileStorage::WRITE);
fs << "mat" << mat;
fs << "mat" << mat;
fs.release();
fs.release();
}
}
...
...
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
d9c74f63
modules/features2d/test/test_fast.cpp
View file @
d9c74f63
modules/features2d/test/test_mser.cpp
View file @
d9c74f63
modules/features2d/test/test_nearestneighbors.cpp
View file @
d9c74f63
modules/gpu/perf/perf_video.cpp
View file @
d9c74f63
...
@@ -529,7 +529,7 @@ GPU_PERF_TEST(VideoWriter, cv::gpu::DeviceInfo, std::string)
...
@@ -529,7 +529,7 @@ GPU_PERF_TEST(VideoWriter, cv::gpu::DeviceInfo, std::string)
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
std
::
string
inputFile
=
perf
::
TestBase
::
getDataPath
(
std
::
string
(
"gpu/video/"
)
+
GET_PARAM
(
1
));
std
::
string
inputFile
=
perf
::
TestBase
::
getDataPath
(
std
::
string
(
"gpu/video/"
)
+
GET_PARAM
(
1
));
std
::
string
outputFile
=
inputFile
.
substr
(
0
,
inputFile
.
find
(
'.'
))
+
"_test.avi"
;
std
::
string
outputFile
=
cv
::
tempfile
(
".avi"
)
;
cv
::
VideoCapture
reader
(
inputFile
);
cv
::
VideoCapture
reader
(
inputFile
);
ASSERT_TRUE
(
reader
.
isOpened
()
);
ASSERT_TRUE
(
reader
.
isOpened
()
);
...
...
modules/gpu/perf_cpu/perf_video.cpp
View file @
d9c74f63
...
@@ -338,7 +338,7 @@ GPU_PERF_TEST(VideoWriter, cv::gpu::DeviceInfo, std::string)
...
@@ -338,7 +338,7 @@ GPU_PERF_TEST(VideoWriter, cv::gpu::DeviceInfo, std::string)
const
double
FPS
=
25.0
;
const
double
FPS
=
25.0
;
std
::
string
inputFile
=
perf
::
TestBase
::
getDataPath
(
std
::
string
(
"gpu/video/"
)
+
GET_PARAM
(
1
));
std
::
string
inputFile
=
perf
::
TestBase
::
getDataPath
(
std
::
string
(
"gpu/video/"
)
+
GET_PARAM
(
1
));
std
::
string
outputFile
=
inputFile
.
substr
(
0
,
inputFile
.
find
(
'.'
))
+
"_test.avi"
;
std
::
string
outputFile
=
cv
::
tempfile
(
".avi"
)
;
cv
::
VideoCapture
reader
(
inputFile
);
cv
::
VideoCapture
reader
(
inputFile
);
ASSERT_TRUE
(
reader
.
isOpened
()
);
ASSERT_TRUE
(
reader
.
isOpened
()
);
...
...
modules/gpu/test/test_video.cpp
View file @
d9c74f63
...
@@ -687,7 +687,7 @@ PARAM_TEST_CASE(VideoWriter, cv::gpu::DeviceInfo, std::string)
...
@@ -687,7 +687,7 @@ PARAM_TEST_CASE(VideoWriter, cv::gpu::DeviceInfo, std::string)
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
inputFile
=
std
::
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"video/"
+
inputFile
;
inputFile
=
std
::
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"video/"
+
inputFile
;
outputFile
=
inputFile
.
substr
(
0
,
inputFile
.
find
(
'.'
))
+
"_test.avi"
;
outputFile
=
cv
::
tempfile
(
".avi"
)
;
}
}
};
};
...
...
modules/highgui/test/test_ffmpeg.cpp
View file @
d9c74f63
modules/highgui/test/test_grfmt.cpp
View file @
d9c74f63
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"finish reading big image
\n
"
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"finish reading big image
\n
"
);
if
(
img
.
empty
())
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_TEST_DATA
);
if
(
img
.
empty
())
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_TEST_DATA
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"start writing big image
\n
"
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"start writing big image
\n
"
);
imwrite
(
string
(
ts
->
get_data_path
())
+
"readwrite/write.png"
,
img
);
imwrite
(
cv
::
tempfile
(
".png"
)
,
img
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"finish writing big image
\n
"
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"finish writing big image
\n
"
);
}
}
catch
(...)
catch
(...)
...
@@ -72,10 +72,14 @@ public:
...
@@ -72,10 +72,14 @@ public:
string
ext_from_int
(
int
ext
)
string
ext_from_int
(
int
ext
)
{
{
#ifdef HAVE_PNG
if
(
ext
==
0
)
return
".png"
;
if
(
ext
==
0
)
return
".png"
;
#endif
if
(
ext
==
1
)
return
".bmp"
;
if
(
ext
==
1
)
return
".bmp"
;
if
(
ext
==
2
)
return
".pgm"
;
if
(
ext
==
2
)
return
".pgm"
;
#ifdef HAVE_TIFF
if
(
ext
==
3
)
return
".tiff"
;
if
(
ext
==
3
)
return
".tiff"
;
#endif
return
""
;
return
""
;
}
}
...
@@ -92,16 +96,21 @@ public:
...
@@ -92,16 +96,21 @@ public:
for
(
int
k
=
1
;
k
<=
5
;
++
k
)
for
(
int
k
=
1
;
k
<=
5
;
++
k
)
{
{
for
(
int
ext
=
0
;
ext
<
4
;
++
ext
)
// 0 - png, 1 - bmp, 2 - pgm, 3 - tiff
for
(
int
ext
=
0
;
ext
<
4
;
++
ext
)
// 0 - png, 1 - bmp, 2 - pgm, 3 - tiff
{
if
(
ext_from_int
(
ext
).
empty
())
continue
;
for
(
int
num_channels
=
1
;
num_channels
<=
3
;
num_channels
+=
2
)
for
(
int
num_channels
=
1
;
num_channels
<=
3
;
num_channels
+=
2
)
{
{
ts
->
printf
(
ts
->
LOG
,
"image type depth:%d channels:%d ext: %s
\n
"
,
CV_8U
,
num_channels
,
ext_from_int
(
ext
).
c_str
());
ts
->
printf
(
ts
->
LOG
,
"image type depth:%d channels:%d ext: %s
\n
"
,
CV_8U
,
num_channels
,
ext_from_int
(
ext
).
c_str
());
Mat
img
(
img_r
*
k
,
img_c
*
k
,
CV_MAKETYPE
(
CV_8U
,
num_channels
),
Scalar
::
all
(
0
));
Mat
img
(
img_r
*
k
,
img_c
*
k
,
CV_MAKETYPE
(
CV_8U
,
num_channels
),
Scalar
::
all
(
0
));
circle
(
img
,
Point2i
((
img_c
*
k
)
/
2
,
(
img_r
*
k
)
/
2
),
cv
::
min
((
img_r
*
k
),
(
img_c
*
k
))
/
4
,
Scalar
::
all
(
255
));
circle
(
img
,
Point2i
((
img_c
*
k
)
/
2
,
(
img_r
*
k
)
/
2
),
cv
::
min
((
img_r
*
k
),
(
img_c
*
k
))
/
4
,
Scalar
::
all
(
255
));
ts
->
printf
(
ts
->
LOG
,
"writing image : %s
\n
"
,
string
(
string
(
ts
->
get_data_path
())
+
"readwrite/test"
+
ext_from_int
(
ext
)).
c_str
());
imwrite
(
string
(
ts
->
get_data_path
())
+
"readwrite/test"
+
ext_from_int
(
ext
),
img
);
ts
->
printf
(
ts
->
LOG
,
"reading test image : %s
\n
"
,
string
(
string
(
ts
->
get_data_path
())
+
"readwrite/test"
+
ext_from_int
(
ext
)).
c_str
());
Mat
img_test
=
imread
(
string
(
ts
->
get_data_path
())
+
"readwrite/test"
+
ext_from_int
(
ext
),
CV_LOAD_IMAGE_UNCHANGED
);
string
img_path
=
cv
::
tempfile
(
ext_from_int
(
ext
).
c_str
());
ts
->
printf
(
ts
->
LOG
,
"writing image : %s
\n
"
,
img_path
.
c_str
());
imwrite
(
img_path
,
img
);
ts
->
printf
(
ts
->
LOG
,
"reading test image : %s
\n
"
,
img_path
.
c_str
());
Mat
img_test
=
imread
(
img_path
,
CV_LOAD_IMAGE_UNCHANGED
);
if
(
img_test
.
empty
())
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
if
(
img_test
.
empty
())
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
...
@@ -115,14 +124,17 @@ public:
...
@@ -115,14 +124,17 @@ public:
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
}
}
}
}
}
#ifdef HAVE_JPEG
for
(
int
num_channels
=
1
;
num_channels
<=
3
;
num_channels
+=
2
)
for
(
int
num_channels
=
1
;
num_channels
<=
3
;
num_channels
+=
2
)
{
{
// jpeg
// jpeg
ts
->
printf
(
ts
->
LOG
,
"image type depth:%d channels:%d ext: %s
\n
"
,
CV_8U
,
num_channels
,
".jpg"
);
ts
->
printf
(
ts
->
LOG
,
"image type depth:%d channels:%d ext: %s
\n
"
,
CV_8U
,
num_channels
,
".jpg"
);
Mat
img
(
img_r
*
k
,
img_c
*
k
,
CV_MAKETYPE
(
CV_8U
,
num_channels
),
Scalar
::
all
(
0
));
Mat
img
(
img_r
*
k
,
img_c
*
k
,
CV_MAKETYPE
(
CV_8U
,
num_channels
),
Scalar
::
all
(
0
));
circle
(
img
,
Point2i
((
img_c
*
k
)
/
2
,
(
img_r
*
k
)
/
2
),
cv
::
min
((
img_r
*
k
),
(
img_c
*
k
))
/
4
,
Scalar
::
all
(
255
));
circle
(
img
,
Point2i
((
img_c
*
k
)
/
2
,
(
img_r
*
k
)
/
2
),
cv
::
min
((
img_r
*
k
),
(
img_c
*
k
))
/
4
,
Scalar
::
all
(
255
));
string
filename
=
string
(
ts
->
get_data_path
()
+
"readwrite/test_"
+
char
(
k
+
48
)
+
"_c"
+
char
(
num_channels
+
48
)
+
"_.jpg"
);
string
filename
=
cv
::
tempfile
(
".jpg"
);
imwrite
(
filename
,
img
);
imwrite
(
filename
,
img
);
img
=
imread
(
filename
,
CV_LOAD_IMAGE_UNCHANGED
);
img
=
imread
(
filename
,
CV_LOAD_IMAGE_UNCHANGED
);
...
@@ -142,14 +154,17 @@ public:
...
@@ -142,14 +154,17 @@ public:
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
}
}
}
}
#endif
#ifdef HAVE_TIFF
for
(
int
num_channels
=
1
;
num_channels
<=
3
;
num_channels
+=
2
)
for
(
int
num_channels
=
1
;
num_channels
<=
3
;
num_channels
+=
2
)
{
{
// tiff
// tiff
ts
->
printf
(
ts
->
LOG
,
"image type depth:%d channels:%d ext: %s
\n
"
,
CV_16U
,
num_channels
,
".tiff"
);
ts
->
printf
(
ts
->
LOG
,
"image type depth:%d channels:%d ext: %s
\n
"
,
CV_16U
,
num_channels
,
".tiff"
);
Mat
img
(
img_r
*
k
,
img_c
*
k
,
CV_MAKETYPE
(
CV_16U
,
num_channels
),
Scalar
::
all
(
0
));
Mat
img
(
img_r
*
k
,
img_c
*
k
,
CV_MAKETYPE
(
CV_16U
,
num_channels
),
Scalar
::
all
(
0
));
circle
(
img
,
Point2i
((
img_c
*
k
)
/
2
,
(
img_r
*
k
)
/
2
),
cv
::
min
((
img_r
*
k
),
(
img_c
*
k
))
/
4
,
Scalar
::
all
(
255
));
circle
(
img
,
Point2i
((
img_c
*
k
)
/
2
,
(
img_r
*
k
)
/
2
),
cv
::
min
((
img_r
*
k
),
(
img_c
*
k
))
/
4
,
Scalar
::
all
(
255
));
string
filename
=
string
(
ts
->
get_data_path
()
+
"readwrite/test.tiff"
);
string
filename
=
cv
::
tempfile
(
".tiff"
);
imwrite
(
filename
,
img
);
imwrite
(
filename
,
img
);
ts
->
printf
(
ts
->
LOG
,
"reading test image : %s
\n
"
,
filename
.
c_str
());
ts
->
printf
(
ts
->
LOG
,
"reading test image : %s
\n
"
,
filename
.
c_str
());
Mat
img_test
=
imread
(
filename
,
CV_LOAD_IMAGE_UNCHANGED
);
Mat
img_test
=
imread
(
filename
,
CV_LOAD_IMAGE_UNCHANGED
);
...
@@ -171,6 +186,7 @@ public:
...
@@ -171,6 +186,7 @@ public:
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
}
}
}
}
#endif
}
}
}
}
catch
(
const
cv
::
Exception
&
e
)
catch
(
const
cv
::
Exception
&
e
)
...
@@ -205,9 +221,7 @@ public:
...
@@ -205,9 +221,7 @@ public:
TEST
(
Highgui_Image
,
write_big
)
{
CV_GrfmtWriteBigImageTest
test
;
test
.
safe_run
();
}
TEST
(
Highgui_Image
,
write_big
)
{
CV_GrfmtWriteBigImageTest
test
;
test
.
safe_run
();
}
#endif
#endif
#if defined(HAVE_PNG) && defined(HAVE_TIFF) && defined(HAVE_JPEG)
TEST
(
Highgui_Image
,
write_imageseq
)
{
CV_GrfmtWriteSequenceImageTest
test
;
test
.
safe_run
();
}
TEST
(
Highgui_Image
,
write_imageseq
)
{
CV_GrfmtWriteSequenceImageTest
test
;
test
.
safe_run
();
}
#endif
TEST
(
Highgui_Image
,
read_bmp_rle8
)
{
CV_GrfmtReadBMPRLE8Test
test
;
test
.
safe_run
();
}
TEST
(
Highgui_Image
,
read_bmp_rle8
)
{
CV_GrfmtReadBMPRLE8Test
test
;
test
.
safe_run
();
}
modules/highgui/test/test_video_io.cpp
View file @
d9c74f63
...
@@ -155,7 +155,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
...
@@ -155,7 +155,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
for
(
size_t
i
=
0
;
i
<
ext_num
;
++
i
)
for
(
size_t
i
=
0
;
i
<
ext_num
;
++
i
)
{
{
string
ext
=
exts
[
i
];
string
ext
=
exts
[
i
];
string
full_name
=
"img."
+
ext
;
string
full_name
=
cv
::
tempfile
(
ext
.
c_str
())
;
ts
->
printf
(
ts
->
LOG
,
" full_name : %s
\n
"
,
full_name
.
c_str
());
ts
->
printf
(
ts
->
LOG
,
" full_name : %s
\n
"
,
full_name
.
c_str
());
imwrite
(
full_name
,
image
);
imwrite
(
full_name
,
image
);
...
@@ -225,7 +225,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
...
@@ -225,7 +225,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
void
CV_HighGuiTest
::
VideoTest
(
const
string
&
dir
,
const
cvtest
::
VideoFormat
&
fmt
)
void
CV_HighGuiTest
::
VideoTest
(
const
string
&
dir
,
const
cvtest
::
VideoFormat
&
fmt
)
{
{
string
src_file
=
dir
+
"../cv/shared/video_for_test.avi"
;
string
src_file
=
dir
+
"../cv/shared/video_for_test.avi"
;
string
tmp_name
=
format
(
"video_%s.%s"
,
cvtest
::
fourccToString
(
fmt
.
fourcc
).
c_str
(),
fmt
.
ext
.
c_str
());
string
tmp_name
=
cv
::
tempfile
((
cvtest
::
fourccToString
(
fmt
.
fourcc
)
+
"."
+
fmt
.
ext
)
.
c_str
());
ts
->
printf
(
ts
->
LOG
,
"reading video : %s and converting it to %s
\n
"
,
src_file
.
c_str
(),
tmp_name
.
c_str
());
ts
->
printf
(
ts
->
LOG
,
"reading video : %s and converting it to %s
\n
"
,
src_file
.
c_str
(),
tmp_name
.
c_str
());
...
@@ -291,8 +291,8 @@ void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt
...
@@ -291,8 +291,8 @@ void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt
if
(
psnr
<
thresDbell
)
if
(
psnr
<
thresDbell
)
{
{
printf
(
"Too low psnr = %gdb
\n
"
,
psnr
);
printf
(
"Too low psnr = %gdb
\n
"
,
psnr
);
imwrite
(
"img.png"
,
img
);
//
imwrite("img.png", img);
imwrite
(
"img1.png"
,
img1
);
//
imwrite("img1.png", img1);
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
ts
->
set_failed_test_info
(
ts
->
FAIL_MISMATCH
);
break
;
break
;
}
}
...
@@ -323,7 +323,7 @@ void CV_HighGuiTest::SpecificImageTest(const string& dir)
...
@@ -323,7 +323,7 @@ void CV_HighGuiTest::SpecificImageTest(const string& dir)
stringstream
s_digit
;
s_digit
<<
i
;
stringstream
s_digit
;
s_digit
<<
i
;
string
full_name
=
"img_"
+
s_digit
.
str
()
+
".bmp"
;
string
full_name
=
cv
::
tempfile
((
s_digit
.
str
()
+
".bmp"
).
c_str
())
;
ts
->
printf
(
ts
->
LOG
,
" full_name : %s
\n
"
,
full_name
.
c_str
());
ts
->
printf
(
ts
->
LOG
,
" full_name : %s
\n
"
,
full_name
.
c_str
());
imwrite
(
full_name
,
image
);
imwrite
(
full_name
,
image
);
...
@@ -395,7 +395,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
...
@@ -395,7 +395,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
int
fourcc
=
fmt
.
fourcc
;
int
fourcc
=
fmt
.
fourcc
;
string
fourcc_str
=
cvtest
::
fourccToString
(
fourcc
);
string
fourcc_str
=
cvtest
::
fourccToString
(
fourcc
);
const
string
video_file
=
"video_"
+
fourcc_str
+
"."
+
ext
;
const
string
video_file
=
cv
::
tempfile
((
fourcc_str
+
"."
+
ext
).
c_str
())
;
Size
frame_size
(
968
&
-
2
,
757
&
-
2
);
Size
frame_size
(
968
&
-
2
,
757
&
-
2
);
VideoWriter
writer
(
video_file
,
fourcc
,
25
,
frame_size
,
true
);
VideoWriter
writer
(
video_file
,
fourcc
,
25
,
frame_size
,
true
);
...
...
modules/highgui/test/test_video_pos.cpp
View file @
d9c74f63
...
@@ -65,13 +65,11 @@ public:
...
@@ -65,13 +65,11 @@ public:
string
getFilename
(
const
cvtest
::
VideoFormat
&
fmt
)
string
getFilename
(
const
cvtest
::
VideoFormat
&
fmt
)
{
{
return
format
(
"test_video_%s.%s"
,
cvtest
::
fourccToString
(
fmt
.
fourcc
).
c_str
(),
fmt
.
ext
.
c_str
());
return
cv
::
tempfile
((
cvtest
::
fourccToString
(
fmt
.
fourcc
)
+
"."
+
fmt
.
ext
)
.
c_str
());
}
}
bool
CreateTestVideo
(
const
cvtest
::
VideoFormat
&
fmt
,
int
framecount
)
bool
CreateTestVideo
(
const
cvtest
::
VideoFormat
&
fmt
,
int
framecount
,
string
filename
)
{
{
string
filename
=
getFilename
(
fmt
);
VideoWriter
writer
(
filename
,
fmt
.
fourcc
,
25
,
framesize
,
true
);
VideoWriter
writer
(
filename
,
fmt
.
fourcc
,
25
,
framesize
,
true
);
if
(
!
writer
.
isOpened
()
)
if
(
!
writer
.
isOpened
()
)
return
false
;
return
false
;
...
@@ -96,7 +94,7 @@ public:
...
@@ -96,7 +94,7 @@ public:
string
filename
=
getFilename
(
fmt
);
string
filename
=
getFilename
(
fmt
);
ts
->
printf
(
ts
->
LOG
,
"
\n
File: %s
\n
"
,
filename
.
c_str
());
ts
->
printf
(
ts
->
LOG
,
"
\n
File: %s
\n
"
,
filename
.
c_str
());
if
(
!
CreateTestVideo
(
fmt
,
n_frames
)
)
if
(
!
CreateTestVideo
(
fmt
,
n_frames
,
filename
)
)
{
{
ts
->
printf
(
ts
->
LOG
,
"
\n
Error: cannot create video file"
);
ts
->
printf
(
ts
->
LOG
,
"
\n
Error: cannot create video file"
);
ts
->
set_failed_test_info
(
ts
->
FAIL_INVALID_OUTPUT
);
ts
->
set_failed_test_info
(
ts
->
FAIL_INVALID_OUTPUT
);
...
@@ -145,8 +143,8 @@ public:
...
@@ -145,8 +143,8 @@ public:
idx1
,
idx
);
idx1
,
idx
);
ts
->
printf
(
ts
->
LOG
,
"Saving both frames ...
\n
"
);
ts
->
printf
(
ts
->
LOG
,
"Saving both frames ...
\n
"
);
ts
->
set_failed_test_info
(
ts
->
FAIL_INVALID_OUTPUT
);
ts
->
set_failed_test_info
(
ts
->
FAIL_INVALID_OUTPUT
);
imwrite
(
"opencv_test_highgui_postest_actual.png"
,
img
);
//
imwrite("opencv_test_highgui_postest_actual.png", img);
imwrite
(
"opencv_test_highgui_postest_expected.png"
,
img0
);
//
imwrite("opencv_test_highgui_postest_expected.png", img0);
return
;
return
;
}
}
...
@@ -164,8 +162,8 @@ public:
...
@@ -164,8 +162,8 @@ public:
ts
->
printf
(
ts
->
LOG
,
"The frame read after positioning to %d is incorrect (PSNR=%g)
\n
"
,
idx
,
err
);
ts
->
printf
(
ts
->
LOG
,
"The frame read after positioning to %d is incorrect (PSNR=%g)
\n
"
,
idx
,
err
);
ts
->
printf
(
ts
->
LOG
,
"Saving both frames ...
\n
"
);
ts
->
printf
(
ts
->
LOG
,
"Saving both frames ...
\n
"
);
ts
->
set_failed_test_info
(
ts
->
FAIL_INVALID_OUTPUT
);
ts
->
set_failed_test_info
(
ts
->
FAIL_INVALID_OUTPUT
);
imwrite
(
"opencv_test_highgui_postest_actual.png"
,
img
);
//
imwrite("opencv_test_highgui_postest_actual.png", img);
imwrite
(
"opencv_test_highgui_postest_expected.png"
,
img0
);
//
imwrite("opencv_test_highgui_postest_expected.png", img0);
return
;
return
;
}
}
}
}
...
...
modules/imgproc/test/test_grabcut.cpp
View file @
d9c74f63
modules/imgproc/test/test_watershed.cpp
View file @
d9c74f63
modules/legacy/test/test_em.cpp
View file @
d9c74f63
...
@@ -398,7 +398,7 @@ protected:
...
@@ -398,7 +398,7 @@ protected:
// Write out
// Write out
string
filename
=
tempfile
()
+
".xml"
;
string
filename
=
cv
::
tempfile
(
".xml"
)
;
{
{
FileStorage
fs
=
FileStorage
(
filename
,
FileStorage
::
WRITE
);
FileStorage
fs
=
FileStorage
(
filename
,
FileStorage
::
WRITE
);
try
try
...
...
modules/legacy/test/test_stereomatching.cpp
View file @
d9c74f63
modules/ml/test/test_emknearestkmeans.cpp
View file @
d9c74f63
...
@@ -527,7 +527,7 @@ protected:
...
@@ -527,7 +527,7 @@ protected:
firstResult
.
at
<
int
>
(
i
)
=
static_cast
<
int
>
(
em
.
predict
(
samples
.
row
(
i
))[
1
]);
firstResult
.
at
<
int
>
(
i
)
=
static_cast
<
int
>
(
em
.
predict
(
samples
.
row
(
i
))[
1
]);
// Write out
// Write out
string
filename
=
tempfile
()
+
".xml"
;
string
filename
=
cv
::
tempfile
(
".xml"
)
;
{
{
FileStorage
fs
=
FileStorage
(
filename
,
FileStorage
::
WRITE
);
FileStorage
fs
=
FileStorage
(
filename
,
FileStorage
::
WRITE
);
try
try
...
...
modules/ml/test/test_precomp.hpp
View file @
d9c74f63
modules/ml/test/test_save_load.cpp
View file @
d9c74f63
modules/objdetect/test/test_latentsvmdetector.cpp
View file @
d9c74f63
modules/photo/test/test_inpaint.cpp
View file @
d9c74f63
...
@@ -86,9 +86,6 @@ void CV_InpaintTest::run( int )
...
@@ -86,9 +86,6 @@ void CV_InpaintTest::run( int )
inpaint
(
test
,
mask1ch
,
res1
,
5
,
CV_INPAINT_NS
);
inpaint
(
test
,
mask1ch
,
res1
,
5
,
CV_INPAINT_NS
);
inpaint
(
test
,
mask1ch
,
res2
,
5
,
CV_INPAINT_TELEA
);
inpaint
(
test
,
mask1ch
,
res2
,
5
,
CV_INPAINT_TELEA
);
imwrite
(
"d:/exp1.png"
,
res1
);
imwrite
(
"d:/exp2.png"
,
res2
);
Mat
diff1
,
diff2
;
Mat
diff1
,
diff2
;
absdiff
(
orig
,
res1
,
diff1
);
absdiff
(
orig
,
res1
,
diff1
);
absdiff
(
orig
,
res2
,
diff2
);
absdiff
(
orig
,
res2
,
diff2
);
...
...
modules/python/src2/gen.py
View file @
d9c74f63
...
@@ -37,8 +37,6 @@ for l in open("%s/api" % sys.argv[1]):
...
@@ -37,8 +37,6 @@ for l in open("%s/api" % sys.argv[1]):
# Validation: check that any optional arguments are last
# Validation: check that any optional arguments are last
had_error
=
False
had_error
=
False
for
(
f
,
args
,
ty
,
flags
)
in
api
:
for
(
f
,
args
,
ty
,
flags
)
in
api
:
if
f
==
'PolarToCart'
:
print
f
,
[(
a
.
init
!=
None
)
for
a
in
args
]
has_init
=
[(
a
.
init
!=
None
)
for
a
in
args
if
not
'O'
in
a
.
flags
]
has_init
=
[(
a
.
init
!=
None
)
for
a
in
args
if
not
'O'
in
a
.
flags
]
if
True
in
has_init
and
not
all
(
has_init
[
has_init
.
index
(
True
):]):
if
True
in
has_init
and
not
all
(
has_init
[
has_init
.
index
(
True
):]):
print
'Error in definition for "
%
s", optional arguments must be last'
%
f
print
'Error in definition for "
%
s", optional arguments must be last'
%
f
...
...
modules/ts/misc/run.py
View file @
d9c74f63
...
@@ -653,10 +653,11 @@ class RunInfo(object):
...
@@ -653,10 +653,11 @@ class RunInfo(object):
elif
self
.
targetos
==
"android"
:
elif
self
.
targetos
==
"android"
:
hostlogpath
=
""
hostlogpath
=
""
usercolor
=
[
a
for
a
in
args
if
a
.
startswith
(
"--gtest_color="
)]
usercolor
=
[
a
for
a
in
args
if
a
.
startswith
(
"--gtest_color="
)]
if
len
(
user
log
)
==
0
and
_stdout
.
isatty
()
and
hostos
!=
"nt"
:
if
len
(
user
color
)
==
0
and
_stdout
.
isatty
()
and
hostos
!=
"nt"
:
args
.
append
(
"--gtest_color=yes"
)
args
.
append
(
"--gtest_color=yes"
)
try
:
try
:
andoidcwd
=
"/data/bin/"
+
getpass
.
getuser
()
.
replace
(
" "
,
""
)
+
"_"
+
self
.
options
.
mode
+
"/"
tempdir
=
"/data/local/tmp/"
andoidcwd
=
tempdir
+
getpass
.
getuser
()
.
replace
(
" "
,
""
)
+
"_"
+
self
.
options
.
mode
+
"/"
exename
=
os
.
path
.
basename
(
exe
)
exename
=
os
.
path
.
basename
(
exe
)
androidexe
=
andoidcwd
+
exename
androidexe
=
andoidcwd
+
exename
#upload
#upload
...
@@ -692,6 +693,9 @@ class RunInfo(object):
...
@@ -692,6 +693,9 @@ class RunInfo(object):
return
return
#rm log
#rm log
Popen
(
self
.
adb
+
[
"shell"
,
"rm "
+
andoidcwd
+
logfile
],
stdout
=
_stdout
,
stderr
=
_stderr
)
.
wait
()
Popen
(
self
.
adb
+
[
"shell"
,
"rm "
+
andoidcwd
+
logfile
],
stdout
=
_stdout
,
stderr
=
_stderr
)
.
wait
()
# clean temporary files
Popen
(
self
.
adb
+
[
"shell"
,
"rm "
+
tempdir
+
"__opencv_temp.*"
],
stdout
=
_stdout
,
stderr
=
_stderr
)
.
wait
()
except
OSError
:
except
OSError
:
pass
pass
if
os
.
path
.
isfile
(
hostlogpath
):
if
os
.
path
.
isfile
(
hostlogpath
):
...
@@ -709,6 +713,17 @@ class RunInfo(object):
...
@@ -709,6 +713,17 @@ class RunInfo(object):
except
OSError
:
except
OSError
:
pass
pass
# clean temporary files
temp_path
=
os
.
environ
.
get
(
'OPENCV_TEMP_PATH'
)
if
not
temp_path
:
if
hostos
==
"nt"
:
temp_path
=
tempfile
.
gettempdir
()
else
:
temp_path
=
"/tmp"
for
filename
in
glob
.
glob
(
os
.
path
.
join
(
temp_path
,
"__opencv_temp.*"
))
:
os
.
remove
(
filename
)
logpath
=
os
.
path
.
join
(
workingDir
,
logfile
)
logpath
=
os
.
path
.
join
(
workingDir
,
logfile
)
if
os
.
path
.
isfile
(
logpath
):
if
os
.
path
.
isfile
(
logpath
):
return
logpath
return
logpath
...
...
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