Ask Your Question

JavaEria's profile - activity

2020-11-06 05:26:41 -0600 received badge  Student (source)
2018-09-13 12:34:01 -0600 received badge  Popular Question (source)
2014-11-28 10:13:18 -0600 asked a question BoundingRect function

Can some explain me how the boundingrect() function works when i give it a vector containing two Point objects? I need to implement sliding window using this technique

2014-11-17 08:12:29 -0600 asked a question 2d vector of hog of images

I am trying to make a 2d vector of float vectors which contain HOG descriptors vectors of images of 285, but as i keep adding the vectors in the 2d vectors, it throws an exception after 155th to 156th image, can anyone please help me out in this? as i need to convert this 2d vector to mat for training a classifier within tonight.

2014-11-17 06:41:55 -0600 asked a question Hog vector values in Mat

I m currently saving Hog vector values of 3 different shapes with 95 images of each shapes, i.e a total of 3*195 hogs, but i wanted to put them all in Mat so that they can used for training set in svm classifier. The problem is that the size of each image hog vector is different , is it possible to change it in Mat??.

2014-11-12 09:50:50 -0600 asked a question HOG with SVM

I am currently trying to make multi-class classifer for basic geometric shapes(circle, square , rectangle , triangle). I wanted to use HOG for the samples in tranining set (200 HOGs for each shape) and use it in SVM classifier with one vs all mechanism. but as im new to pencv , i have no idea how will use HOG and one vs all mechanism, can someone please guide me on this issue ?

2014-11-01 09:01:33 -0600 commented answer Corner detection after edge detection

I ve tried CV_8U on the output mask, i have updated a screenshot and i think the problem is in the conversion of dst, maybe i have used the function properly. I m also updating the code right after the screenshot ca u please check it??

2014-10-31 22:49:54 -0600 commented answer Corner detection after edge detection

And any changes in dst?

2014-10-31 05:35:03 -0600 commented answer Corner detection after edge detection

I tried blocksize 3, and used CV_32F and CV_8FC1 both giving exception still, but i have found that after canny edge detectiion when i copy the masked output of detected edges to the source using this

                    src.copyTo(dst,detected_edges);

Im getting exception as when i directly use detected_edges in corner there is no exception but the image is not right, so then there is a problem in this function even though i converted dst to 32F as well as 8UC1

                                       src.convertTo(dst, CV_32F);
                                       cornerHarris( dst, temp, blockSize, apertureSize, k, BORDER_DEFAULT );

Giving exception still

2014-10-27 12:11:56 -0600 commented answer Corner detection after edge detection

Here you go ,

             /// Detector parameters
             int blockSize = 2;
             int apertureSize = 3;
             double k = 0.04;
2014-10-27 12:07:34 -0600 commented answer Corner detection after edge detection

Ohh, so wat shud i do then ?

2014-10-27 11:54:33 -0600 commented answer Corner detection after edge detection

But its showing me this error before building :

1 IntelliSense: identifier "CV_8FC1" is undefined

2014-10-27 11:49:50 -0600 commented answer Corner detection after edge detection

I tried with single channel 8 bit:

               src.copyTo(dst,detected_edges); 
               dst.convertTo(temp, CV_8UC1); 
               cornerHarris( temp, dst, blockSize, apertureSize, k, BORDER_DEFAULT );
           normalize( dst, dst_norm, 0, 255, NORM_MINMAX, CV_8UC1, Mat() );
               convertScaleAbs( dst_norm, dst_norm_scaled );

It still gives exception

2014-10-27 11:37:38 -0600 commented answer Corner detection after edge detection

Can u please tell me how will i change this conversion to the required one(I am new to opencv): dst.convertTo(temp, CV_32FC1);

2014-10-27 11:07:56 -0600 asked a question Corner detection after edge detection

I have used canny edge detection using the following code :

        blur( src, src_gray, Size(3,3) );
        Canny( src_gray, detected_edges, 20, 40, kernel_size );
        dst = Scalar::all(0);
        src.copyTo(dst,detected_edges);

This give me the right edged form , but if i use corner detection by taking the variable dst as input array for corner detection, i get exception although have converted dst to float type 32:

        dst.convertTo(temp, CV_32FC1); 
        cornerHarris( temp, dst, blockSize, apertureSize, k, BORDER_DEFAULT );
       normalize( dst, dst_norm, 0, 255, NORM_MINMAX, CV_32FC1, Mat() );
        convertScaleAbs( dst_norm, dst_norm_scaled );

        /// Drawing a circle around corners
        for( int j = 0; j < dst_norm.rows ; j++ )
        {
            for( int i = 0; i < dst_norm.cols; i++ )
            {
               if( (int) dst_norm.at<float>(j,i) > thresh )
               {
                      circle( dst_norm_scaled, Point( i, j ), 5,  Scalar(0), 2, 8, 0 );
          count++;
          }
      }
 }

