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

4

1 回答 1

0

Mat.rows应该pMatGr->rowsMat.cols应该pMatGr->colsaddrRgba.data应该pMatRgb->data

于 2012-11-13T10:20:18.053 回答