Ask Your Question

sam001's profile - activity

2020-11-19 22:12:42 -0500 received badge  Famous Question (source)
2019-03-28 05:08:48 -0500 received badge  Popular Question (source)
2019-03-05 09:40:40 -0500 received badge  Notable Question (source)
2017-11-24 09:31:09 -0500 edited question How to only display an ROI in a video frame OpenCV java?

How to only display an ROI in a video frame OpenCV java? I am new to OpenCV and so I am still learning some of the funct

2017-11-24 09:29:50 -0500 asked a question How to only display an ROI in a video frame OpenCV java?

How to only display an ROI in a video frame OpenCV java? 0 down vote favorite I am new to OpenCV and so I am still learn

2017-07-04 15:16:38 -0500 received badge  Popular Question (source)
2016-03-18 15:40:21 -0500 received badge  Editor (source)
2016-03-18 15:39:00 -0500 asked a question Resizing a bounding box opencv c++?

So, i am working on a character recognition program. This is what i have tried so far. 1. Loaded an image of character A written in various styles. 2. Pre processed the image (converting to grayscale,adaptivethreshold,morphology). 3. Find contours and draw them on the original image. 4. Draw bounding Rectangle on the detected contour.

Now, here is the thing. Since the characters are small, so the boundingrectangle is also small. What my objective is to resize the boundingrectangle to 60*60 and then draw it on each contours detected. Such that when i save the detected contours as images, it can be visible. How do i do that?

    vector<vector<Point> > contours_poly( contours.size() );
      vector<Rect> boundRect( contours.size() );

       for( int i = 0; i < contours.size(); i++ )
        approxPolyDP( Mat(contours[i]), contours_poly[i], 3, true );

        boundRect[i] = boundingRect( Mat(contours_poly[i]) );
        Mat roi( result, boundRect[i]);


