Fix build of Java API for Windows
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
#define LOGD(...)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(disable:4800)
|
||||
#endif
|
||||
|
||||
#include "opencv2/core/core.hpp"
|
||||
|
||||
using namespace cv;
|
||||
@@ -2170,7 +2174,7 @@ template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count,
|
||||
if(! buff) return 0;
|
||||
|
||||
count *= sizeof(T);
|
||||
int rest = ((m->rows - row) * m->cols - col) * m->elemSize();
|
||||
int rest = ((m->rows - row) * m->cols - col) * (int)m->elemSize();
|
||||
if(count>rest) count = rest;
|
||||
int res = count;
|
||||
|
||||
@@ -2179,14 +2183,14 @@ template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count,
|
||||
memcpy(m->ptr(row, col), buff, count);
|
||||
} else {
|
||||
// row by row
|
||||
int num = (m->cols - col) * m->elemSize(); // 1st partial row
|
||||
int num = (m->cols - col) * (int)m->elemSize(); // 1st partial row
|
||||
if(count<num) num = count;
|
||||
uchar* data = m->ptr(row++, col);
|
||||
while(count>0){
|
||||
memcpy(data, buff, num);
|
||||
count -= num;
|
||||
buff += num;
|
||||
num = m->cols * m->elemSize();
|
||||
num = m->cols * (int)m->elemSize();
|
||||
if(count<num) num = count;
|
||||
data = m->ptr(row++, 0);
|
||||
}
|
||||
@@ -2330,7 +2334,7 @@ template<typename T> int mat_get(cv::Mat* m, int row, int col, int count, char*
|
||||
if(! buff) return 0;
|
||||
|
||||
int bytesToCopy = count * sizeof(T);
|
||||
int bytesRestInMat = ((m->rows - row) * m->cols - col) * m->elemSize();
|
||||
int bytesRestInMat = ((m->rows - row) * m->cols - col) * (int)m->elemSize();
|
||||
if(bytesToCopy > bytesRestInMat) bytesToCopy = bytesRestInMat;
|
||||
int res = bytesToCopy;
|
||||
|
||||
@@ -2339,7 +2343,7 @@ template<typename T> int mat_get(cv::Mat* m, int row, int col, int count, char*
|
||||
memcpy(buff, m->ptr(row, col), bytesToCopy);
|
||||
} else {
|
||||
// row by row
|
||||
int bytesInRow = (m->cols - col) * m->elemSize(); // 1st partial row
|
||||
int bytesInRow = (m->cols - col) * (int)m->elemSize(); // 1st partial row
|
||||
while(bytesToCopy > 0)
|
||||
{
|
||||
int len = std::min(bytesToCopy, bytesInRow);
|
||||
@@ -2348,7 +2352,7 @@ template<typename T> int mat_get(cv::Mat* m, int row, int col, int count, char*
|
||||
buff += len;
|
||||
row++;
|
||||
col = 0;
|
||||
bytesInRow = m->cols * m->elemSize();
|
||||
bytesInRow = m->cols * (int)m->elemSize();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
@@ -2525,7 +2529,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
|
||||
|
||||
jdoubleArray res = env->NewDoubleArray(me->channels());
|
||||
if(res){
|
||||
jdouble buff[me->channels()];
|
||||
jdouble buff[CV_CN_MAX];//me->channels()
|
||||
int i;
|
||||
switch(me->depth()){
|
||||
case CV_8U: for(i=0; i<me->channels(); i++) buff[i] = *((unsigned char*) me->ptr(row, col) + i); break;
|
||||
|
||||
Reference in New Issue
Block a user