mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-23 00:49:38 +08:00

* New superpixel algorithm (F-DBSCAN) Implementation of a new superpixel algorithm, "Accelerated superpixel image segmentation with a parallelized DBSCAN algorithm". * Update scansegment.hpp added newline at end of file * Update scansegment.cpp added newline at end of file * Update scansegment.cpp bug fixes * Update scansegment.cpp bug fixes * Update scansegment.hpp bug fixes * Update scansegment.cpp bug fixes * Update scansegment.hpp trailing whitespace removal * Update scansegment.cpp bug fixes * Update scansegment.cpp bug fixes * Update scansegment.cpp editing changes * Update scansegment.hpp editing changes * Update scansegment.hpp minor edits * Update scansegment.cpp bug fixes * Update scansegment.cpp inserted @addtogroup block * Update scansegment.cpp bug fixes * Update scansegment.hpp bug fixes * Update scansegment.hpp indents removed * Update scansegment.cpp extra indents removed * Update scansegment.cpp license agreement updated * Update scansegment.hpp license agreement updated * Update ximgproc.bib * Update scansegment.hpp reference moved to ximgproc.bib * Update scansegment.cpp reference moved to ximgproc.bib * Update scansegment.hpp c++ def removed * Update scansegment.hpp changed threads param * Update scansegment.cpp changed threads param * Update scansegment.cpp tab indents replaced with 4 spaces * Update scansegment.cpp bug fixes * Update scansegment.hpp removed trailing whitespace * Update scansegment.cpp replace malloc with autobuffer * Update scansegment.hpp updated header guard * Update scansegment.cpp bug fix * Update scansegment.cpp bug fixes * Update scansegment.cpp fixed process threads to the number of slices * Update scansegment.cpp bug fixes * Update scansegment.cpp C++ 11 lambdas used instead of cv::ParallelLoopBody * Update scansegment.cpp changed neighbours location buffer to array * Update scansegment.cpp remove whitespace * Update scansegment.cpp RAW pointers removed * Update scansegment.cpp bug fixes * ximgproc(ScanSegment): coding style, add smoke test * Update scansegment.hpp added citation * Update scansegment.cpp bug fixes
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
|
|
#include "test_precomp.hpp"
|
|
|
|
namespace opencv_test { namespace {
|
|
|
|
static void runScanSegment(int slices)
|
|
|
|
{
|
|
Mat img = imread(cvtest::findDataFile("cv/shared/lena.png"), IMREAD_COLOR);
|
|
Mat labImg;
|
|
cvtColor(img, labImg, COLOR_BGR2Lab);
|
|
Ptr<ScanSegment> ss = createScanSegment(labImg.cols, labImg.rows, 500, slices, true);
|
|
ss->iterate(labImg);
|
|
int numSuperpixels = ss->getNumberOfSuperpixels();
|
|
EXPECT_GT(numSuperpixels, 100);
|
|
EXPECT_LE(numSuperpixels, 500);
|
|
Mat res;
|
|
ss->getLabelContourMask(res, false);
|
|
EXPECT_GE(cvtest::norm(res, NORM_L1), 1000000);
|
|
|
|
if (cvtest::debugLevel >= 10)
|
|
{
|
|
imshow("ScanSegment", res);
|
|
waitKey();
|
|
}
|
|
}
|
|
|
|
TEST(ximgproc_ScanSegment, smoke) { runScanSegment(1); }
|
|
TEST(ximgproc_ScanSegment, smoke4) { runScanSegment(4); }
|
|
TEST(ximgproc_ScanSegment, smoke8) { runScanSegment(8); }
|
|
|
|
}} // namespace
|