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
0df49911
Commit
0df49911
authored
Jul 31, 2014
by
biagio montesano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed ifdefs, explicit initialization of some variables
parent
bd48f386
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
62 deletions
+6
-62
knn_matching.cpp
modules/line_descriptor/samples/knn_matching.cpp
+1
-1
binary_descriptor.cpp
modules/line_descriptor/src/binary_descriptor.cpp
+1
-1
ed_line_detector.cpp
modules/line_descriptor/src/ed_line_detector.cpp
+4
-60
No files found.
modules/line_descriptor/samples/knn_matching.cpp
View file @
0df49911
...
...
@@ -108,7 +108,7 @@ uchar invertSingleBits( uchar dividend_char, int numBits )
}
/* reconvert to decimal */
uchar
result
;
uchar
result
=
0
;
for
(
int
i
=
(
int
)
bin_vector
.
size
()
-
1
;
i
>=
0
;
i
--
)
result
+=
bin_vector
[
i
]
*
pow
(
2
,
i
);
...
...
modules/line_descriptor/src/binary_descriptor.cpp
View file @
0df49911
...
...
@@ -642,7 +642,7 @@ int BinaryDescriptor::OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines )
{
/* some other variables' declarations */
float
twoPI
=
2
*
M_PI
;
unsigned
int
closeLineID
;
unsigned
int
closeLineID
=
0
;
float
endPointDis
,
minEndPointDis
,
minLocalDis
,
maxLocalDis
;
float
lp0
,
lp1
,
lp2
,
lp3
,
np0
,
np1
,
np2
,
np3
;
...
...
modules/line_descriptor/src/ed_line_detector.cpp
View file @
0df49911
...
...
@@ -48,9 +48,6 @@
#define TryTime 6
#define SkipEdgePoint 2
//#define DEBUGEdgeDrawing
//#define DEBUGEDLine
using
namespace
std
;
EDLineDetector
::
EDLineDetector
()
{
...
...
@@ -126,23 +123,12 @@ int EDLineDetector::EdgeDrawing( cv::Mat &image, EdgeChains &edgeChains, bool sm
imageHeight
=
image
.
rows
;
unsigned
int
pixelNum
=
imageWidth
*
imageHeight
;
#ifdef DEBUGEdgeDrawing
cv
::
imshow
(
"prima blur"
,
image
);
cv
::
waitKey
();
#endif
if
(
!
smoothed
)
{
//input image hasn't been smoothed.
std
::
cout
<<
"Dentro smoothed "
<<
std
::
endl
;
cv
::
Mat
InImage
=
image
.
clone
();
cv
::
GaussianBlur
(
InImage
,
image
,
cv
::
Size
(
ksize_
,
ksize_
),
sigma_
);
}
#ifdef DEBUGEdgeDrawing
cv
::
imshow
(
"dopo blur"
,
image
);
cv
::
waitKey
();
#endif
unsigned
int
edgePixelArraySize
=
pixelNum
/
5
;
unsigned
int
maxNumOfEdge
=
edgePixelArraySize
/
20
;
//compute dx, dy images
...
...
@@ -177,12 +163,6 @@ int EDLineDetector::EdgeDrawing( cv::Mat &image, EdgeChains &edgeChains, bool sm
cv
::
Sobel
(
image
,
dxImg_
,
CV_16SC1
,
1
,
0
,
3
);
cv
::
Sobel
(
image
,
dyImg_
,
CV_16SC1
,
0
,
1
,
3
);
#ifdef DEBUGEdgeDrawing
cv
::
imshow
(
"dxImg_"
,
dxImg_
);
cv
::
imshow
(
"dyImg_"
,
dyImg_
);
cv
::
waitKey
();
#endif
//compute gradient and direction images
cv
::
Mat
dxABS_m
=
cv
::
abs
(
dxImg_
);
cv
::
Mat
dyABS_m
=
cv
::
abs
(
dyImg_
);
...
...
@@ -235,9 +215,7 @@ int EDLineDetector::EdgeDrawing( cv::Mat &image, EdgeChains &edgeChains, bool sm
cout
<<
"anchor size is larger than its maximal size. anchorsSize="
<<
anchorsSize
<<
", maximal size = "
<<
edgePixelArraySize
<<
endl
;
return
-
1
;
}
#ifdef DEBUGEdgeDrawing
cout
<<
"Anchor point detection, anchors.size="
<<
anchorsSize
<<
endl
;
#endif
//link the anchors by smart routing
edgeImage_
.
setTo
(
0
);
unsigned
char
*
pEdgeImg
=
edgeImage_
.
data
;
...
...
@@ -251,7 +229,8 @@ int EDLineDetector::EdgeDrawing( cv::Mat &image, EdgeChains &edgeChains, bool sm
unsigned
int
offsetPS
=
0
;
unsigned
int
x
,
y
;
unsigned
int
lastX
,
lastY
;
unsigned
int
lastX
=
0
;
unsigned
int
lastY
=
0
;
unsigned
char
lastDirection
;
//up = 1, right = 2, down = 3, left = 4;
unsigned
char
shouldGoDirection
;
//up = 1, right = 2, down = 3, left = 4;
int
edgeLenFirst
,
edgeLenSecond
;
...
...
@@ -956,11 +935,6 @@ int EDLineDetector::EDline( cv::Mat &image, LineChains &lines, bool smoothed )
return
-
1
;
}
#ifdef DEBUGEDLine
cv
::
imshow
(
"EdgeDrawing"
,
image
);
cv
::
waitKey
();
#endif
//detect lines
unsigned
int
linePixelID
=
edges
.
sId
[
edges
.
numOfEdges
];
lines
.
xCors
.
resize
(
linePixelID
);
...
...
@@ -1187,37 +1161,7 @@ int EDLineDetector::EDline( cv::Mat &image, LineChains &lines, bool smoothed )
pLineSID
[
numOfLines
]
=
offsetInLineArray
;
lines
.
numOfLines
=
numOfLines
;
#ifdef DEBUGEDLine
// /*Show the extracted lines in color. Each line is in different color.*/
// IplImage* cvColorImg = cvCreateImage(cvSize(imageWidth,imageHeight),IPL_DEPTH_8U, 3);
// cvSet(cvColorImg, cvScalar(0,0,0));
// CvScalar s;
// srand((unsigned)time(0));
// int lowest=100, highest=255;
// int range=(highest-lowest)+1;
// // CvPoint point;
// // CvFont font;
// // cvInitFont(&font,CV_FONT_HERSHEY_SIMPLEX ,1.0,1.0,0,1);
// int r, g, b; //the color of lines
// for(unsigned int i=0; i<lines.numOfLines; i++){
// r = lowest+int(rand()%range);
// g = lowest+int(rand()%range);
// b = lowest+int(rand()%range);
// s.val[0] = b; s.val[1] = g; s.val[2] = r;
// for(offsetInLineArray = pLineSID[i]; offsetInLineArray<pLineSID[i+1]; offsetInLineArray++){
// cvSet2D(cvColorImg,pLineYCors[offsetInLineArray],pLineXCors[offsetInLineArray],s);
// }
// // iter = lines[i].begin();
// // point = cvPoint(iter->x,iter->y);
// // char buf[10];
// // sprintf( buf, "%d ", i);
// // cvPutText(cvColorImg,buf,point,&font,CV_RGB(r,g,b));
// }
// cvNamedWindow("LineColorImage", CV_WINDOW_AUTOSIZE);
// cvShowImage("LineColorImage", cvColorImg);
// cvWaitKey(0);
// cvReleaseImage(&cvColorImg);
#endif
return
1
;
}
...
...
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