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
c712f376
Commit
c712f376
authored
Apr 10, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed warnings about unused return value of fscanf, scanf and system
parent
7fd1cfc5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
90 additions
and
42 deletions
+90
-42
cvboost.cpp
apps/haartraining/cvboost.cpp
+16
-7
cvhaarclassifier.cpp
apps/haartraining/cvhaarclassifier.cpp
+17
-8
test_cameracalibration.cpp
modules/calib3d/test/test_cameracalibration.cpp
+31
-15
test_mser.cpp
modules/features2d/test/test_mser.cpp
+2
-1
calibfilter.cpp
modules/legacy/src/calibfilter.cpp
+8
-4
mushroom.cpp
samples/c/mushroom.cpp
+8
-3
detector_descriptor_matcher_evaluation.cpp
samples/cpp/detector_descriptor_matcher_evaluation.cpp
+2
-1
hybridtrackingsample.cpp
samples/cpp/hybridtrackingsample.cpp
+4
-2
select3dobj.cpp
samples/cpp/select3dobj.cpp
+2
-1
No files found.
apps/haartraining/cvboost.cpp
View file @
c712f376
...
@@ -3390,6 +3390,7 @@ CvClassifier* cvCreateBtClassifierFromFile( const char* filename )
...
@@ -3390,6 +3390,7 @@ CvClassifier* cvCreateBtClassifierFromFile( const char* filename )
int
num_features
;
int
num_features
;
int
num_classes
;
int
num_classes
;
int
type
;
int
type
;
int
values_read
=
-
1
;
CV_ASSERT
(
filename
!=
NULL
);
CV_ASSERT
(
filename
!=
NULL
);
...
@@ -3400,7 +3401,8 @@ CvClassifier* cvCreateBtClassifierFromFile( const char* filename )
...
@@ -3400,7 +3401,8 @@ CvClassifier* cvCreateBtClassifierFromFile( const char* filename )
CV_ERROR
(
CV_StsError
,
"Unable to open file"
);
CV_ERROR
(
CV_StsError
,
"Unable to open file"
);
}
}
fscanf
(
file
,
"%d %d %d %d"
,
&
type
,
&
num_classes
,
&
num_features
,
&
num_classifiers
);
values_read
=
fscanf
(
file
,
"%d %d %d %d"
,
&
type
,
&
num_classes
,
&
num_features
,
&
num_classifiers
);
CV_Assert
(
values_read
==
4
);
CV_ASSERT
(
type
>=
(
int
)
CV_DABCLASS
&&
type
<=
(
int
)
CV_MREG
);
CV_ASSERT
(
type
>=
(
int
)
CV_DABCLASS
&&
type
<=
(
int
)
CV_MREG
);
CV_ASSERT
(
num_features
>
0
);
CV_ASSERT
(
num_features
>
0
);
...
@@ -3418,7 +3420,8 @@ CvClassifier* cvCreateBtClassifierFromFile( const char* filename )
...
@@ -3418,7 +3420,8 @@ CvClassifier* cvCreateBtClassifierFromFile( const char* filename )
int
count
;
int
count
;
CvCARTClassifier
*
tree
;
CvCARTClassifier
*
tree
;
fscanf
(
file
,
"%d"
,
&
count
);
values_read
=
fscanf
(
file
,
"%d"
,
&
count
);
CV_Assert
(
values_read
==
1
);
data_size
=
sizeof
(
*
tree
)
data_size
=
sizeof
(
*
tree
)
+
count
*
(
sizeof
(
*
(
tree
->
compidx
)
)
+
sizeof
(
*
(
tree
->
threshold
)
)
+
+
count
*
(
sizeof
(
*
(
tree
->
compidx
)
)
+
sizeof
(
*
(
tree
->
threshold
)
)
+
...
@@ -3439,14 +3442,16 @@ CvClassifier* cvCreateBtClassifierFromFile( const char* filename )
...
@@ -3439,14 +3442,16 @@ CvClassifier* cvCreateBtClassifierFromFile( const char* filename )
tree
->
count
=
count
;
tree
->
count
=
count
;
for
(
j
=
0
;
j
<
tree
->
count
;
j
++
)
for
(
j
=
0
;
j
<
tree
->
count
;
j
++
)
{
{
fscanf
(
file
,
"%d %g %d %d"
,
&
(
tree
->
compidx
[
j
]),
values_read
=
fscanf
(
file
,
"%d %g %d %d"
,
&
(
tree
->
compidx
[
j
]),
&
(
tree
->
threshold
[
j
]),
&
(
tree
->
threshold
[
j
]),
&
(
tree
->
left
[
j
]),
&
(
tree
->
left
[
j
]),
&
(
tree
->
right
[
j
])
);
&
(
tree
->
right
[
j
])
);
CV_Assert
(
values_read
==
4
);
}
}
for
(
j
=
0
;
j
<=
tree
->
count
;
j
++
)
for
(
j
=
0
;
j
<=
tree
->
count
;
j
++
)
{
{
fscanf
(
file
,
"%g"
,
&
(
tree
->
val
[
j
])
);
values_read
=
fscanf
(
file
,
"%g"
,
&
(
tree
->
val
[
j
])
);
CV_Assert
(
values_read
==
1
);
}
}
ptr
->
trees
[
i
]
=
tree
;
ptr
->
trees
[
i
]
=
tree
;
}
}
...
@@ -3553,6 +3558,7 @@ void cvReadTrainData( const char* filename, int flags,
...
@@ -3553,6 +3558,7 @@ void cvReadTrainData( const char* filename, int flags,
int
m
,
n
;
int
m
,
n
;
int
i
,
j
;
int
i
,
j
;
float
val
;
float
val
;
int
values_read
=
-
1
;
if
(
filename
==
NULL
)
if
(
filename
==
NULL
)
{
{
...
@@ -3575,7 +3581,8 @@ void cvReadTrainData( const char* filename, int flags,
...
@@ -3575,7 +3581,8 @@ void cvReadTrainData( const char* filename, int flags,
CV_ERROR
(
CV_StsError
,
"Unable to open file"
);
CV_ERROR
(
CV_StsError
,
"Unable to open file"
);
}
}
fscanf
(
file
,
"%d %d"
,
&
m
,
&
n
);
values_read
=
fscanf
(
file
,
"%d %d"
,
&
m
,
&
n
);
CV_Assert
(
values_read
==
2
);
if
(
CV_IS_ROW_SAMPLE
(
flags
)
)
if
(
CV_IS_ROW_SAMPLE
(
flags
)
)
{
{
...
@@ -3592,7 +3599,8 @@ void cvReadTrainData( const char* filename, int flags,
...
@@ -3592,7 +3599,8 @@ void cvReadTrainData( const char* filename, int flags,
{
{
for
(
j
=
0
;
j
<
n
;
j
++
)
for
(
j
=
0
;
j
<
n
;
j
++
)
{
{
fscanf
(
file
,
"%f"
,
&
val
);
values_read
=
fscanf
(
file
,
"%f"
,
&
val
);
CV_Assert
(
values_read
==
1
);
if
(
CV_IS_ROW_SAMPLE
(
flags
)
)
if
(
CV_IS_ROW_SAMPLE
(
flags
)
)
{
{
CV_MAT_ELEM
(
**
trainData
,
float
,
i
,
j
)
=
val
;
CV_MAT_ELEM
(
**
trainData
,
float
,
i
,
j
)
=
val
;
...
@@ -3602,7 +3610,8 @@ void cvReadTrainData( const char* filename, int flags,
...
@@ -3602,7 +3610,8 @@ void cvReadTrainData( const char* filename, int flags,
CV_MAT_ELEM
(
**
trainData
,
float
,
j
,
i
)
=
val
;
CV_MAT_ELEM
(
**
trainData
,
float
,
j
,
i
)
=
val
;
}
}
}
}
fscanf
(
file
,
"%f"
,
&
val
);
values_read
=
fscanf
(
file
,
"%f"
,
&
val
);
CV_Assert
(
values_read
==
2
);
CV_MAT_ELEM
(
**
trainClasses
,
float
,
0
,
i
)
=
val
;
CV_MAT_ELEM
(
**
trainClasses
,
float
,
0
,
i
)
=
val
;
}
}
...
...
apps/haartraining/cvhaarclassifier.cpp
View file @
c712f376
...
@@ -285,18 +285,20 @@ void icvLoadHaarFeature( CvTHaarFeature* feature, FILE* file )
...
@@ -285,18 +285,20 @@ void icvLoadHaarFeature( CvTHaarFeature* feature, FILE* file )
int
weight
;
int
weight
;
nrect
=
0
;
nrect
=
0
;
fscanf
(
file
,
"%d"
,
&
nrect
);
int
values_read
=
fscanf
(
file
,
"%d"
,
&
nrect
);
CV_Assert
(
values_read
==
1
);
assert
(
nrect
<=
CV_HAAR_FEATURE_MAX
);
assert
(
nrect
<=
CV_HAAR_FEATURE_MAX
);
for
(
j
=
0
;
j
<
nrect
;
j
++
)
for
(
j
=
0
;
j
<
nrect
;
j
++
)
{
{
fscanf
(
file
,
"%d %d %d %d %d %d"
,
values_read
=
fscanf
(
file
,
"%d %d %d %d %d %d"
,
&
(
feature
->
rect
[
j
].
r
.
x
),
&
(
feature
->
rect
[
j
].
r
.
x
),
&
(
feature
->
rect
[
j
].
r
.
y
),
&
(
feature
->
rect
[
j
].
r
.
y
),
&
(
feature
->
rect
[
j
].
r
.
width
),
&
(
feature
->
rect
[
j
].
r
.
width
),
&
(
feature
->
rect
[
j
].
r
.
height
),
&
(
feature
->
rect
[
j
].
r
.
height
),
&
tmp
,
&
weight
);
&
tmp
,
&
weight
);
CV_Assert
(
values_read
==
6
);
feature
->
rect
[
j
].
weight
=
(
float
)
weight
;
feature
->
rect
[
j
].
weight
=
(
float
)
weight
;
}
}
for
(
j
=
nrect
;
j
<
CV_HAAR_FEATURE_MAX
;
j
++
)
for
(
j
=
nrect
;
j
<
CV_HAAR_FEATURE_MAX
;
j
++
)
...
@@ -307,7 +309,8 @@ void icvLoadHaarFeature( CvTHaarFeature* feature, FILE* file )
...
@@ -307,7 +309,8 @@ void icvLoadHaarFeature( CvTHaarFeature* feature, FILE* file )
feature
->
rect
[
j
].
r
.
height
=
0
;
feature
->
rect
[
j
].
r
.
height
=
0
;
feature
->
rect
[
j
].
weight
=
0.0
f
;
feature
->
rect
[
j
].
weight
=
0.0
f
;
}
}
fscanf
(
file
,
"%s"
,
&
(
feature
->
desc
[
0
])
);
values_read
=
fscanf
(
file
,
"%s"
,
&
(
feature
->
desc
[
0
])
);
CV_Assert
(
values_read
==
1
);
feature
->
tilted
=
(
feature
->
desc
[
0
]
==
't'
);
feature
->
tilted
=
(
feature
->
desc
[
0
]
==
't'
);
}
}
...
@@ -342,19 +345,23 @@ CvIntHaarClassifier* icvLoadCARTHaarClassifier( FILE* file, int step )
...
@@ -342,19 +345,23 @@ CvIntHaarClassifier* icvLoadCARTHaarClassifier( FILE* file, int step )
int
count
;
int
count
;
ptr
=
NULL
;
ptr
=
NULL
;
fscanf
(
file
,
"%d"
,
&
count
);
int
values_read
=
fscanf
(
file
,
"%d"
,
&
count
);
CV_Assert
(
values_read
==
1
);
if
(
count
>
0
)
if
(
count
>
0
)
{
{
ptr
=
(
CvCARTHaarClassifier
*
)
icvCreateCARTHaarClassifier
(
count
);
ptr
=
(
CvCARTHaarClassifier
*
)
icvCreateCARTHaarClassifier
(
count
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
icvLoadHaarFeature
(
&
(
ptr
->
feature
[
i
]),
file
);
icvLoadHaarFeature
(
&
(
ptr
->
feature
[
i
]),
file
);
fscanf
(
file
,
"%f %d %d"
,
&
(
ptr
->
threshold
[
i
]),
&
(
ptr
->
left
[
i
]),
values_read
=
fscanf
(
file
,
"%f %d %d"
,
&
(
ptr
->
threshold
[
i
]),
&
(
ptr
->
left
[
i
]),
&
(
ptr
->
right
[
i
])
);
&
(
ptr
->
right
[
i
])
);
CV_Assert
(
values_read
==
3
);
}
}
for
(
i
=
0
;
i
<=
count
;
i
++
)
for
(
i
=
0
;
i
<=
count
;
i
++
)
{
{
fscanf
(
file
,
"%f"
,
&
(
ptr
->
val
[
i
])
);
values_read
=
fscanf
(
file
,
"%f"
,
&
(
ptr
->
val
[
i
])
);
CV_Assert
(
values_read
==
1
);
}
}
icvConvertToFastHaarFeature
(
ptr
->
feature
,
ptr
->
fastfeature
,
ptr
->
count
,
step
);
icvConvertToFastHaarFeature
(
ptr
->
feature
,
ptr
->
fastfeature
,
ptr
->
count
,
step
);
}
}
...
@@ -402,7 +409,8 @@ CvIntHaarClassifier* icvLoadCARTStageHaarClassifierF( FILE* file, int step )
...
@@ -402,7 +409,8 @@ CvIntHaarClassifier* icvLoadCARTStageHaarClassifierF( FILE* file, int step )
float
threshold
;
float
threshold
;
count
=
0
;
count
=
0
;
fscanf
(
file
,
"%d"
,
&
count
);
int
values_read
=
fscanf
(
file
,
"%d"
,
&
count
);
CV_Assert
(
values_read
==
1
);
if
(
count
>
0
)
if
(
count
>
0
)
{
{
ptr
=
(
CvStageHaarClassifier
*
)
icvCreateStageHaarClassifier
(
count
,
0.0
F
);
ptr
=
(
CvStageHaarClassifier
*
)
icvCreateStageHaarClassifier
(
count
,
0.0
F
);
...
@@ -411,7 +419,8 @@ CvIntHaarClassifier* icvLoadCARTStageHaarClassifierF( FILE* file, int step )
...
@@ -411,7 +419,8 @@ CvIntHaarClassifier* icvLoadCARTStageHaarClassifierF( FILE* file, int step )
ptr
->
classifier
[
i
]
=
icvLoadCARTHaarClassifier
(
file
,
step
);
ptr
->
classifier
[
i
]
=
icvLoadCARTHaarClassifier
(
file
,
step
);
}
}
fscanf
(
file
,
"%f"
,
&
threshold
);
values_read
=
fscanf
(
file
,
"%f"
,
&
threshold
);
CV_Assert
(
values_read
==
1
);
ptr
->
threshold
=
threshold
;
ptr
->
threshold
=
threshold
;
/* to be compatible with the previous implementation */
/* to be compatible with the previous implementation */
...
...
modules/calib3d/test/test_cameracalibration.cpp
View file @
c712f376
...
@@ -333,6 +333,7 @@ void CV_CameraCalibrationTest::run( int start_from )
...
@@ -333,6 +333,7 @@ void CV_CameraCalibrationTest::run( int start_from )
goodTransVects
=
0
;
goodTransVects
=
0
;
goodRotMatrs
=
0
;
goodRotMatrs
=
0
;
int
progress
=
0
;
int
progress
=
0
;
int
values_read
=
-
1
;
sprintf
(
filepath
,
"%scameracalibration/"
,
ts
->
get_data_path
().
c_str
()
);
sprintf
(
filepath
,
"%scameracalibration/"
,
ts
->
get_data_path
().
c_str
()
);
sprintf
(
filename
,
"%sdatafiles.txt"
,
filepath
);
sprintf
(
filename
,
"%sdatafiles.txt"
,
filepath
);
...
@@ -344,11 +345,13 @@ void CV_CameraCalibrationTest::run( int start_from )
...
@@ -344,11 +345,13 @@ void CV_CameraCalibrationTest::run( int start_from )
goto
_exit_
;
goto
_exit_
;
}
}
fscanf
(
datafile
,
"%d"
,
&
numTests
);
values_read
=
fscanf
(
datafile
,
"%d"
,
&
numTests
);
CV_Assert
(
values_read
==
1
);
for
(
currTest
=
start_from
;
currTest
<
numTests
;
currTest
++
)
for
(
currTest
=
start_from
;
currTest
<
numTests
;
currTest
++
)
{
{
fscanf
(
datafile
,
"%s"
,
i_dat_file
);
values_read
=
fscanf
(
datafile
,
"%s"
,
i_dat_file
);
CV_Assert
(
values_read
==
1
);
sprintf
(
filename
,
"%s%s"
,
filepath
,
i_dat_file
);
sprintf
(
filename
,
"%s%s"
,
filepath
,
i_dat_file
);
file
=
fopen
(
filename
,
"r"
);
file
=
fopen
(
filename
,
"r"
);
...
@@ -366,7 +369,8 @@ void CV_CameraCalibrationTest::run( int start_from )
...
@@ -366,7 +369,8 @@ void CV_CameraCalibrationTest::run( int start_from )
continue
;
// if there is more than one test, just skip the test
continue
;
// if there is more than one test, just skip the test
}
}
fscanf
(
file
,
"%d %d
\n
"
,
&
(
imageSize
.
width
),
&
(
imageSize
.
height
));
values_read
=
fscanf
(
file
,
"%d %d
\n
"
,
&
(
imageSize
.
width
),
&
(
imageSize
.
height
));
CV_Assert
(
values_read
==
2
);
if
(
imageSize
.
width
<=
0
||
imageSize
.
height
<=
0
)
if
(
imageSize
.
width
<=
0
||
imageSize
.
height
<=
0
)
{
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Image size in test file is incorrect
\n
"
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Image size in test file is incorrect
\n
"
);
...
@@ -375,7 +379,8 @@ void CV_CameraCalibrationTest::run( int start_from )
...
@@ -375,7 +379,8 @@ void CV_CameraCalibrationTest::run( int start_from )
}
}
/* Read etalon size */
/* Read etalon size */
fscanf
(
file
,
"%d %d
\n
"
,
&
(
etalonSize
.
width
),
&
(
etalonSize
.
height
));
values_read
=
fscanf
(
file
,
"%d %d
\n
"
,
&
(
etalonSize
.
width
),
&
(
etalonSize
.
height
));
CV_Assert
(
values_read
==
2
);
if
(
etalonSize
.
width
<=
0
||
etalonSize
.
height
<=
0
)
if
(
etalonSize
.
width
<=
0
||
etalonSize
.
height
<=
0
)
{
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Pattern size in test file is incorrect
\n
"
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Pattern size in test file is incorrect
\n
"
);
...
@@ -386,7 +391,8 @@ void CV_CameraCalibrationTest::run( int start_from )
...
@@ -386,7 +391,8 @@ void CV_CameraCalibrationTest::run( int start_from )
numPoints
=
etalonSize
.
width
*
etalonSize
.
height
;
numPoints
=
etalonSize
.
width
*
etalonSize
.
height
;
/* Read number of images */
/* Read number of images */
fscanf
(
file
,
"%d
\n
"
,
&
numImages
);
values_read
=
fscanf
(
file
,
"%d
\n
"
,
&
numImages
);
CV_Assert
(
values_read
==
1
);
if
(
numImages
<=
0
)
if
(
numImages
<=
0
)
{
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Number of images in test file is incorrect
\n
"
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Number of images in test file is incorrect
\n
"
);
...
@@ -427,7 +433,8 @@ void CV_CameraCalibrationTest::run( int start_from )
...
@@ -427,7 +433,8 @@ void CV_CameraCalibrationTest::run( int start_from )
for
(
currPoint
=
0
;
currPoint
<
numPoints
;
currPoint
++
)
for
(
currPoint
=
0
;
currPoint
<
numPoints
;
currPoint
++
)
{
{
double
x
,
y
,
z
;
double
x
,
y
,
z
;
fscanf
(
file
,
"%lf %lf %lf
\n
"
,
&
x
,
&
y
,
&
z
);
values_read
=
fscanf
(
file
,
"%lf %lf %lf
\n
"
,
&
x
,
&
y
,
&
z
);
CV_Assert
(
values_read
==
3
);
(
objectPoints
+
i
)
->
x
=
x
;
(
objectPoints
+
i
)
->
x
=
x
;
(
objectPoints
+
i
)
->
y
=
y
;
(
objectPoints
+
i
)
->
y
=
y
;
...
@@ -443,7 +450,8 @@ void CV_CameraCalibrationTest::run( int start_from )
...
@@ -443,7 +450,8 @@ void CV_CameraCalibrationTest::run( int start_from )
for
(
currPoint
=
0
;
currPoint
<
numPoints
;
currPoint
++
)
for
(
currPoint
=
0
;
currPoint
<
numPoints
;
currPoint
++
)
{
{
double
x
,
y
;
double
x
,
y
;
fscanf
(
file
,
"%lf %lf
\n
"
,
&
x
,
&
y
);
values_read
=
fscanf
(
file
,
"%lf %lf
\n
"
,
&
x
,
&
y
);
CV_Assert
(
values_read
==
2
);
(
imagePoints
+
i
)
->
x
=
x
;
(
imagePoints
+
i
)
->
x
=
x
;
(
imagePoints
+
i
)
->
y
=
y
;
(
imagePoints
+
i
)
->
y
=
y
;
...
@@ -455,32 +463,40 @@ void CV_CameraCalibrationTest::run( int start_from )
...
@@ -455,32 +463,40 @@ void CV_CameraCalibrationTest::run( int start_from )
/* Focal lengths */
/* Focal lengths */
double
goodFcx
,
goodFcy
;
double
goodFcx
,
goodFcy
;
fscanf
(
file
,
"%lf %lf"
,
&
goodFcx
,
&
goodFcy
);
values_read
=
fscanf
(
file
,
"%lf %lf"
,
&
goodFcx
,
&
goodFcy
);
CV_Assert
(
values_read
==
2
);
/* Principal points */
/* Principal points */
double
goodCx
,
goodCy
;
double
goodCx
,
goodCy
;
fscanf
(
file
,
"%lf %lf"
,
&
goodCx
,
&
goodCy
);
values_read
=
fscanf
(
file
,
"%lf %lf"
,
&
goodCx
,
&
goodCy
);
CV_Assert
(
values_read
==
2
);
/* Read distortion */
/* Read distortion */
fscanf
(
file
,
"%lf"
,
goodDistortion
+
0
);
values_read
=
fscanf
(
file
,
"%lf"
,
goodDistortion
+
0
);
CV_Assert
(
values_read
==
1
);
fscanf
(
file
,
"%lf"
,
goodDistortion
+
1
);
values_read
=
fscanf
(
file
,
"%lf"
,
goodDistortion
+
1
);
CV_Assert
(
values_read
==
1
);
fscanf
(
file
,
"%lf"
,
goodDistortion
+
2
);
values_read
=
fscanf
(
file
,
"%lf"
,
goodDistortion
+
2
);
CV_Assert
(
values_read
==
1
);
fscanf
(
file
,
"%lf"
,
goodDistortion
+
3
);
values_read
=
fscanf
(
file
,
"%lf"
,
goodDistortion
+
3
);
CV_Assert
(
values_read
==
1
);
/* Read good Rot matrixes */
/* Read good Rot matrixes */
for
(
currImage
=
0
;
currImage
<
numImages
;
currImage
++
)
for
(
currImage
=
0
;
currImage
<
numImages
;
currImage
++
)
{
{
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
j
=
0
;
j
<
3
;
j
++
)
for
(
j
=
0
;
j
<
3
;
j
++
)
fscanf
(
file
,
"%lf"
,
goodRotMatrs
+
currImage
*
9
+
j
*
3
+
i
);
{
values_read
=
fscanf
(
file
,
"%lf"
,
goodRotMatrs
+
currImage
*
9
+
j
*
3
+
i
);
CV_Assert
(
values_read
==
1
);
}
}
}
/* Read good Trans vectors */
/* Read good Trans vectors */
for
(
currImage
=
0
;
currImage
<
numImages
;
currImage
++
)
for
(
currImage
=
0
;
currImage
<
numImages
;
currImage
++
)
{
{
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
3
;
i
++
)
fscanf
(
file
,
"%lf"
,
goodTransVects
+
currImage
*
3
+
i
);
{
values_read
=
fscanf
(
file
,
"%lf"
,
goodTransVects
+
currImage
*
3
+
i
);
CV_Assert
(
values_read
==
1
);
}
}
}
calibFlags
=
0
calibFlags
=
0
...
...
modules/features2d/test/test_mser.cpp
View file @
c712f376
...
@@ -75,7 +75,8 @@ int CV_MserTest::LoadBoxes(const char* path, vector<CvBox2D>& boxes)
...
@@ -75,7 +75,8 @@ int CV_MserTest::LoadBoxes(const char* path, vector<CvBox2D>& boxes)
while
(
!
feof
(
f
))
while
(
!
feof
(
f
))
{
{
CvBox2D
box
;
CvBox2D
box
;
fscanf
(
f
,
"%f,%f,%f,%f,%f
\n
"
,
&
box
.
angle
,
&
box
.
center
.
x
,
&
box
.
center
.
y
,
&
box
.
size
.
width
,
&
box
.
size
.
height
);
int
values_read
=
fscanf
(
f
,
"%f,%f,%f,%f,%f
\n
"
,
&
box
.
angle
,
&
box
.
center
.
x
,
&
box
.
center
.
y
,
&
box
.
size
.
width
,
&
box
.
size
.
height
);
CV_Assert
(
values_read
==
5
);
boxes
.
push_back
(
box
);
boxes
.
push_back
(
box
);
}
}
fclose
(
f
);
fclose
(
f
);
...
...
modules/legacy/src/calibfilter.cpp
View file @
c712f376
...
@@ -734,7 +734,8 @@ bool CvCalibFilter::LoadCameraParams( const char* filename )
...
@@ -734,7 +734,8 @@ bool CvCalibFilter::LoadCameraParams( const char* filename )
{
{
for
(
j
=
0
;
j
<
(
int
)(
sizeof
(
cameraParams
[
i
])
/
sizeof
(
float
));
j
++
)
for
(
j
=
0
;
j
<
(
int
)(
sizeof
(
cameraParams
[
i
])
/
sizeof
(
float
));
j
++
)
{
{
fscanf
(
f
,
"%f"
,
&
((
float
*
)(
cameraParams
+
i
))[
j
]
);
int
values_read
=
fscanf
(
f
,
"%f"
,
&
((
float
*
)(
cameraParams
+
i
))[
j
]
);
CV_Assert
(
values_read
==
1
);
}
}
}
}
...
@@ -746,8 +747,10 @@ bool CvCalibFilter::LoadCameraParams( const char* filename )
...
@@ -746,8 +747,10 @@ bool CvCalibFilter::LoadCameraParams( const char* filename )
{
{
for
(
j
=
0
;
j
<
4
;
j
++
)
for
(
j
=
0
;
j
<
4
;
j
++
)
{
{
fscanf
(
f
,
"%f "
,
&
(
stereo
.
quad
[
i
][
j
].
x
)
);
int
values_read
=
fscanf
(
f
,
"%f "
,
&
(
stereo
.
quad
[
i
][
j
].
x
)
);
fscanf
(
f
,
"%f "
,
&
(
stereo
.
quad
[
i
][
j
].
y
)
);
CV_Assert
(
values_read
==
1
);
values_read
=
fscanf
(
f
,
"%f "
,
&
(
stereo
.
quad
[
i
][
j
].
y
)
);
CV_Assert
(
values_read
==
1
);
}
}
}
}
...
@@ -756,7 +759,8 @@ bool CvCalibFilter::LoadCameraParams( const char* filename )
...
@@ -756,7 +759,8 @@ bool CvCalibFilter::LoadCameraParams( const char* filename )
{
{
for
(
j
=
0
;
j
<
9
;
j
++
)
for
(
j
=
0
;
j
<
9
;
j
++
)
{
{
fscanf
(
f
,
"%lf "
,
&
(
stereo
.
coeffs
[
i
][
j
/
3
][
j
%
3
])
);
int
values_read
=
fscanf
(
f
,
"%lf "
,
&
(
stereo
.
coeffs
[
i
][
j
/
3
][
j
%
3
])
);
CV_Assert
(
values_read
==
1
);
}
}
}
}
...
...
samples/c/mushroom.cpp
View file @
c712f376
...
@@ -192,7 +192,9 @@ void print_variable_importance( CvDTree* dtree, const char** var_desc )
...
@@ -192,7 +192,9 @@ void print_variable_importance( CvDTree* dtree, const char** var_desc )
}
}
printf
(
"Print variable importance information? (y/n) "
);
printf
(
"Print variable importance information? (y/n) "
);
scanf
(
"%1s"
,
input
);
int
values_read
=
scanf
(
"%1s"
,
input
);
CV_Assert
(
values_read
==
1
);
if
(
input
[
0
]
!=
'y'
&&
input
[
0
]
!=
'Y'
)
if
(
input
[
0
]
!=
'y'
&&
input
[
0
]
!=
'Y'
)
return
;
return
;
...
@@ -230,7 +232,9 @@ void interactive_classification( CvDTree* dtree, const char** var_desc )
...
@@ -230,7 +232,9 @@ void interactive_classification( CvDTree* dtree, const char** var_desc )
const
CvDTreeNode
*
node
;
const
CvDTreeNode
*
node
;
printf
(
"Start/Proceed with interactive mushroom classification (y/n): "
);
printf
(
"Start/Proceed with interactive mushroom classification (y/n): "
);
scanf
(
"%1s"
,
input
);
int
values_read
=
scanf
(
"%1s"
,
input
);
CV_Assert
(
values_read
==
1
);
if
(
input
[
0
]
!=
'y'
&&
input
[
0
]
!=
'Y'
)
if
(
input
[
0
]
!=
'y'
&&
input
[
0
]
!=
'Y'
)
break
;
break
;
printf
(
"Enter 1-letter answers, '?' for missing/unknown value...
\n
"
);
printf
(
"Enter 1-letter answers, '?' for missing/unknown value...
\n
"
);
...
@@ -252,7 +256,8 @@ void interactive_classification( CvDTree* dtree, const char** var_desc )
...
@@ -252,7 +256,8 @@ void interactive_classification( CvDTree* dtree, const char** var_desc )
const
int
*
map
=
data
->
cat_map
->
data
.
i
+
data
->
cat_ofs
->
data
.
i
[
vi
];
const
int
*
map
=
data
->
cat_map
->
data
.
i
+
data
->
cat_ofs
->
data
.
i
[
vi
];
printf
(
"%s: "
,
var_desc
[
vi
]
);
printf
(
"%s: "
,
var_desc
[
vi
]
);
scanf
(
"%1s"
,
input
);
values_read
=
scanf
(
"%1s"
,
input
);
CV_Assert
(
values_read
==
1
);
if
(
input
[
0
]
==
'?'
)
if
(
input
[
0
]
==
'?'
)
{
{
...
...
samples/cpp/detector_descriptor_matcher_evaluation.cpp
View file @
c712f376
...
@@ -273,7 +273,8 @@ int main(int argc, char** argv)
...
@@ -273,7 +273,8 @@ int main(int argc, char** argv)
if
(
dir
[
dir
.
size
()
-
1
]
!=
'\\'
&&
dir
[
dir
.
size
()
-
1
]
!=
'/'
)
if
(
dir
[
dir
.
size
()
-
1
]
!=
'\\'
&&
dir
[
dir
.
size
()
-
1
]
!=
'/'
)
dir
+=
"/"
;
dir
+=
"/"
;
system
((
"mkdir "
+
dir
).
c_str
());
int
result
=
system
((
"mkdir "
+
dir
).
c_str
());
CV_Assert
(
result
==
0
);
for
(
int
i
=
0
;
ddms
[
i
*
4
]
!=
0
;
i
++
)
for
(
int
i
=
0
;
ddms
[
i
*
4
]
!=
0
;
i
++
)
{
{
...
...
samples/cpp/hybridtrackingsample.cpp
View file @
c712f376
...
@@ -82,7 +82,8 @@ int main(int argc, char** argv)
...
@@ -82,7 +82,8 @@ int main(int argc, char** argv)
sprintf
(
test_file
,
"%s"
,
argv
[
1
]);
sprintf
(
test_file
,
"%s"
,
argv
[
1
]);
f
=
fopen
(
test_file
,
"r"
);
f
=
fopen
(
test_file
,
"r"
);
char
vid
[
20
];
char
vid
[
20
];
fscanf
(
f
,
"%s
\n
"
,
vid
);
int
values_read
=
fscanf
(
f
,
"%s
\n
"
,
vid
);
CV_Assert
(
values_read
==
1
);
cout
<<
"Benchmarking against "
<<
vid
<<
endl
;
cout
<<
"Benchmarking against "
<<
vid
<<
endl
;
live
=
0
;
live
=
0
;
}
}
...
@@ -133,7 +134,8 @@ int main(int argc, char** argv)
...
@@ -133,7 +134,8 @@ int main(int argc, char** argv)
}
}
else
else
{
{
fscanf
(
f
,
"%d %f %f %f %f
\n
"
,
&
i
,
&
w
[
0
],
&
w
[
1
],
&
w
[
2
],
&
w
[
3
]);
int
values_read
=
fscanf
(
f
,
"%d %f %f %f %f
\n
"
,
&
i
,
&
w
[
0
],
&
w
[
1
],
&
w
[
2
],
&
w
[
3
]);
CV_Assert
(
values_read
==
5
);
sprintf
(
img_file
,
"seqG/%04d.png"
,
i
);
sprintf
(
img_file
,
"seqG/%04d.png"
,
i
);
image
=
imread
(
img_file
,
CV_LOAD_IMAGE_COLOR
);
image
=
imread
(
img_file
,
CV_LOAD_IMAGE_COLOR
);
if
(
image
.
empty
())
if
(
image
.
empty
())
...
...
samples/cpp/select3dobj.cpp
View file @
c712f376
...
@@ -491,7 +491,8 @@ int main(int argc, char** argv)
...
@@ -491,7 +491,8 @@ int main(int argc, char** argv)
if
(
outbarename
)
if
(
outbarename
)
{
{
cmd
[
6
+
outbarename
-
outprefix
]
=
'\0'
;
cmd
[
6
+
outbarename
-
outprefix
]
=
'\0'
;
system
(
cmd
);
int
result
=
system
(
cmd
);
CV_Assert
(
result
==
0
);
outbarename
++
;
outbarename
++
;
}
}
else
else
...
...
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