From: Jason Newton Date: Fri, 23 Nov 2012 05:26:52 +0000 (-0800) Subject: adjust output type to return int32... it should at least be unsigned but this breaks... X-Git-Tag: submit/tizen_ivi/20141117.190038~2^2~1210^2~5^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5aa679d3fdc1c778bcfc50d8340877c9bfa9def;p=profile%2Fivi%2Fopencv.git adjust output type to return int32... it should at least be unsigned but this breaks python bindings; remove non-8bit input type support, not worth the binary size --- diff --git a/modules/imgproc/include/opencv2/imgproc/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc/imgproc.hpp index 3c9d787..5e3da26 100644 --- a/modules/imgproc/include/opencv2/imgproc/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc/imgproc.hpp @@ -1107,8 +1107,8 @@ struct CV_EXPORTS ConnectedComponentStats //! computes the connected components labeled image of boolean image I with 4 or 8 way connectivity - returns N, the total //number of labels [0, N-1] where 0 represents the background label. L's value type determines the label type, an important //consideration based on the total number of labels or alternatively the total number of pixels. -CV_EXPORTS_W uint64 connectedComponents(CV_OUT Mat &L, const Mat &I, int connectivity = 8); -CV_EXPORTS_W uint64 connectedComponentsWithStats(CV_OUT Mat &L, const Mat &I, CV_OUT std::vector &statsv, int connectivity = 8); +CV_EXPORTS_W int connectedComponents(CV_OUT Mat &L, const Mat &I, int connectivity = 8); +CV_EXPORTS_W int connectedComponentsWithStats(CV_OUT Mat &L, const Mat &I, CV_OUT std::vector &statsv, int connectivity = 8); //! mode of the contour retrieval algorithm diff --git a/modules/imgproc/src/connectedcomponents.cpp b/modules/imgproc/src/connectedcomponents.cpp index 8e75ce7..db118f5 100644 --- a/modules/imgproc/src/connectedcomponents.cpp +++ b/modules/imgproc/src/connectedcomponents.cpp @@ -50,8 +50,6 @@ typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; -typedef int64 int64_t; -typedef uint64 uint64_t; namespace cv{ namespace connectedcomponents{ @@ -342,7 +340,7 @@ namespace cv{ //L's type must have an appropriate depth for the number of pixels in I template -uint64_t connectedComponents_sub1(Mat &L, const Mat &I, int connectivity, StatsOp &sop){ +int connectedComponents_sub1(Mat &L, const Mat &I, int connectivity, StatsOp &sop){ CV_Assert(L.rows == I.rows); CV_Assert(L.cols == I.cols); CV_Assert(L.channels() == 1 && I.channels() == 1); @@ -356,99 +354,31 @@ uint64_t connectedComponents_sub1(Mat &L, const Mat &I, int connectivity, StatsO if(lDepth == CV_8U){ if(iDepth == CV_8U || iDepth == CV_8S){ if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); + return (int) LabelingImpl()(L, I, sop); }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_16U || iDepth == CV_16S){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_32S){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_32F){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_64F){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); + return (int) LabelingImpl()(L, I, sop); } + }else{ + CV_Assert(false); } }else if(lDepth == CV_16U){ if(iDepth == CV_8U || iDepth == CV_8S){ if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_16U || iDepth == CV_16S){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); + return (int) LabelingImpl()(L, I, sop); }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_32S){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_32F){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_64F){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); + return (int) LabelingImpl()(L, I, 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 //OpenCV: how should we proceed? .at typechecks in debug mode if(iDepth == CV_8U || iDepth == CV_8S){ if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_16U || iDepth == CV_16S){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); + return (int) LabelingImpl()(L, I, sop); }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_32S){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_32F){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); - } - }else if(iDepth == CV_64F){ - if(connectivity == 4){ - return (uint64_t) LabelingImpl()(L, I, sop); - }else{ - return (uint64_t) LabelingImpl()(L, I, sop); + return (int) LabelingImpl()(L, I, sop); } }else{ CV_Assert(false); @@ -459,7 +389,7 @@ uint64_t connectedComponents_sub1(Mat &L, const Mat &I, int connectivity, StatsO return -1; } -uint64_t connectedComponents(Mat &L, const Mat &I, int connectivity){ +int connectedComponents(Mat &L, const Mat &I, int connectivity){ int lDepth = L.depth(); if(lDepth == CV_8U){ connectedcomponents::NoOp sop; return connectedComponents_sub1(L, I, connectivity, sop); @@ -473,7 +403,7 @@ uint64_t connectedComponents(Mat &L, const Mat &I, int connectivity){ } } -uint64_t connectedComponentsWithStats(Mat &L, const Mat &I, std::vector &statsv, int connectivity){ +int connectedComponentsWithStats(Mat &L, const Mat &I, std::vector &statsv, int connectivity){ int lDepth = L.depth(); if(lDepth == CV_8U){ connectedcomponents::CCStatsOp sop(statsv); return connectedComponents_sub1(L, I, connectivity, sop); @@ -488,4 +418,3 @@ uint64_t connectedComponentsWithStats(Mat &L, const Mat &I, std::vector