From: Jason Newton Date: Sat, 15 Dec 2012 11:36:51 +0000 (-0800) Subject: use opencv's integer type convension X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~4048^2~5^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68e77ac051866d0a8745a7e782b35663a6c633b3;p=platform%2Fupstream%2Fopencv.git use opencv's integer type convension --- diff --git a/modules/imgproc/src/connectedcomponents.cpp b/modules/imgproc/src/connectedcomponents.cpp index dd1665f..e0ad063 100644 --- a/modules/imgproc/src/connectedcomponents.cpp +++ b/modules/imgproc/src/connectedcomponents.cpp @@ -43,14 +43,6 @@ #include "precomp.hpp" #include -//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 connectedcomponents{ @@ -70,8 +62,8 @@ namespace cv{ void finish(){} }; struct Point2ui64{ - uint64_t x, y; - Point2ui64(uint64_t _x, uint64_t _y):x(_x), y(_y){} + uint64 x, y; + Point2ui64(uint64 _x, uint64 _y):x(_x), y(_y){} }; template struct CCStatsOp{ @@ -375,9 +367,9 @@ int connectedComponents_sub1(const cv::Mat &I, cv::Mat &L, int connectivity, Sta if(lDepth == CV_8U){ if(iDepth == CV_8U || iDepth == CV_8S){ if(connectivity == 4){ - return (int) LabelingImpl()(I, L, sop); + return (int) LabelingImpl()(I, L, sop); }else{ - return (int) LabelingImpl()(I, L, sop); + return (int) LabelingImpl()(I, L, sop); } }else{ CV_Assert(false); @@ -385,21 +377,21 @@ int connectedComponents_sub1(const cv::Mat &I, cv::Mat &L, int connectivity, Sta }else if(lDepth == CV_16U){ if(iDepth == CV_8U || iDepth == CV_8S){ if(connectivity == 4){ - return (int) LabelingImpl()(I, L, sop); + return (int) LabelingImpl()(I, L, sop); }else{ - return (int) LabelingImpl()(I, L, sop); + return (int) LabelingImpl()(I, L, sop); } }else{ CV_Assert(false); } }else if(lDepth == CV_32S){ - //note that signed types don't really make sense here and not being able to use uint32_t matters for scientific projects + //note that signed types don't really make sense here and not being able to use unsigned matters for scientific projects //OpenCV: how should we proceed? .at typechecks in debug mode if(iDepth == CV_8U || iDepth == CV_8S){ if(connectivity == 4){ - return (int) LabelingImpl()(I, L, sop); + return (int) LabelingImpl()(I, L, sop); }else{ - return (int) LabelingImpl()(I, L, sop); + return (int) LabelingImpl()(I, L, sop); } }else{ CV_Assert(false); @@ -415,9 +407,9 @@ int connectedComponents(InputArray _I, OutputArray _L, int connectivity, int lty _L.create(I.size(), CV_MAT_TYPE(ltype)); cv::Mat L = _L.getMat(); if(ltype == CV_16U){ - connectedcomponents::NoOp sop; return connectedComponents_sub1(I, L, connectivity, sop); + connectedcomponents::NoOp sop; return connectedComponents_sub1(I, L, connectivity, sop); }else if(ltype == CV_32S){ - connectedcomponents::NoOp sop; return connectedComponents_sub1(I, L, connectivity, sop); + connectedcomponents::NoOp sop; return connectedComponents_sub1(I, L, connectivity, sop); }else{ CV_Assert(false); return 0; @@ -429,9 +421,9 @@ int connectedComponentsWithStats(InputArray _I, OutputArray _L, OutputArray stat _L.create(I.size(), CV_MAT_TYPE(ltype)); cv::Mat L = _L.getMat(); if(ltype == CV_16U){ - connectedcomponents::CCStatsOp sop(statsv, centroids); return connectedComponents_sub1(I, L, connectivity, sop); + connectedcomponents::CCStatsOp sop(statsv, centroids); return connectedComponents_sub1(I, L, connectivity, sop); }else if(ltype == CV_32S){ - connectedcomponents::CCStatsOp sop(statsv, centroids); return connectedComponents_sub1(I, L, connectivity, sop); + connectedcomponents::CCStatsOp sop(statsv, centroids); return connectedComponents_sub1(I, L, connectivity, sop); }else{ CV_Assert(false); return 0;