Ask Your Question

iOSDev's profile - activity

2017-08-22 17:50:49 -0500 received badge  Popular Question (source)
2013-04-25 01:36:16 -0500 answered a question What are the correct XCode 4.5.2 settings for the compiled framework?
2013-04-24 06:33:02 -0500 commented answer How to detect page corners using openCV

Hi zerog80, Thank you for your answer. Actually i am new to OpenCV. I don't have any idea how to call Hough Line Transform function. Will you give me some sample code which will help me to detect corners or lines of page.

2013-04-24 06:01:56 -0500 received badge  Student (source)
2013-04-24 05:50:59 -0500 asked a question How to detect page corners using openCV

I tried below code:

    IplImage* eig_image = 0;
    IplImage* temp_image = 0;

    // Create grayscale IplImage from UIImage
    IplImage *img_color = [self CreateIplImageFromUIImage:imageView.image];
    IplImage *img1 = cvCreateImage(cvGetSize(img_color), IPL_DEPTH_8U, 1);
    cvCvtColor(img_color, img1, CV_BGR2GRAY);
    cvReleaseImage(&img_color);

    if(img1==0) {
        printf("oh no!");
    }

    eig_image = cvCreateImage(cvGetSize(img1),IPL_DEPTH_32F, 1);
    temp_image = cvCreateImage(cvGetSize(img1),IPL_DEPTH_32F, 1);

    const int MAX_CORNERS = 100;
    CvPoint2D32f corners[MAX_CORNERS];
    int corner_count = MAX_CORNERS;
    double quality_level = 0.1;
    double min_distance = 1;
    int eig_block_size = 3;
    int use_harris = true;
    double k  = .4;

    cvGoodFeaturesToTrack(img1, eig_image, temp_image,corners,&corner_count,quality_level,min_distance,NULL,eig_block_size,use_harris,k);

    NSLog(@"corners %d",corner_count);

But got result : corners = 0

Can anyone help me with this issue.

2013-04-24 05:33:03 -0500 received badge  Editor (source)
2013-04-24 05:26:33 -0500 asked a question CGBitmapContextCreate: invalid data bytes/row error

I am new to OpenCV, I tried this image processing code

I am changing color image to grayscale on click of button using below code :

- (IBAction)grayScaleBtnClicked:(id)sender
 {
    cv::Mat tempMat = [self cvMatGrayFromUIImage:image];
    _imageView.image = [self UIImageFromCVMat:tempMat];
}

But getting error as

<Error>: CGBitmapContextCreate: invalid data bytes/row: should be at least 2000 for 8 integer bits/component, 3 components, kCGImageAlphaNoneSkipLast. 
<Error>: CGContextDrawImage: invalid context 0x0

Any idea?