I m using visual studio and it shows something like this:

image description

P.S: if i use the detected_edges variable instead of dst , i get no exception but wrong image: original image:

image description

result:

image description

SCREENSHOT Showing exception:

image description

                                Mat dst, dst_norm, dst_norm_scaled;
                //dst = Mat::zeros( src.size(), CV_32FC1 );
                temp = Mat::zeros( src.size(), CV_32FC1 );

                  /// Detector parameters
                int blockSize = 3;
                int apertureSize = 3;
                double k = 0.04;
                blur( src_gray, detected_edges, Size(3,3) );
                Canny( detected_edges, detected_edges, 20, 40, kernel_size );
                   dst = Scalar::all(0);
                   detected_edges.convertTo(detected_edges,CV_8U);
                   src.convertTo(src, CV_8UC1);
                   src.copyTo(dst,detected_edges);
                try{
                cornerHarris( dst, temp, blockSize, apertureSize, k, BORDER_DEFAULT );

                /// Normalizing
                 normalize( temp, dst_norm, 0, 255, NORM_MINMAX, CV_32FC1, Mat() );
                     convertScaleAbs( dst_norm, dst_norm_scaled );
                  /// Drawing a circle around corners
                for( int j = 0; j < dst_norm.rows ; j++ )
                    { for( int i = 0; i < dst_norm.cols; i++ )
                          {
                                if( (int) dst_norm.at<float>(j,i) > thresh )
                                    {
                                        circle( dst_norm_scaled, Point( i, j ), 5,  Scalar(0), 2, 8, 0 );
                                    }
                          }
                    }
                namedWindow( corners_window, CV_WINDOW_AUTOSIZE );
                imshow( corners_window, dst_norm_scaled );
                }
                catch(Exception e)
                {
                    e.err;
                }
2014-10-27 10:51:50 -0600 commented question How to find angle of corners detected?

Sorry for that , i have edited the code

2014-10-27 08:51:46 -0600 commented question How to find angle of corners detected?

I m also new to opencv , and i m tryng to find these points, this is a snippet after corner and canny detection

circle_points= new vector<Point>[count];

int pt=0;

for( int j = 0; j < dst_norm.rows ; j++ )

 {

      for( int i = 0; i &lt; dst_norm.cols; i++ )
      {
           if( (int) dst_norm.at&lt;float&gt;(j,i) &gt; thresh )
          {
             ellipse2Poly( Point(i,j), axes, 0, 0, 360, 1, circle_points[pt] ); 
              pt++;
           }
      }

 }
2014-10-27 07:44:01 -0600 commented question How to find angle of corners detected?

I edited my question just now

2014-10-27 07:43:00 -0600 received badge  Editor (source)
2014-10-27 01:28:09 -0600 asked a question How to find angle of corners detected?

i want to find angles between the corners detected from a sketched rectangle, i have used harris corner detection and canny edge detection and also have drawn circles around the corners , can i used all of these together to find angles of each corner?

I want to find angles from this image for rectangle classification. image description

I have so far done this: image description

Here is a snippet of code (I have saved the vertices of the drawn circle and want to use it with detected edges from canny):

       cornerHarris( detected_edges, dst, blockSize, apertureSize, k, BORDER_DEFAULT );
       normalize( dst, dst_norm, 0, 255, NORM_MINMAX, CV_32FC1, Mat() );
       convertScaleAbs( dst_norm, dst_norm_scaled );

       /// Drawing a circle around corners
       for( int j = 0; j < dst_norm.rows ; j++ )
       {
         for( int i = 0; i < dst_norm.cols; i++ )
         {
           if( (int) dst_norm.at<float>(j,i) > thresh )
           {
             circle( dst_norm_scaled, Point( i, j ), 5,  Scalar(0), 2, 8, 0 );
         count++;
           }
         }
       }

       vector<Point>* circle_points;  
       circle_points= new vector<Point>[count];
       int pt=0;
       for( int j = 0; j < dst_norm.rows ; j++ )
       {
         for( int i = 0; i < dst_norm.cols; i++ )
         {
            if( (int) dst_norm.at<float>(j,i) > thresh )
            {
               ellipse2Poly( Point(i,j), axes, 0, 0, 360, 1, circle_points[pt] ); 
               pt++;
            }
         }
       }