Java API: calcOpticalFlowPyrLK() args types are changed to vector<>

Testing: 1130/0/585
This commit is contained in:
Andrey Pavlenko
2011-08-03 13:31:51 +00:00
parent 0595ca7454
commit 8b16dbe791
5 changed files with 77 additions and 37 deletions

View File

@@ -67,6 +67,11 @@ void Mat_to_vector_uchar(Mat& mat, vector<uchar>& v_uchar)
v_uchar = (vector<uchar>) mat;
}
void vector_uchar_to_Mat(vector<uchar>& v_uchar, Mat& mat)
{
mat = Mat(v_uchar, true);
}
void Mat_to_vector_char(Mat& mat, vector<char>& v_char)
{
v_char.clear();
@@ -74,6 +79,11 @@ void Mat_to_vector_char(Mat& mat, vector<char>& v_char)
v_char = (vector<char>) mat;
}
void vector_char_to_Mat(vector<char>& v_char, Mat& mat)
{
mat = Mat(v_char, true);
}
//vector_Rect

View File

@@ -15,7 +15,10 @@ void Mat_to_vector_float(cv::Mat& mat, std::vector<float>& v_float);
void vector_float_to_Mat(std::vector<float>& v_float, cv::Mat& mat);
void Mat_to_vector_uchar(cv::Mat& mat, std::vector<uchar>& v_uchar);
void vector_uchar_to_Mat(std::vector<uchar>& v_uchar, cv::Mat& mat);
void Mat_to_vector_char(cv::Mat& mat, std::vector<char>& v_char);
void vector_char_to_Mat(std::vector<char>& v_char, cv::Mat& mat);
void Mat_to_vector_Rect(cv::Mat& mat, std::vector<cv::Rect>& v_rect);
void vector_Rect_to_Mat(std::vector<cv::Rect>& v_rect, cv::Mat& mat);

View File

@@ -293,7 +293,7 @@ public class Converters {
float[] buff = new float[count];
m.get(0, 0, buff);
for(int i=0; i<count; i++) {
fs.add( new Float(buff[i]) );
fs.add( buff[i] );
}
}
@@ -314,6 +314,23 @@ public class Converters {
return res;
}
public static void Mat_to_vector_uchar(Mat m, List<Byte> us) {
if(us == null)
throw new java.lang.IllegalArgumentException("Output List can't be null");
int count = m.rows();
if( CvType.CV_8UC1 != m.type() || m.cols()!=1 )
throw new java.lang.IllegalArgumentException(
"CvType.CV_8UC1 != m.type() || m.cols()!=1\n" + m);
us.clear();
byte[] buff = new byte[count];
m.get(0, 0, buff);
for(int i=0; i<count; i++) {
us.add( buff[i] );
}
}
public static Mat vector_char_to_Mat(List<Byte> bs) {
Mat res;
int count = (bs!=null) ? bs.size() : 0;
@@ -360,7 +377,7 @@ public class Converters {
int[] buff = new int[count];
m.get(0, 0, buff);
for(int i=0; i<count; i++) {
is.add( new Integer(buff[i]) );
is.add( buff[i] );
}
}
@@ -376,7 +393,7 @@ public class Converters {
byte[] buff = new byte[count];
m.get(0, 0, buff);
for(int i=0; i<count; i++) {
bs.add( new Byte(buff[i]) );
bs.add( buff[i] );
}
}