Ask Your Question

Ricciolo's profile - activity

2013-11-14 08:37:09 -0600 commented question Mat from UIImage (iOS) differences between emulator and device

That's odd, but using imread the cv::Mat is correct. But the image will come from UIImagePickerController so I need to convert from UIImage

2013-11-14 04:32:59 -0600 commented answer Mat from UIImage (iOS) differences between emulator and device

Same issue :-(

2013-11-14 04:32:17 -0600 commented question Mat from UIImage (iOS) differences between emulator and device

Device is iPhone 4 with iOS 7.0.3 If I dump cvMat.at<uchar>(0,0) cvMat.at<uchar>(1,0) I get on simulator: c b on iphone: c c

2013-11-14 03:18:59 -0600 asked a question Mat from UIImage (iOS) differences between emulator and device

I'm using this function to convert UIImage to Mat

- (cv::Mat)cvMatFromUIImage:(UIImage *)image
{
CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage);
CGFloat cols = image.size.width;
CGFloat rows = image.size.height;

cv::Mat cvMat(rows, cols, CV_8UC4); // 8 bits per component, 4 channels (color channels + alpha)

CGContextRef contextRef = CGBitmapContextCreate(cvMat.data,                 // Pointer to  data
                                         cols,                       // Width of bitmap
                                         rows,                       // Height of bitmap
                                         8,                          // Bits per component
                                         cvMat.step[0],              // Bytes per row
                                         colorSpace,                 // Colorspace
                                         kCGImageAlphaNoneSkipLast |
                                         kCGBitmapByteOrderDefault); // Bitmap info flags

CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), image.CGImage);
CGContextRelease(contextRef);

return cvMat

On emulator it works great and I get image processing as expected. When using the same code on the device with the same image (same jpeg file) I get unexpected result. Looking inside Mat I see different pixel data. Do you know why?

2013-03-25 06:12:37 -0600 received badge  Nice Question (source)
2012-12-08 21:01:56 -0600 received badge  Student (source)
2012-11-26 09:17:59 -0600 asked a question WinRT or Windows Phone 8 porting

Hi, my question is simple: any plan to port OpenCV on WinRT and/or Windows Phone 8?