提交 cd05d9aa 编写于 作者: A Andrey Kamaev

Fix build of Java API for Windows

上级 fe0d07ae
......@@ -187,7 +187,9 @@ set_target_properties(${the_module} PROPERTIES
LINK_INTERFACE_LIBRARIES ""
)
install(TARGETS ${the_module} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
install(TARGETS ${the_module}
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
set(lib_target ${the_module}_library)
if(ANDROID)
......
......@@ -462,8 +462,10 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
env->SetDoubleArrayRegion(result, 0, 2, fill);
if (baseLine != NULL)
env->SetIntArrayRegion(baseLine, 0, 1, pbaseLine);
if (baseLine != NULL) {
jint jbaseLine = (jint)(*pbaseLine);
env->SetIntArrayRegion(baseLine, 0, 1, &jbaseLine);
}
return result;
......@@ -872,13 +874,17 @@ public class %(jc)s {
#include "converters.h"
#if defined DEBUG && defined ANDROID
#include <android/log.h>
#define MODULE_LOG_TAG "OpenCV.%(m)s"
#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, MODULE_LOG_TAG, __VA_ARGS__))
# include <android/log.h>
# define MODULE_LOG_TAG "OpenCV.%(m)s"
# define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, MODULE_LOG_TAG, __VA_ARGS__))
#else //DEBUG
#define LOGD(...)
# define LOGD(...)
#endif //DEBUG
#ifdef _MSC_VER
# pragma warning(disable:4800 4244)
#endif
#include "opencv2/%(m)s/%(m)s.hpp"
using namespace cv;
......
......@@ -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;
......
......@@ -198,12 +198,12 @@ void Mat_to_vector_KeyPoint(Mat& mat, vector<KeyPoint>& v_kp)
void vector_KeyPoint_to_Mat(vector<KeyPoint>& v_kp, Mat& mat)
{
int count = v_kp.size();
int count = (int)v_kp.size();
mat.create(count, 1, CV_32FC(7));
for(int i=0; i<count; i++)
{
KeyPoint kp = v_kp[i];
mat.at< Vec<float, 7> >(i, 0) = Vec<float, 7>(kp.pt.x, kp.pt.y, kp.size, kp.angle, kp.response, kp.octave, kp.class_id);
mat.at< Vec<float, 7> >(i, 0) = Vec<float, 7>(kp.pt.x, kp.pt.y, kp.size, kp.angle, kp.response, (float)kp.octave, (float)kp.class_id);
}
}
#endif
......@@ -231,7 +231,7 @@ void Mat_to_vector_Mat(cv::Mat& mat, std::vector<cv::Mat>& v_mat)
void vector_Mat_to_Mat(std::vector<cv::Mat>& v_mat, cv::Mat& mat)
{
int count = v_mat.size();
int count = (int)v_mat.size();
mat.create(count, 1, CV_32SC2);
for(int i=0; i<count; i++)
{
......@@ -258,12 +258,12 @@ void Mat_to_vector_DMatch(Mat& mat, vector<DMatch>& v_dm)
void vector_DMatch_to_Mat(vector<DMatch>& v_dm, Mat& mat)
{
int count = v_dm.size();
int count = (int)v_dm.size();
mat.create(count, 1, CV_32FC4);
for(int i=0; i<count; i++)
{
DMatch dm = v_dm[i];
mat.at< Vec<float, 4> >(i, 0) = Vec<float, 4>(dm.queryIdx, dm.trainIdx, dm.imgIdx, dm.distance);
mat.at< Vec<float, 4> >(i, 0) = Vec<float, 4>((float)dm.queryIdx, (float)dm.trainIdx, (float)dm.imgIdx, dm.distance);
}
}
#endif
......
......@@ -6,6 +6,8 @@
#ifdef HAVE_OPENCV_FEATURES2D
#include "opencv2/features2d/features2d.hpp"
#undef SIMPLEBLOB // to solve conflict with wincrypt.h on windows
namespace cv
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册