\r
// unlike other nPut()-s this one (with double[]) should convert input values to correct type\r
#define PUT_ITEM(T, R, C) for(int ch=0; ch<me->channels() && count>0; ch++,count--) *((T*)me->ptr(R, C)+ch) = cv::saturate_cast<T>(*(src+ch))\r
+\r
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutD\r
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)\r
{\r
cv::Mat* me = (cv::Mat*) self;\r
- if(! self) return 0; // no native object behind\r
+ if(!me || !me->data) return 0; // no native object behind\r
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range\r
\r
int rest = ((me->rows - row) * me->cols - col) * me->channels();\r
if(! m) return 0;\r
if(! buff) return 0;\r
\r
+ count *= sizeof(T);\r
int rest = ((m->rows - row) * m->cols - col) * m->channels() * sizeof(T);\r
if(count>rest) count = rest;\r
int res = count;\r
{\r
cv::Mat* me = (cv::Mat*) self;\r
if(! self) return 0; // no native object behind\r
- if(me->depth() != CV_8U && me->depth() != CV_8S) return 0; // incompatible type\r
+ if(me->depth() != CV_16U && me->depth() != CV_16S) return 0; // incompatible type\r
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range\r
\r
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);\r
{\r
cv::Mat* me = (cv::Mat*) self;\r
if(! self) return 0; // no native object behind\r
- if(me->depth() != CV_8U && me->depth() != CV_8S) return 0; // incompatible type\r
+ if(me->depth() != CV_32S) return 0; // incompatible type\r
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range\r
\r
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);\r
{\r
cv::Mat* me = (cv::Mat*) self;\r
if(! self) return 0; // no native object behind\r
- if(me->depth() != CV_8U && me->depth() != CV_8S) return 0; // incompatible type\r
+ if(me->depth() != CV_32F) return 0; // incompatible type\r
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range\r
\r
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);\r
if(! m) return 0;\r
if(! buff) return 0;\r
\r
- count *= sizeof(T);//This change is required, checked TODO: recheck for non-continious case\r
+ count *= sizeof(T);\r
int rest = ((m->rows - row) * m->cols - col) * m->channels() * sizeof(T);\r
if(count>rest) count = rest;\r
int res = count;\r