Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
29b6529c
Commit
29b6529c
authored
Aug 03, 2014
by
biagio montesano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional cast warnings resolved
parent
d19f2ba6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
16 deletions
+17
-16
knn_matching.cpp
modules/line_descriptor/samples/knn_matching.cpp
+2
-2
LSDDetector.cpp
modules/line_descriptor/src/LSDDetector.cpp
+11
-11
ed_line_detector.cpp
modules/line_descriptor/src/ed_line_detector.cpp
+4
-3
No files found.
modules/line_descriptor/samples/knn_matching.cpp
View file @
29b6529c
...
...
@@ -111,7 +111,7 @@ uchar invertSingleBits( uchar dividend_char, int numBits )
/* reconvert to decimal */
uchar
result
=
0
;
for
(
int
i
=
(
int
)
bin_vector
.
size
()
-
1
;
i
>=
0
;
i
--
)
result
+=
bin_vector
[
i
]
*
pow
(
2
,
i
);
result
+=
(
uchar
)
(
bin_vector
[
i
]
*
pow
(
2
,
i
)
);
return
result
;
}
...
...
@@ -162,7 +162,7 @@ int main( int argc, char** argv )
Mat
descr2Copy
=
descr1
.
clone
();
/* randomly change some bits in original descriptors */
srand
(
time
(
NULL
)
);
srand
(
(
unsigned
int
)
time
(
NULL
)
);
for
(
int
j
=
0
;
j
<
descr1
.
rows
;
j
++
)
{
...
...
modules/line_descriptor/src/LSDDetector.cpp
View file @
29b6529c
...
...
@@ -167,15 +167,15 @@ void LSDDetector::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keyline
checkLineExtremes
(
extremes
,
gaussianPyrs
[
j
].
size
()
);
/* fill KeyLine's fields */
kl
.
startPointX
=
extremes
[
0
];
kl
.
startPointY
=
extremes
[
1
];
kl
.
endPointX
=
extremes
[
2
];
kl
.
endPointY
=
extremes
[
3
];
kl
.
sPointInOctaveX
=
extremes
[
0
];
kl
.
sPointInOctaveY
=
extremes
[
1
];
kl
.
ePointInOctaveX
=
extremes
[
2
];
kl
.
ePointInOctaveY
=
extremes
[
3
];
kl
.
lineLength
=
sqrt
(
pow
(
extremes
[
0
]
-
extremes
[
2
],
2
)
+
pow
(
extremes
[
1
]
-
extremes
[
3
],
2
)
);
kl
.
startPointX
=
(
float
)
extremes
[
0
];
kl
.
startPointY
=
(
float
)
extremes
[
1
];
kl
.
endPointX
=
(
float
)
extremes
[
2
];
kl
.
endPointY
=
(
float
)
extremes
[
3
];
kl
.
sPointInOctaveX
=
(
float
)
extremes
[
0
];
kl
.
sPointInOctaveY
=
(
float
)
extremes
[
1
];
kl
.
ePointInOctaveX
=
(
float
)
extremes
[
2
];
kl
.
ePointInOctaveY
=
(
float
)
extremes
[
3
];
kl
.
lineLength
=
(
float
)
sqrt
(
pow
(
extremes
[
0
]
-
extremes
[
2
],
2
)
+
pow
(
extremes
[
1
]
-
extremes
[
3
],
2
)
);
/* compute number of pixels covered by line */
LineIterator
li
(
gaussianPyrs
[
j
],
Point
(
extremes
[
0
],
extremes
[
1
]
),
Point
(
extremes
[
2
],
extremes
[
3
]
)
);
...
...
@@ -186,7 +186,7 @@ void LSDDetector::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keyline
kl
.
octave
=
j
;
kl
.
size
=
(
kl
.
endPointX
-
kl
.
startPointX
)
*
(
kl
.
endPointY
-
kl
.
startPointY
);
kl
.
response
=
kl
.
lineLength
/
max
(
gaussianPyrs
[
j
].
cols
,
gaussianPyrs
[
j
].
rows
);
kl
.
pt
=
Point
(
(
kl
.
endPointX
+
kl
.
startPointX
)
/
2
,
(
kl
.
endPointY
+
kl
.
startPointY
)
/
2
);
kl
.
pt
=
Point
2f
(
(
kl
.
endPointX
+
kl
.
startPointX
)
/
2
,
(
kl
.
endPointY
+
kl
.
startPointY
)
/
2
);
keylines
.
push_back
(
kl
);
}
...
...
@@ -198,7 +198,7 @@ void LSDDetector::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keyline
for
(
size_t
keyCounter
=
0
;
keyCounter
<
keylines
.
size
();
keyCounter
++
)
{
KeyLine
kl
=
keylines
[
keyCounter
];
if
(
mask
.
at
<
uchar
>
(
kl
.
startPointY
,
kl
.
startPointX
)
==
0
&&
mask
.
at
<
uchar
>
(
kl
.
endPointY
,
kl
.
endPointX
)
==
0
)
if
(
mask
.
at
<
uchar
>
(
(
int
)
kl
.
startPointY
,
(
int
)
kl
.
startPointX
)
==
0
&&
mask
.
at
<
uchar
>
(
(
int
)
kl
.
endPointY
,
(
int
)
kl
.
endPointX
)
==
0
)
keylines
.
erase
(
keylines
.
begin
()
+
keyCounter
);
}
}
...
...
modules/line_descriptor/src/ed_line_detector.cpp
View file @
29b6529c
...
...
@@ -948,14 +948,15 @@ int EDLineDetector::EDline( cv::Mat &image, LineChains &lines, bool smoothed )
unsigned
int
*
pLineYCors
=
lines
.
yCors
.
data
();
unsigned
int
*
pLineSID
=
lines
.
sId
.
data
();
logNT_
=
2.0
*
(
log10
(
(
double
)
imageWidth
)
+
log10
(
(
double
)
imageHeight
)
);
double
lineFitErr
;
//the line fit error;
double
lineFitErr
=
0
;
//the line fit error;
std
::
vector
<
double
>
lineEquation
(
2
,
0
);
lineEquations_
.
clear
();
lineEndpoints_
.
clear
();
lineDirection_
.
clear
();
unsigned
char
*
pdirImg
=
dirImg_
.
data
;
unsigned
int
numOfLines
=
0
;
unsigned
int
offsetInEdgeArrayS
,
offsetInEdgeArrayE
,
newOffsetS
;
//start index and end index
unsigned
int
newOffsetS
=
0
;
unsigned
int
offsetInEdgeArrayS
,
offsetInEdgeArrayE
;
//start index and end index
unsigned
int
offsetInLineArray
=
0
;
float
direction
;
//line direction
...
...
@@ -977,7 +978,7 @@ int EDLineDetector::EDline( cv::Mat &image, LineChains &lines, bool smoothed )
break
;
//no line is detected
//An initial line segment is detected. Try to extend this line segment
pLineSID
[
numOfLines
]
=
offsetInLineArray
;
double
coef1
;
//for a line ax+by+c=0, coef1 = 1/sqrt(a^2+b^2);
double
coef1
=
0
;
//for a line ax+by+c=0, coef1 = 1/sqrt(a^2+b^2);
double
pointToLineDis
;
//for a line ax+by+c=0 and a point(xi, yi), pointToLineDis = coef1*|a*xi+b*yi+c|
bool
bExtended
=
true
;
bool
bFirstTry
=
true
;
...
...
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