Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main( int argc, char** argv )
//t = (double)cvGetTickCount();

for (int i=0; i<regions.size(); i++)
regions[i].er_fill(grey);
regions[i].er_fill(grey, mser8.connect8());

//t = cvGetTickCount() - t;
//cout << "Regions filled in " << t/((double)cvGetTickFrequency()*1000.) << " ms." << endl;
Expand Down
3 changes: 3 additions & 0 deletions mser.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class MSER
/// @param[in] height Height of the image.
/// @param[out] regions Detected MSER.
void operator()(const uint8_t * bits, int width, int height, std::vector<Region> & regions);

// return true if use 8-connected, otherwise false.
bool connect8(){ return eight_; }

private:
// Helper method
Expand Down
4 changes: 2 additions & 2 deletions region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ All rights reserved.
The function is part of the VLFeat library and is made available under
the terms of the BSD license (see the COPYING file).
*/
void Region::er_fill(Mat& _grey_img)
void Region::er_fill(Mat& _grey_img, bool _eight )
{
const uint8_t *src = (uint8_t*)_grey_img.data;

Expand Down Expand Up @@ -254,7 +254,7 @@ void Region::er_fill(Mat& _grey_img)
4 - the pixel has not been visited yet
*/
if(good
&& nindex != index
&& (nindex != index && (_eight || !(nsubs_pt[0] & nsubs_pt[1])))
&& ((!invert && I_pt [nindex] <= value) ||
( invert && I_pt [nindex] >= value))
&& ! visited_pt [nindex] ) {
Expand Down
2 changes: 1 addition & 1 deletion region.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Region

/// Fills an Extremal Region (ER) by region growing from the Index of the initial pixel(pixel_).
/// @param[in] grey_img Grey level image
void er_fill(cv::Mat& _grey_img);
void er_fill(cv::Mat& _grey_img, bool _eight = false);

std::vector<int> pixels_; ///< list pf all pixels indexes (y * width + x) of the region

Expand Down