java tests: minor updates
This commit is contained in:
parent
2d820d2321
commit
2a47ab6e08
@ -530,14 +530,14 @@ public class imgprocTest extends OpenCVTestCase {
|
||||
Point truthPosition = new Point(img.cols() / 2, img.rows() / 2);
|
||||
|
||||
Rect r = new Rect(new Point(0, 0), truthPosition);
|
||||
Core.rectangle(img, r.tl(), r.br(), new Scalar(0), -1/* TODO: CV_FILLED */);
|
||||
Core.rectangle(img, r.tl(), r.br(), new Scalar(0), -1 /*TODO: CV_FILLED*/);
|
||||
|
||||
List<Point> corners = new ArrayList<Point>();
|
||||
corners.add(new Point(truthPosition.x + 1, truthPosition.y + 1));
|
||||
|
||||
Size winSize = new Size(2, 2);
|
||||
Size zeroZone = new Size(-1, -1);
|
||||
TermCriteria criteria = new TermCriteria(2/* TODO: CV_TERMCRIT_EPS */, 0, 0.01);
|
||||
TermCriteria criteria = new TermCriteria(2 /*TODO: CV_TERMCRIT_EPS*/, 0, 0.01);
|
||||
|
||||
Imgproc.cornerSubPix(img, corners, winSize, zeroZone, criteria);
|
||||
assertPointEquals(truthPosition, corners.get(0), weakEPS);
|
||||
@ -767,8 +767,7 @@ public class imgprocTest extends OpenCVTestCase {
|
||||
}
|
||||
|
||||
public void testFitEllipse() {
|
||||
Mat points = new Mat(1, 5, CvType.CV_32FC2); // TODO: use the list of
|
||||
// Points
|
||||
Mat points = new Mat(1, 5, CvType.CV_32FC2); // TODO: use the list of Points
|
||||
points.put(0, 0, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0);
|
||||
|
||||
RotatedRect rrect = new RotatedRect();
|
||||
|
@ -7,6 +7,7 @@ import org.opencv.core.Rect;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
import org.opencv.objdetect.CascadeClassifier;
|
||||
import org.opencv.objdetect.Objdetect;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
import org.opencv.test.OpenCVTestRunner;
|
||||
|
||||
@ -39,10 +40,7 @@ public class CascadeClassifierTest extends OpenCVTestCase {
|
||||
Imgproc.cvtColor(rgbLena, greyLena, Imgproc.COLOR_RGB2GRAY);
|
||||
|
||||
// TODO: doesn't detect with 1.1 scale
|
||||
cc.detectMultiScale(greyLena, faces, 1.09, 2, 2 /*
|
||||
* TODO:
|
||||
* CV_HAAR_SCALE_IMAGE
|
||||
*/, new Size(30, 30));
|
||||
cc.detectMultiScale(greyLena, faces, 1.09, 3, Objdetect.CASCADE_SCALE_IMAGE, new Size(30, 30));
|
||||
assertEquals(1, faces.size());
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.opencv.test.video;
|
||||
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.video.Video;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
import org.opencv.video.Video;
|
||||
|
||||
public class videoTest extends OpenCVTestCase {
|
||||
|
||||
@ -66,7 +66,7 @@ public class videoTest extends OpenCVTestCase {
|
||||
Mat prevPts = new Mat(1, 3, CvType.CV_32FC2);
|
||||
prevPts.put(0, 0, 1.0, 1.0, 5.0, 5.0, 10.0, 10.0);
|
||||
|
||||
Size sz = new Size(5, 5);
|
||||
Size sz = new Size(3, 3);
|
||||
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz);
|
||||
assertEquals(0, Core.countNonZero(status));
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ classes_ignore_list = (
|
||||
'OpenCV(Test)?Case',
|
||||
'OpenCV(Test)?Runner',
|
||||
'CvException',
|
||||
'CvType'
|
||||
)
|
||||
|
||||
funcs_ignore_list = (
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`
|
||||
|
||||
BUILD_DIR=build_armeabi
|
||||
opencv_android=`pwd`/../../../android
|
||||
BUILD_DIR=build
|
||||
opencv_android=/home/kir/work/ros_opencv_trunk/opencv/android
|
||||
opencv_build_dir=$opencv_android/$BUILD_DIR
|
||||
|
||||
mkdir -p $BUILD_DIR
|
||||
|
@ -1,10 +1,95 @@
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <opencv2/contrib/contrib.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
int main11(int argc, char* argv[])
|
||||
{
|
||||
TickMeter timer;
|
||||
vector<double> times;
|
||||
|
||||
Scalar x;
|
||||
double s = 0.0;
|
||||
|
||||
int nIters = 100;
|
||||
for (int i = 0; i < nIters; i++)
|
||||
{
|
||||
timer.start();
|
||||
|
||||
Mat m(4096, 1024, CV_32F);
|
||||
//m.setTo(Scalar(33.0));
|
||||
randu(m, 0, 256);
|
||||
x = sum(m);
|
||||
|
||||
timer.stop();
|
||||
times.push_back(timer.getTimeMilli());
|
||||
timer.reset();
|
||||
|
||||
x = sum(m);
|
||||
s += x[0];
|
||||
}
|
||||
|
||||
for (int i = 0; i < nIters; i++)
|
||||
printf("time[%d] = %.2f ms\n", i, times[i]);
|
||||
|
||||
printf("s = %f\n", s);
|
||||
}
|
||||
|
||||
int main3(int argc, char* argv[])
|
||||
{
|
||||
int w = 1280;
|
||||
int h = 720;
|
||||
|
||||
Mat m1(w, h, CV_8U);
|
||||
Mat m2(w, h, CV_8U);
|
||||
Mat m3(w, h, CV_8U);
|
||||
Mat dst(w, h, CV_8U);
|
||||
|
||||
Scalar x;
|
||||
double s = 0.0;
|
||||
|
||||
TickMeter timer1;
|
||||
TickMeter timer2;
|
||||
TickMeter timer3;
|
||||
|
||||
int nIters = 100;
|
||||
for (int i = 0; i < nIters; i++)
|
||||
{
|
||||
randu(m1, 0, 256);
|
||||
randu(m2, 0, 256);
|
||||
|
||||
equalizeHist(m1, m1);
|
||||
equalizeHist(m2, m2);
|
||||
|
||||
timer1.start();
|
||||
add(m1, m2, dst);
|
||||
timer1.stop();
|
||||
|
||||
normalize(dst, dst, dst.total());
|
||||
|
||||
timer2.start();
|
||||
m3 = m1 + m2;
|
||||
timer2.stop();
|
||||
|
||||
timer3.start();
|
||||
dst = m3 + dst;
|
||||
timer3.stop();
|
||||
|
||||
x = sum(dst);
|
||||
s += x[0];
|
||||
}
|
||||
|
||||
printf("s = %f\n", s);
|
||||
printf("timer1 = %.2f ms\n", timer1.getTimeMilli()/nIters);
|
||||
printf("timer2 = %.2f ms\n", timer2.getTimeMilli()/nIters);
|
||||
printf("timer3 = %.2f ms\n", timer3.getTimeMilli()/nIters);
|
||||
}
|
||||
|
||||
const char* message = "Hello Android!";
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main2(int argc, char* argv[])
|
||||
{
|
||||
// print message to console
|
||||
printf("%s\n", message);
|
||||
@ -13,7 +98,7 @@ int main(int argc, char* argv[])
|
||||
Size textsize = getTextSize(message, CV_FONT_HERSHEY_COMPLEX, 3, 5, 0);
|
||||
Mat img(textsize.height + 20, textsize.width + 20, CV_32FC1, Scalar(230,230,230));
|
||||
putText(img, message, Point(10, img.rows - 10), CV_FONT_HERSHEY_COMPLEX, 3, Scalar(0, 0, 0), 5);
|
||||
|
||||
|
||||
// save\show resulting image
|
||||
#if ANDROID
|
||||
imwrite("/mnt/sdcard/HelloAndroid.png", img);
|
||||
@ -21,6 +106,7 @@ int main(int argc, char* argv[])
|
||||
imshow("test", img);
|
||||
waitKey();
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,21 @@
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
vector<Point2f> points;
|
||||
points.push_back(Point2f(1.0, 1.0));
|
||||
points.push_back(Point2f(5.0, 1.0));
|
||||
points.push_back(Point2f(4.0, 3.0));
|
||||
points.push_back(Point2f(6.0, 2.0));
|
||||
|
||||
RotatedRect rrect = minAreaRect(points);
|
||||
|
||||
cout << rrect.center << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void help()
|
||||
{
|
||||
cout << "\nThis program demonstrates the cascade recognizer. Now you can use Haar or LBP features.\n"
|
||||
@ -30,7 +45,7 @@ void detectAndDraw( Mat& img,
|
||||
String cascadeName = "../../data/haarcascades/haarcascade_frontalface_alt.xml";
|
||||
String nestedCascadeName = "../../data/haarcascades/haarcascade_eye_tree_eyeglasses.xml";
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
int main1( int argc, const char** argv )
|
||||
{
|
||||
CvCapture* capture = 0;
|
||||
Mat frame, frameCopy, image;
|
||||
|
Loading…
x
Reference in New Issue
Block a user