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
68e77ac0
Commit
68e77ac0
authored
Dec 15, 2012
by
Jason Newton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use opencv's integer type convension
parent
63debf50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
21 deletions
+13
-21
connectedcomponents.cpp
modules/imgproc/src/connectedcomponents.cpp
+13
-21
No files found.
modules/imgproc/src/connectedcomponents.cpp
View file @
68e77ac0
...
@@ -43,14 +43,6 @@
...
@@ -43,14 +43,6 @@
#include "precomp.hpp"
#include "precomp.hpp"
#include <vector>
#include <vector>
//It's 2012 and we still let compilers get by without defining standard integer types...
typedef
schar
int8_t
;
typedef
uchar
uint8_t
;
typedef
short
int16_t
;
typedef
unsigned
short
uint16_t
;
typedef
int
int32_t
;
typedef
unsigned
int
uint32_t
;
namespace
cv
{
namespace
cv
{
namespace
connectedcomponents
{
namespace
connectedcomponents
{
...
@@ -70,8 +62,8 @@ namespace cv{
...
@@ -70,8 +62,8 @@ namespace cv{
void
finish
(){}
void
finish
(){}
};
};
struct
Point2ui64
{
struct
Point2ui64
{
uint64
_t
x
,
y
;
uint64
x
,
y
;
Point2ui64
(
uint64
_t
_x
,
uint64_t
_y
)
:
x
(
_x
),
y
(
_y
){}
Point2ui64
(
uint64
_x
,
uint64
_y
)
:
x
(
_x
),
y
(
_y
){}
};
};
template
<
typename
LabelT
>
template
<
typename
LabelT
>
struct
CCStatsOp
{
struct
CCStatsOp
{
...
@@ -375,9 +367,9 @@ int connectedComponents_sub1(const cv::Mat &I, cv::Mat &L, int connectivity, Sta
...
@@ -375,9 +367,9 @@ int connectedComponents_sub1(const cv::Mat &I, cv::Mat &L, int connectivity, Sta
if
(
lDepth
==
CV_8U
){
if
(
lDepth
==
CV_8U
){
if
(
iDepth
==
CV_8U
||
iDepth
==
CV_8S
){
if
(
iDepth
==
CV_8U
||
iDepth
==
CV_8S
){
if
(
connectivity
==
4
){
if
(
connectivity
==
4
){
return
(
int
)
LabelingImpl
<
u
int8_t
,
uint8_t
,
StatsOp
,
4
>
()(
I
,
L
,
sop
);
return
(
int
)
LabelingImpl
<
u
char
,
uchar
,
StatsOp
,
4
>
()(
I
,
L
,
sop
);
}
else
{
}
else
{
return
(
int
)
LabelingImpl
<
u
int8_t
,
uint8_t
,
StatsOp
,
8
>
()(
I
,
L
,
sop
);
return
(
int
)
LabelingImpl
<
u
char
,
uchar
,
StatsOp
,
8
>
()(
I
,
L
,
sop
);
}
}
}
else
{
}
else
{
CV_Assert
(
false
);
CV_Assert
(
false
);
...
@@ -385,21 +377,21 @@ int connectedComponents_sub1(const cv::Mat &I, cv::Mat &L, int connectivity, Sta
...
@@ -385,21 +377,21 @@ int connectedComponents_sub1(const cv::Mat &I, cv::Mat &L, int connectivity, Sta
}
else
if
(
lDepth
==
CV_16U
){
}
else
if
(
lDepth
==
CV_16U
){
if
(
iDepth
==
CV_8U
||
iDepth
==
CV_8S
){
if
(
iDepth
==
CV_8U
||
iDepth
==
CV_8S
){
if
(
connectivity
==
4
){
if
(
connectivity
==
4
){
return
(
int
)
LabelingImpl
<
u
int16_t
,
uint8_t
,
StatsOp
,
4
>
()(
I
,
L
,
sop
);
return
(
int
)
LabelingImpl
<
u
short
,
uchar
,
StatsOp
,
4
>
()(
I
,
L
,
sop
);
}
else
{
}
else
{
return
(
int
)
LabelingImpl
<
u
int16_t
,
uint8_t
,
StatsOp
,
8
>
()(
I
,
L
,
sop
);
return
(
int
)
LabelingImpl
<
u
short
,
uchar
,
StatsOp
,
8
>
()(
I
,
L
,
sop
);
}
}
}
else
{
}
else
{
CV_Assert
(
false
);
CV_Assert
(
false
);
}
}
}
else
if
(
lDepth
==
CV_32S
){
}
else
if
(
lDepth
==
CV_32S
){
//note that signed types don't really make sense here and not being able to use u
int32_t
matters for scientific projects
//note that signed types don't really make sense here and not being able to use u
nsigned
matters for scientific projects
//OpenCV: how should we proceed? .at<T> typechecks in debug mode
//OpenCV: how should we proceed? .at<T> typechecks in debug mode
if
(
iDepth
==
CV_8U
||
iDepth
==
CV_8S
){
if
(
iDepth
==
CV_8U
||
iDepth
==
CV_8S
){
if
(
connectivity
==
4
){
if
(
connectivity
==
4
){
return
(
int
)
LabelingImpl
<
int
32_t
,
uint8_t
,
StatsOp
,
4
>
()(
I
,
L
,
sop
);
return
(
int
)
LabelingImpl
<
int
,
uchar
,
StatsOp
,
4
>
()(
I
,
L
,
sop
);
}
else
{
}
else
{
return
(
int
)
LabelingImpl
<
int
32_t
,
uint8_t
,
StatsOp
,
8
>
()(
I
,
L
,
sop
);
return
(
int
)
LabelingImpl
<
int
,
uchar
,
StatsOp
,
8
>
()(
I
,
L
,
sop
);
}
}
}
else
{
}
else
{
CV_Assert
(
false
);
CV_Assert
(
false
);
...
@@ -415,9 +407,9 @@ int connectedComponents(InputArray _I, OutputArray _L, int connectivity, int lty
...
@@ -415,9 +407,9 @@ int connectedComponents(InputArray _I, OutputArray _L, int connectivity, int lty
_L
.
create
(
I
.
size
(),
CV_MAT_TYPE
(
ltype
));
_L
.
create
(
I
.
size
(),
CV_MAT_TYPE
(
ltype
));
cv
::
Mat
L
=
_L
.
getMat
();
cv
::
Mat
L
=
_L
.
getMat
();
if
(
ltype
==
CV_16U
){
if
(
ltype
==
CV_16U
){
connectedcomponents
::
NoOp
<
u
int16_
t
>
sop
;
return
connectedComponents_sub1
(
I
,
L
,
connectivity
,
sop
);
connectedcomponents
::
NoOp
<
u
shor
t
>
sop
;
return
connectedComponents_sub1
(
I
,
L
,
connectivity
,
sop
);
}
else
if
(
ltype
==
CV_32S
){
}
else
if
(
ltype
==
CV_32S
){
connectedcomponents
::
NoOp
<
u
int32_t
>
sop
;
return
connectedComponents_sub1
(
I
,
L
,
connectivity
,
sop
);
connectedcomponents
::
NoOp
<
u
nsigned
>
sop
;
return
connectedComponents_sub1
(
I
,
L
,
connectivity
,
sop
);
}
else
{
}
else
{
CV_Assert
(
false
);
CV_Assert
(
false
);
return
0
;
return
0
;
...
@@ -429,9 +421,9 @@ int connectedComponentsWithStats(InputArray _I, OutputArray _L, OutputArray stat
...
@@ -429,9 +421,9 @@ int connectedComponentsWithStats(InputArray _I, OutputArray _L, OutputArray stat
_L
.
create
(
I
.
size
(),
CV_MAT_TYPE
(
ltype
));
_L
.
create
(
I
.
size
(),
CV_MAT_TYPE
(
ltype
));
cv
::
Mat
L
=
_L
.
getMat
();
cv
::
Mat
L
=
_L
.
getMat
();
if
(
ltype
==
CV_16U
){
if
(
ltype
==
CV_16U
){
connectedcomponents
::
CCStatsOp
<
u
int16_
t
>
sop
(
statsv
,
centroids
);
return
connectedComponents_sub1
(
I
,
L
,
connectivity
,
sop
);
connectedcomponents
::
CCStatsOp
<
u
shor
t
>
sop
(
statsv
,
centroids
);
return
connectedComponents_sub1
(
I
,
L
,
connectivity
,
sop
);
}
else
if
(
ltype
==
CV_32S
){
}
else
if
(
ltype
==
CV_32S
){
connectedcomponents
::
CCStatsOp
<
u
int32_t
>
sop
(
statsv
,
centroids
);
return
connectedComponents_sub1
(
I
,
L
,
connectivity
,
sop
);
connectedcomponents
::
CCStatsOp
<
u
nsigned
>
sop
(
statsv
,
centroids
);
return
connectedComponents_sub1
(
I
,
L
,
connectivity
,
sop
);
}
else
{
}
else
{
CV_Assert
(
false
);
CV_Assert
(
false
);
return
0
;
return
0
;
...
...
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