connectedComponents: peep-hole optimizations, mostly surrouding the fact that cv::Mat::at is expensive in a tight-loop -also added a "blobstats" version
This commit is contained in:
@@ -12,7 +12,7 @@ static void on_trackbar(int, void*)
|
||||
{
|
||||
Mat bw = threshval < 128 ? (img < threshval) : (img > threshval);
|
||||
Mat labelImage(img.size(), CV_32S);
|
||||
int nLabels = connectedComponents(labelImage, bw, 8);
|
||||
uint64_t nLabels = connectedComponents(labelImage, bw, 8);
|
||||
Vec3b colors[nLabels];
|
||||
colors[0] = Vec3b(0, 0, 0);//background
|
||||
for(int label = 1; label < nLabels; ++label){
|
||||
|
Reference in New Issue
Block a user