OpenCV MSER example (opencv 300 )

MSER example




...
#include < iostream>  
#include < opencv2\opencv.hpp>  
#include < opencv2\highgui.hpp>  
#include < opencv2\imgcodecs.hpp>  
#include < opencv2\core.hpp>
#include < opencv2\imgproc.hpp>
#include < opencv2\text.hpp>
#include < opencv2/features2d.hpp>


#ifdef _DEBUG             
#pragma comment(lib, "opencv_core300d.lib")     
#pragma comment(lib, "opencv_highgui300d.lib")  
#pragma comment(lib, "opencv_imgcodecs300d.lib")
#pragma comment(lib, "opencv_text300d.lib")
#pragma comment(lib, "opencv_features2d300d.lib")
#pragma comment(lib, "opencv_imgproc300d.lib")

#else     
#pragma comment(lib, "opencv_core300.lib")     
#pragma comment(lib, "opencv_highgui300.lib")  
#pragma comment(lib, "opencv_imgcodecs300.lib")  
#pragma comment(lib, "opencv_text300.lib")
#pragma comment(lib, "opencv_features2d300.lib")
#pragma comment(lib, "opencv_imgproc300d.lib")
#endif      

using namespace std;
using namespace cv;
void main()
{

 Mat inImg = imread("M:\\____videoSample____\\SceneText\\SceneText01.jpg");

 Mat textImg;
 cvtColor(inImg, textImg, CV_BGR2GRAY);
 //Extract MSER
 
 vector< vector< Point> > contours;
 vector< Rect> bboxes;
 Ptr< MSER> mser = MSER::create(21, (int)(0.00002*textImg.cols*textImg.rows), (int)(0.05*textImg.cols*textImg.rows), 1, 0.7); 
 mser->detectRegions(textImg, contours, bboxes); 

 for (int i = 0; i < bboxes.size(); i++)
 {
  rectangle(inImg, bboxes[i], CV_RGB(0, 255, 0));
 }


 namedWindow("t");
 imshow("t", inImg);
 waitKey(0);

}


Comments

Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

(C, C++) TinyXML , xml read & write