for (int i = 0; i < contours.size(); i = hierarchy[i][0]) {
  //  Rect r = boundingRect(contours[i]);
    double area0 = contourArea(contours[i]);

    if (area0 < 120) {
        drawContours(src, contours, i, Scalar(255,0,0), CV_FILLED, 8, hierarchy);

         rectangle(src, boundRect[i].tl(), boundRect[i].br(), Scalar(0,0,255), 2, 8, 0 );
2016-03-05 15:35:42 -0500 asked a question Text recognition in OpenCV?

So, here is the thing. I have written a license plate detection program and it works fine. Now, the next step is to recognize license plate number. I researched a lot and found out OCR is a great tool but then the results i get from OCR is not really that great. It fails miserably with some images and in some it does reasonably well. I would like to keep my options open. So, i researched a bit more and came across template matching. I applied it on images (not for recognizing texts) and its pretty robust. So, i want to get some idea about text recognition in images. What are my possible options? Lets say at some point i would like to try Handwriting recognition.

2016-03-04 02:13:22 -0500 received badge  Enthusiast
2016-03-03 15:08:27 -0500 asked a question Tesseract OCR for license plate recognition OpenCV ?

I have written this program which can detect license plate in a car and draw a rectangle around the detected area. Now, the idea is to extract text from the detected area using Tesseract OCR. But when i run the image through OCR, I get a blank text. I tried with the same images but of different sizes and still the same result. What could be the mistake? What are my options for character recognition?

Here are the images:-

image description image description

2016-02-28 14:52:26 -0500 received badge  Scholar (source)
2016-02-28 14:00:19 -0500 asked a question Where can i get a sample video of an abandoned bag in a video frame?

I need a sample video to test my abandoned object detection in a a video frame. I have run it on videos collected from Youtube but the quality of the videos are not quite good. So, does anyone has a sample video related to abandoned bag in a video frame which i can test my code on?

2016-02-27 14:02:32 -0500 commented answer Intersection of a contour and line in OpenCV c++?

@Lberger- Thanks a lot for your reply. But this is what its happening so far. The carCounter vector gives me the total number of cars in the frame rather than the number of cars passing through the line. How do i fix it?

2016-02-27 07:47:06 -0500 asked a question Intersection of a contour and line in OpenCV c++?

Hi, I am trying to count the number of cars that passes through a line in opencv c++. I have drawn a line on my frame at a specific point and my idea is every time , a car passes through the line, the count variable will be incremented by 1. So, this is what i did.

Step1:- I created an image of zeros with the contour detected in the image.

Step2: - Then i created another image of zeros with just the line this time.

Step3:- Then i took the bitwise AND between these two image and i get the common pixel intersection between these two images.

Step4:- My idea was now if the pixel value in the new image is greater than 0 then i increment the count variable by 1.

So, if i do these then i get a huge value of count. This seems absurd and i would like to know how i correct the error. This is my code so far. Please help me out.

Mat drawing1 = Mat::zeros(resize_blur_Img.size(), CV_8UC1 );
Mat drawing2 = Mat::zeros(resize_blur_Img.size(),CV_8UC1);
Mat res;

for( int i = 0; i < contours.size(); i++ )
     mc[i] = Point2f( mu[i].m10/mu[i].m00 , mu[i].m01/mu[i].m00 );

     drawContours( drawing1, contours, i, Scalar(255,0,0), 2, 8, hierarchy, 0, Point() );

  for(int i =0 ;i <res.rows;i++)
     for(int j=0; j<res.cols;j++)

       if(<uchar>(i,j) > 0)
           found = true;
           count ++;


           found = false;
          // cout<<found<<endl;


2016-02-26 13:21:08 -0500 received badge  Supporter (source)
2016-02-23 21:34:39 -0500 asked a question How to detect and recognize objects in an image?

The idea is to detect objects in an image. Say, i have a book in a image and i would like to detect it. I read about the SURF algorithm but i don't think it would be applicable in my project. The object which is a book can be of any type and doesn't need to be in the database before. I will have a collection of images of book in my database and i have to create a recognizer file such that when i run a test image through my program, it can classify books from other objects. So, what could be my possible options?

2014-08-20 16:28:28 -0500 asked a question How can i create a gesture based recognition system?

I have to create a gesture based recognition system that can detect my gestures and perform certain tasks like playing a media player or opening a webpage.I researched online and saw a lot of videos about the gesture based recognition system but none of them explained how they did that and most of the codes are really hard to understand. So, is there any tutorial or links about the gesture based recognition system that i can read and understand? Please help me out.

2014-08-19 20:17:29 -0500 asked a question How and where do i store my gestures for Gesture recognition technology?

I am working on a Gesture recognition technology for my engineering project. So, i am able to filter out all the unnecessary things that are not required for detecting gestures. Now, i am wondering that before even i implement the gesture recognition code, i have to first grab some gestures from my webcam frames and store them in a particular format. Also, when my code will run the database where the gesture will be stored should also work in parallel with my code as every gesture i make infront of my camera should be detected and matched with the stored gestures in my database. Now, i know this might be too much to ask for but can you guys suggest me some simple way of storing my gestures in a database and where exactly do i store them. I am having this intuition that the storing the gesture part will kind of work like template matching program/SURF object detection technology. If thats so then may be i should grab a frame from the camera of every gesture i make and store it in my project folder. Is that the right way? Kindly suggest me. Thanks

Sincere request- Please dont link me to source codes. I dont want source code as i want to create it myself without copying anyone's work. Thanks

2014-08-16 13:44:58 -0500 asked a question How to find contours from a webcam frame using opencv and c++?

My goal is to find contours by capturing frame from a webcam. I was able to do it with static images but then i tried to use the same concept in a webcam frame and its giving me this error.

"OpenCV Error: Assertion failed (mtype== type0 || (CV_MAT_CN(mtype) == CV_MAT_CN (type0) && 
 ((1 << type0) & fixedDepthMask) != 0)) in cv::_OutputArray::create, 
 file C:\builds\2_4_PackSlave-win64-vc11-shared\opencv\modules\core\src\matrix.cpp , line 1486"

This is the code that i used to find the contours in my program;

    con = captureframe.clone();

    threshold( con, threshold_output, thresh, 255, THRESH_BINARY );
    findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );

    Mat drawing = Mat::zeros( threshold_output.size(), CV_8UC3 );

    for( int i = 0; i< contours.size(); i++ )
        Scalar color = Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );
        drawContours( drawing, contours, i, color, 1, 8, vector<Vec4i>(), 0, Point() );
    imshow("contour drawing",drawing);