2018-11-01 17:17:52 -0500 received badge ● Popular Question (source) 2017-08-22 09:18:35 -0500 received badge ● Student (source) 2016-03-19 01:45:24 -0500 commented question Calculating LBP sorry edited the question 2016-03-19 01:43:34 -0500 commented answer Calculating LBP thank you berak it worked 2016-03-19 01:15:13 -0500 asked a question Calculating LBP I tried calculating Local Binary Pattern for an image. #include "opencv2/core/core.hpp" #include "opencv2/contrib/contrib.hpp" #include "opencv2/highgui/highgui.hpp" #include #include #include using namespace cv; using namespace std; int main() { Mat img=imread("G:/Capture.png"); Mat dst = Mat::zeros(img.rows-2, img.cols-2, CV_8UC1); for(int i=1;i(i,j); unsigned char code = 0; code |= ((img.at(i-1,j-1)) > center) << 7; code |= ((img.at(i-1,j)) > center) << 6; code |= ((img.at(i-1,j+1)) > center) << 5; code |= ((img.at(i,j+1)) > center) << 4; code |= ((img.at(i+1,j+1)) > center) << 3; code |= ((img.at(i+1,j)) > center) << 2; code |= ((img.at(i+1,j-1)) > center) << 1; code |= ((img.at(i,j-1)) > center) << 0; dst.at(i-1,j-1) = code; } } imshow("LBP",dst); imshow("Source",img); waitKey(0); return 0; }  The output images are: The LBP image is not complete. But What I expect is : 2016-03-17 11:24:14 -0500 asked a question Accessing pixel values in colour image the following lines show error Size shist = frame.size(); int histrows = shist.height; int histcols = shist.width; for(int igan=0;igan(igan,jgan)!=0) forhistogram.at(igan,jgan)=frame.at(igan,jgan); else forhistogram.at(igan,jgan)=0;  2016-03-09 02:27:01 -0500 commented question accessing elements in vector of vector of points please reply what is wrong because the last 6 lines show error 2016-03-09 01:01:54 -0500 asked a question accessing elements in vector of vector of points I tried people counting using HOG descriptor. When the program is compiled, the last part of the program for people counting shows errors.  HOGDescriptor hog; hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector()); namedWindow("people detector", 1); int required,incoming,outgoing; required=0; incoming=0; outgoing=0; for(;;) { vector found, found_filtered; double t = (double)getTickCount(); hog.detectMultiScale(img, found, 0, Size(8,8), Size(32,32), 1.05, 2); t = (double)getTickCount() - t; printf("tdetection time = %gms\n", t*1000./cv::getTickFrequency()); size_t i, j; for( i = 0; i < found.size(); i++ ) { Rect r = found[i]; for( j = 0; j < found.size(); j++ ) if( j != i && (r & found[j]) == r) break; if( j == found.size() ) found_filtered.push_back(r); } Point pt,ptretrieve; vector>rectcount; for(i=0;i #include < opencv2\opencv.hpp> #include < opencv2/core/core.hpp> #include < opencv2/highgui/highgui.hpp> #include < opencv2/video/background_segm.hpp> using namespace cv; using namespace std; int main() { //global variables Mat frame; //current frame Mat resizeF; Mat fgMaskMOG; //fg mask generated by MOG method Mat fgMaskMOG2; //fg mask fg mask generated by MOG2 method Mat fgMaskGMG; //fg mask fg mask generated by MOG2 method Ptr< BackgroundSubtractor> pMOG; //MOG Background subtractor Ptr< BackgroundSubtractor> pMOG2; //MOG2 Background subtractor Ptr< BackgroundSubtractorGMG> pGMG; //MOG2 Background subtractor pMOG = new BackgroundSubtractorMOG(); pMOG2 = new BackgroundSubtractorMOG2(); pGMG = new BackgroundSubtractorGMG(); char fileName[100] = "F:/Project/ShopAssistant2cor.mpg"; VideoCapture stream1(fileName); Mat element = getStructuringElement(MORPH_RECT, Size(3, 3), Point(1,1) ); while (true) { Mat cameraFrame; if(!(stream1.read(frame))) break; Mat resizeF=frame; pMOG->operator()(resizeF, fgMaskMOG); pMOG2->operator()(resizeF, fgMaskMOG2); pGMG->operator()(resizeF, fgMaskGMG); imshow("Origin", resizeF); imshow("MOG", fgMaskMOG); imshow("MOG2", fgMaskMOG2); imshow("GMG", fgMaskGMG); if (waitKey(30) >= 0) break; } }  2016-03-03 03:54:55 -0500 commented question how to retrieve values from vector thanks berak 2016-03-02 23:03:18 -0500 asked a question how to retrieve values from vector Please provide complete instruction set for vector 2016-03-01 21:35:16 -0500 answered a question haarcascade_eye_tree_eyeglasses seems to be broken Check whether haarcascade_eye_tree_eyeglasses.xml is available correctly. Try to extract opencv package again. 2016-03-01 10:48:11 -0500 commented question How to free memory allocated by UMat? Please refer the links http://answers.opencv.org/question/78... http://answers.opencv.org/question/74... 2016-03-01 10:13:23 -0500 answered a question what is error in this question I executed this code. No error was shown.It really works. 2016-03-01 02:40:06 -0500 asked a question Need any code for pedestrian counting using trip wire using C++ , I need to implement pedestrian counting I read this post : http://answers.opencv.org/question/22... But I have very little idea of how to implement it. 2016-03-01 02:35:54 -0500 received badge ● Enthusiast 2016-02-26 00:02:34 -0500 asked a question How to use X64 and X86??? I installed Visual Studio 2010 and opencv 2.4.9 in windows 7 64 bit. When I use X64 for library, there is a link error showing incompatible with machine. When X86 is used, errors are shown for dll files missing. After providing dll files one by one, finally there is compilation error. How to execute opencv c++ programs????? 2016-02-25 23:54:01 -0500 asked a question How to include ros.h and other ros headers?? #include #include #include #include #include #include #include #include #include #include #include // only for unix? #include #include #include #include #include namespace fs = ::boost::filesystem; using namespace std; using namespace cv; static const std::string OPENCV_WINDOW = "Image window"; #define drawCross( center, color, d ) \ line( img, Point( center.x - d, center.y - d ), Point( center.x + d, center.y + d ), color, 2, CV_AA, 0); \ line( img, Point( center.x + d, center.y - d ), Point( center.x - d, center.y + d ), color, 2, CV_AA, 0 ) #define CLIP_CHAR(c) ((c)>255?255:(c)<0?0:(c)) class DetectorNode { ros::NodeHandle nh_; image_transport::ImageTransport it_; image_transport::Subscriber image_sub_; image_transport::Publisher image_pub_; ros::Publisher coord_pub; // Kalman-related variables bool kalmanHasBeenSetup; KalmanFilter KF; vector kalmanv; int kalmanCounter; Mat_ measurement; HOGDescriptor hog; public: DetectorNode(ros::NodeHandle n) : nh_(n), it_(n) { ROS_DEBUG("Detector node constructor started"); // Subscrive to input video feed and publish output video feed coord_pub = n.advertise("detector_topic", 1); image_sub_ = it_.subscribe("image", 1, &DetectorNode::imageCb, this); // descriptor_sub = nh_.subscribe // ("descriptors", 1, &DetectorNode::descriptorCb, this); //cv::namedWindow(OPENCV_WINDOW); ROS_DEBUG("Detector Node started"); hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector()); kalmanHasBeenSetup = false; } ~DetectorNode() { cv::destroyWindow(OPENCV_WINDOW); } bool kalmanIsSetup() { return kalmanHasBeenSetup; } void setupKalman(float x_coord, float y_coord) { ROS_DEBUG("Setup Kalman filter"); KF.init(4,2,0); KF.transitionMatrix = *(Mat_(4, 4) << 1,0,1,0, 0,1,0,1, 0,0,1,0, 0,0,0,1); measurement.create(2,1); measurement.setTo(Scalar(0)); KF.statePre.at(0) = x_coord; KF.statePre.at(1) = y_coord; KF.statePre.at(2) = 0; KF.statePre.at(3) = 0; setIdentity(KF.measurementMatrix); setIdentity(KF.processNoiseCov, Scalar::all(1e-2)); // Bigger number => faster update setIdentity(KF.measurementNoiseCov, Scalar::all(10)); setIdentity(KF.errorCovPost, Scalar::all(.1)); // Reset the kalman result vector and counter kalmanv.clear(); kalmanCounter = 0; kalmanHasBeenSetup = true; } void imageCb(const sensor_msgs::ImageConstPtr& msg) { // Convert image message to OpenCV format cv_bridge::CvImagePtr cv_ptr; try { cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8); } catch (cv_bridge::Exception& e) { ROS_ERROR("cv_bridge exception: %s", e.what()); return; } //bool found_object = false; Point object_coordinates; Mat imgBig, img; namedWindow("HOG - Detect people", CV_WINDOW_AUTOSIZE); img = cv_ptr->image; // Get image sizes float imgWidth = (img.size()).width; float imgHeight = (img.size()).height; bool usingKalman = true; int kalmanCounterMax = 5; if(kalmanIsSetup() && usingKalman) { ROS_DEBUG("Predict and update Kalman filter"); // Predict and update Kalman filter Mat prediction = KF.predict(); Point predictPt(prediction.at(0),prediction.at(1)); Mat estimated = KF.correct(measurement); Point statePt(estimated.at(0),estimated.at(1)); } vector found, found_filtered; hog.detectMultiScale(img, found, 0, Size(8,8), Size(32,32), 1.05, 2); size_t i, j; size_t biggest = 0; Rect biggestRect; for (i=0; i faces; Mat frame_gray; cvtColor( frame, frame_gray, CV_BGR2GRAY ); equalizeHist( frame_gray, frame_gray ); if( !face_cascade.load( "haarcascade_frontalface_alt.xml") ) { printf("--(!)Error loading\n"); return -1; }; face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); for( size_t i = 0; i < faces.size(); i++ ) { Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 ); } imshow("HAAR", frame ); } ----------  2016-02-16 22:04:39 -0500 asked a question compilation error I could not compile my code and I get the following exception error always. Unhandled exception at 0x74c7b760 (KernelBase.dll) in firstexample.exe: Microsoft C++ exception: cv::Exception at memory location 0x0013afe4.. at some times errors are shown 2016-02-16 02:23:49 -0500 asked a question cascade classifier doesnot work for image input given below is my code #include "opencv2/objdetect/objdetect.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include #include using namespace std; using namespace cv; int main() { Mat new=imread("F:\new.jpg"); namedWindow("HAAR"); CascadeClassifier face_cascade; vector faces; Mat frame_gray; cvtColor( new, frame_gray, CV_BGR2GRAY ); equalizeHist( frame_gray, frame_gray ); if( !face_cascade.load( "haarcascade_frontalface_alt.xml") ) { printf("--(!)Error loading\n"); return -1; }; face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); for( size_t i = 0; i < faces.size(); i++ ) { Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 ); } imshow("HAAR", frame ); }  MS visual studio 2010 and opencv 2.4.9 are used. no error is displayed build is successful 2015-09-21 01:58:38 -0500 answered a question opencv slow on ubuntu Speed depends on clock speed 2015-09-21 01:49:34 -0500 asked a question Visual Studio 2010 How to solve the error 'could not locate Cl.exe'