Ask Your Question

sujay's profile - activity

2018-06-18 11:09:40 -0600 received badge  Popular Question (source)
2014-03-17 23:52:11 -0600 received badge  Critic (source)
2014-03-17 23:49:47 -0600 asked a question Find bounding box of contour
 using (MemStorage store = new MemStorage())
     for (Contour<Point> contours = canny.FindContours(Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_EXTERNAL, store); contours != null; contours = contours.HNext)
     {
         Contour<Point> currentContour = contours.ApproxPoly(contours.Perimeter * 0.05, store);
         if (currentContour.Area > threshold) 
         {
             Rectangle(currentContour.BoundingRectangle.X,currentContour.BoundingRectangle.Y,currentContour.BoundingRectangle.Height,currentContour.BoundingRectangle.Width);

         }

Error 1 'System.Drawing.Rectangle' is a 'type' but is used like a 'variable'

here rectangle function call require some modification to get the boundoingbox! or any other way to get find bounding box for all contours in image? thank you

2014-03-11 08:32:21 -0600 asked a question how to get freeman chain code in opencv?

I am trying to get chain code using this function but unable to understand its parameters and explanation is not given for each parameter on opencv documentation. C: CvSeq* cvApproxChains(CvSeq* src_seq, CvMemStorage* storage, int method=CV_CHAIN_APPROX_SIMPLE, double parameter=0, int minimal_perimeter=0, int recursive=0 ) this function takng chaincode as input, is there any way to retrieve the chaincode?

if any one come across same problem earlier and having solution for that then plz reply thankyou!!

http://docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=findcontours#approxchains

2014-03-11 08:27:00 -0600 commented question Problem related to access chain code value

i am also have the same problem to get the chain code,if you have some solution then plaese post it

2014-03-10 00:41:00 -0600 commented question Calculating the area of Bounding Box

hi i hv a same problem as you...! is it possible to get area using boundRect[i].tl(), boundRect[i].br() these points? or plz suggest some another method you come across?

2014-02-23 03:30:11 -0600 commented question find connected component and create sub images for each component...

program getting break bcoz of exceptions not able to create subimages

2014-02-22 02:54:22 -0600 asked a question find connected component and create sub images for each component...

trouble in getting subimage....!

problem in Mat subImage(output, cv::Rect(x1, y1, x2-x1, y2-y1)); imshow("sub", subImage);

not taking the correct parameters; unable to create subimages

 void FindBlobs(const Mat &binary,vector<vector<Point2i>>&blobs);

int main()
{
// load the image

Mat img = imread("C:\\Users\\xyz\\Desktop\\text.jpg");
if(!img.data) {
    cout << "File not found" << endl;
    return -1;
}
//Image scaling
Mat img_scale= imread("C:\\Users\\sujay\\Desktop\\texture.jpeg");
resize(img,img, img_scale.size());

// show it in a window
namedWindow( "Image", WINDOW_AUTOSIZE );
imshow("Image", img);

// image window will immediately disappear if the program ends, so
// we'll wait for a keypress, indefinitely
waitKey();

// first copy the image
Mat img_gray = img.clone();
cvtColor(img, img_gray, CV_RGB2GRAY);
imshow("Image", img_gray);
waitKey();

// do a simple transformation: convert to binary

// first copy the image
Mat img_binary = img.clone();

threshold(img_gray, img_binary, 128.0, 255.0, THRESH_BINARY_INV);
resize(img_binary,img_binary, img_scale.size());
imshow("Image", img_binary);
waitKey();

threshold(img_binary, img_binary, 0.0, 1.0, THRESH_BINARY);
resize(img_binary,img_binary, img_scale.size());

Mat output = Mat::zeros(img.size(), CV_8UC3);

vector < vector<Point2i > > blobs;
FindBlobs(img_binary, blobs);
int x1=0,x2=0,y1=0,y2=0;
// Randomy color the blobs
for(size_t i=0; i < blobs.size(); i++) {
    unsigned char r = 255 * (rand()/(1.0 + RAND_MAX));
    unsigned char g = 255 * (rand()/(1.0 + RAND_MAX));
    unsigned char b = 255 * (rand()/(1.0 + RAND_MAX));

    for(size_t j=0; j < blobs[i].size(); j++) {
        int x = blobs[i][j].x; 
        int y = blobs[i][j].y;
        if
        if(j == 0)
        {
            x1=x;
            x2=x;
            y1=y;
            y2=y;
        }
        else
        {
                if(x<x1)
                    x1=x;
                if(x>x2)
                    x2=x;
                if(y<y1)
                    y1=y;
                if(y>y2)
                    y2=y;
        }

        output.at<Vec3b>(y,x)[0] = b;
        output.at<Vec3b>(y,x)[1] = g;
        output.at<Vec3b>(y,x)[2] = r;
    }
    Mat subImage(output, cv::Rect(x1, y1, x2-x1, y2-y1));
    imshow("sub", subImage);
}
imshow("labelled", output);
waitKey(0);
return 0;
 }
 void FindBlobs(const cv::Mat &binary, std::vector < std::vector<cv::Point2i> > &blobs)
{
 blobs.clear();
 cv::Mat label_image;
 binary.convertTo(label_image, CV_32SC1);
 int label_count = 2; // starts at 2 because 0,1 are used already
 for(int y=0; y < label_image.rows; y++) {
    int *row = (int*)label_image.ptr(y);
    for(int x=0; x < label_image.cols; x++) {
        if(row[x] != 1) {
            continue;
        }
        cv::Rect rect;
        cv::floodFill(label_image, cv::Point(x,y), label_count, &rect, 0, 0, 4);
        std::vector <cv::Point2i> blob;

        for(int i=rect.y; i < (rect.y+rect.height); i++) {
            int *row2 = (int*)label_image.ptr(i);
            for(int j=rect.x; j < (rect.x+rect.width); j++) {
                if(row2[j] != label_count) {
                    continue;
                }
                blob.push_back(cv::Point2i(j,i));
            }
        }

        blobs.push_back(blob);

        label_count++;
    }
  }
}
2014-02-18 09:07:27 -0600 received badge  Editor (source)
2014-02-18 08:57:27 -0600 commented question which is the best algorithm other then connected component for character segmentation from text image in open cv?

is it possible using hough transform? but in opencv code is not availabl for generalize hough transform..... @ GilLevi :can you explain me your methodology?

2014-02-17 01:09:56 -0600 asked a question which is the best algorithm other then connected component for character segmentation from text image in open cv?

i am gone a try with hough transform, is it possible to implement it?

2014-02-17 01:06:54 -0600 asked a question feature extraction for OCR: I am going to use Fourier transform,how to implement it using vc++ opencv?

feature extraction for OCR: I am going to use Fourier transform,how to implement it opencv?

provide examples if possible

thankyou