I´m a begginer on C Language and I need to copy pixels to Android Bitmap, I´m using a piece of code of android opencv, used for a jni:
AndroidBitmapInfo info;
void* pixels;
int ret;
cv::Mat* mat;
if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0 ){
LOGE("AndroidBitmap_getInfo() failed ! error=%d", ret);
return false; // can't get info
}
if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888){
LOGE("Bitmap format is not RGB_8888 !");
return false; // incompatible format
}
if ( (ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0 ){
LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
return false; // can't get pixels
}
memcpy(pixels, mat->data, info.height * info.width * 4);
AndroidBitmap_unlockPixels(env, bitmap);
So, I have an IplImage* called pImage, but I don´t know how to convert an IplImage* to a cv::Mat*. I see a way to convert to a cv:Mat, like this:
cv::Mat mat(pImage);
But I need an cv:Mat* not an cv:Mat. Any help?
Answering to your question title: