Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CGBitmapContextCreate: invalid data bytes/row error

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

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?

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?