2

i am trying to access and modify mat pixels in native, but i cannot get rid of errors. my function is:

`extern "C" {
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
{
    Mat* pMatGr=(Mat*)addrGray;
    Mat* pMatRgb=(Mat*)addrRgba;
    vector<KeyPoint> v;
int i=0;

uchar* pixel = addrRgba.data;
for(int i = 0; i < Mat.rows * Mat.cols; ++i)
{
    // access pixel[0],pixel[1],pixel[2] here
    pixel += 3; // move to next pixel
}

}

}
`    

and it is called by:

FindFeatures(mGrayMat.getNativeObjAddr(), mRgba.getNativeObjAddr());

from java

my errors are

"field 'data' cannot be resolved", "field 'rows' cannot be resolved"

help would be very appreciated. thanks

user1768360
  • 193
  • 1
  • 2
  • 12

1 Answers1

0

Mat.rows should be pMatGr->rows, Mat.cols should pMatGr->cols, addrRgba.data should be pMatRgb->data.

john
  • 7,897
  • 29
  • 27