提交 fa0daa48 编写于 作者: A Andrey Pavlenko

Java API: fixing converters (copyData=true) and samples compilation

Testing: 1079/0/592
上级 6935e95c
......@@ -16,6 +16,7 @@ import org.opencv.imgproc.Imgproc;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
public class imgprocTest extends OpenCVTestCase {
private Mat gray_64f_2;
......@@ -1407,11 +1408,14 @@ public class imgprocTest extends OpenCVTestCase {
}
public void testMinEnclosingCircle() {
Mat points = new Mat(1, 4, CvType.CV_32FC2);
points.put(0, 0, -1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, -1.0);
List<Point> points = new ArrayList<Point>();
points.add(new Point(0, 0));
points.add(new Point(-1, 0));
points.add(new Point(0, -1));
points.add(new Point(1, 0));
points.add(new Point(0, 1));
OpenCVTestRunner.Log(points.toString());
OpenCVTestRunner.Log(points.dump());
Point actualCenter = new Point();
float radius = 347.0f; // FIXME: Unexpected radius is returned i.e 0
......
......@@ -474,6 +474,7 @@ func_arg_fix = {
'goodFeaturesToTrack' : { 'corners' : 'vector_Point', },
'findFundamentalMat' : { 'points1' : 'vector_Point2d', 'points2' : 'vector_Point2d', },
'cornerSubPix' : { 'corners' : 'vector_Point2f', },
'minEnclosingCircle' : { 'points' : 'vector_Point2f', },
'findHomography' : { 'srcPoints' : 'vector_Point2f', 'dstPoints' : 'vector_Point2f', },
'solvePnP' : { 'objectPoints' : 'vector_Point3f', 'imagePoints' : 'vector_Point2f', },
'solvePnPRansac' : { 'objectPoints' : 'vector_Point3f', 'imagePoints' : 'vector_Point2f', },
......@@ -940,7 +941,7 @@ extern "C" {
jn_code.write( Template(\
" private static native $type $name($args);\n").substitute(\
type = type_dict[fi.ctype].get("jn_type", "double[]"), \
name = fi.jname + '_' + `suffix_counter`, \
name = fi.jname + '_' + str(suffix_counter), \
args = ", ".join(["%s %s" % (type_dict[a.ctype]["jn_type"], a.name.replace(".","_").replace("[","").replace("]","")) for a in jn_args])
) );
......@@ -1007,7 +1008,7 @@ extern "C" {
j_type=type_dict[fi.ctype]["j_type"], \
j_name=fi.jname, \
j_args=", ".join(["%s %s" % (type_dict[a.ctype]["j_type"], a.name) for a in args]), \
jn_name=fi.jname + '_' + `suffix_counter`, \
jn_name=fi.jname + '_' + str(suffix_counter), \
jn_args_call=", ".join( [a.name for a in jn_args] ),\
)
)
......@@ -1109,7 +1110,7 @@ JNIEXPORT $rtype JNICALL Java_org_opencv_${module}_${clazz}_$fname
rtype = rtype, \
module = self.module, \
clazz = clazz, \
fname = (fi.jname + '_' + `suffix_counter`).replace('_', '_1'), \
fname = (fi.jname + '_' + str(suffix_counter)).replace('_', '_1'), \
args = ", ".join(["%s %s" % (type_dict[a.ctype].get("jni_type"), a.name) for a in jni_args]), \
prologue = "\n ".join(c_prologue), \
epilogue = " ".join(c_epilogue), \
......
......@@ -24,7 +24,7 @@ void Mat_to_vector_int(Mat& mat, vector<int>& v_int)
void vector_int_to_Mat(vector<int>& v_int, Mat& mat)
{
mat = Mat(v_int);
mat = Mat(v_int, true);
}
......@@ -39,7 +39,7 @@ void Mat_to_vector_double(Mat& mat, vector<double>& v_double)
void vector_double_to_Mat(vector<double>& v_double, Mat& mat)
{
mat = Mat(v_double);
mat = Mat(v_double, true);
}
......@@ -54,7 +54,7 @@ void Mat_to_vector_float(Mat& mat, vector<float>& v_float)
void vector_float_to_Mat(vector<float>& v_float, Mat& mat)
{
mat = Mat(v_float);
mat = Mat(v_float, true);
}
......@@ -86,7 +86,7 @@ void Mat_to_vector_Rect(Mat& mat, vector<Rect>& v_rect)
void vector_Rect_to_Mat(vector<Rect>& v_rect, Mat& mat)
{
mat = Mat(v_rect);
mat = Mat(v_rect, true);
}
......@@ -142,32 +142,32 @@ void Mat_to_vector_Point3d(Mat& mat, vector<Point3d>& v_point)
void vector_Point_to_Mat(vector<Point>& v_point, Mat& mat)
{
mat = Mat(v_point);
mat = Mat(v_point, true);
}
void vector_Point2f_to_Mat(vector<Point2f>& v_point, Mat& mat)
{
mat = Mat(v_point);
mat = Mat(v_point, true);
}
void vector_Point2d_to_Mat(vector<Point2d>& v_point, Mat& mat)
{
mat = Mat(v_point);
mat = Mat(v_point, true);
}
void vector_Point3i_to_Mat(vector<Point3i>& v_point, Mat& mat)
{
mat = Mat(v_point);
mat = Mat(v_point, true);
}
void vector_Point3f_to_Mat(vector<Point3f>& v_point, Mat& mat)
{
mat = Mat(v_point);
mat = Mat(v_point, true);
}
void vector_Point3d_to_Mat(vector<Point3d>& v_point, Mat& mat)
{
mat = Mat(v_point);
mat = Mat(v_point, true);
}
......
package org.opencv.samples.puzzle15;
import org.opencv.Android;
import org.opencv.android.Utils;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
......@@ -137,7 +137,7 @@ public class puzzle15View extends SampleCvViewBase implements OnTouchListener {
drawGrid(cols, rows);
Bitmap bmp = Bitmap.createBitmap(cols, rows, Bitmap.Config.ARGB_8888);
if (Android.MatToBitmap(mRgba15, bmp))
if (Utils.MatToBitmap(mRgba15, bmp))
return bmp;
bmp.recycle();
......
......@@ -7,7 +7,7 @@ import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;
import org.opencv.Android;
import org.opencv.android.Utils;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Rect;
......@@ -91,7 +91,7 @@ class FdView extends SampleCvViewBase {
Bitmap bmp = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.ARGB_8888);
if (Android.MatToBitmap(mRgba, bmp))
if (Utils.MatToBitmap(mRgba, bmp))
return bmp;
bmp.recycle();
......
package org.opencv.samples.imagemanipulations;
import org.opencv.Android;
import org.opencv.android.Utils;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
......@@ -135,7 +135,7 @@ class ImageManipulationsView extends SampleCvViewBase {
Bitmap bmp = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.ARGB_8888);
if (Android.MatToBitmap(mRgba, bmp))
if (Utils.MatToBitmap(mRgba, bmp))
return bmp;
bmp.recycle();
......
package org.opencv.samples.tutorial1;
import org.opencv.Android;
import org.opencv.android.Utils;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
......@@ -56,7 +56,7 @@ class Sample1View extends SampleViewBase {
Bitmap bmp = Bitmap.createBitmap(getFrameWidth(), getFrameHeight(), Bitmap.Config.ARGB_8888);
if (Android.MatToBitmap(mRgba, bmp))
if (Utils.MatToBitmap(mRgba, bmp))
return bmp;
bmp.recycle();
......
package org.opencv.samples.tutorial2;
import org.opencv.Android;
import org.opencv.android.Utils;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
......@@ -54,7 +54,7 @@ class Sample2View extends SampleCvViewBase {
Bitmap bmp = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.ARGB_8888);
if (Android.MatToBitmap(mRgba, bmp))
if (Utils.MatToBitmap(mRgba, bmp))
return bmp;
bmp.recycle();
......
package org.opencv.samples.tutorial4;
import org.opencv.Android;
import org.opencv.android.Utils;
import org.opencv.core.Mat;
import org.opencv.core.CvType;
import org.opencv.imgproc.Imgproc;
......@@ -56,7 +56,7 @@ class Sample4View extends SampleViewBase {
Bitmap bmp = Bitmap.createBitmap(getFrameWidth(), getFrameHeight(), Bitmap.Config.ARGB_8888);
if (Android.MatToBitmap(mRgba, bmp))
if (Utils.MatToBitmap(mRgba, bmp))
return bmp;
bmp.recycle();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册