Split highgui module to videoio and highgui

This commit is contained in:
vbystricky
2014-07-10 18:27:32 +04:00
committed by VBystricky
parent f773cd9a3e
commit d58f736935
149 changed files with 1673 additions and 1309 deletions

View File

@@ -21,7 +21,7 @@ import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.core.DMatch;
import org.opencv.core.KeyPoint;
import org.opencv.highgui.Highgui;
import org.opencv.imgcodecs.Imgcodecs;
import android.util.Log;
@@ -134,8 +134,8 @@ public class OpenCVTestCase extends TestCase {
rgba0 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(0));
rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(128));
rgbLena = Highgui.imread(OpenCVTestRunner.LENA_PATH);
grayChess = Highgui.imread(OpenCVTestRunner.CHESS_PATH, 0);
rgbLena = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH);
grayChess = Imgcodecs.imread(OpenCVTestRunner.CHESS_PATH, 0);
v1 = new Mat(1, 3, CvType.CV_32F);
v1.put(0, 0, 1.0, 3.0, 2.0);

View File

@@ -5,7 +5,7 @@ import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
@@ -57,7 +57,7 @@ public class UtilsTest extends OpenCVTestCase {
}
public void testMatToBitmap() {
Mat imgBGR = Highgui.imread( OpenCVTestRunner.LENA_PATH );
Mat imgBGR = Imgcodecs.imread( OpenCVTestRunner.LENA_PATH );
assertTrue(imgBGR != null && !imgBGR.empty() && imgBGR.channels() == 3);
Mat m16 = new Mat(imgBGR.rows(), imgBGR.cols(), CvType.CV_8UC4);

View File

@@ -18,7 +18,7 @@ import org.opencv.features2d.DescriptorMatcher;
import org.opencv.features2d.FeatureDetector;
import org.opencv.features2d.Features2d;
import org.opencv.core.KeyPoint;
import org.opencv.highgui.Highgui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
@@ -93,7 +93,7 @@ public class Features2dTest extends OpenCVTestCase {
writeFile(extractorCfgFile, extractorCfg);
extractor.read(extractorCfgFile);
Mat imgTrain = Highgui.imread(OpenCVTestRunner.LENA_PATH, Highgui.CV_LOAD_IMAGE_GRAYSCALE);
Mat imgTrain = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH, Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);
Mat imgQuery = imgTrain.submat(new Range(0, imgTrain.rows() - 100), Range.all());
MatOfKeyPoint trainKeypoints = new MatOfKeyPoint();
@@ -139,7 +139,7 @@ public class Features2dTest extends OpenCVTestCase {
Mat outimg = new Mat();
Features2d.drawMatches(imgQuery, queryKeypoints, imgTrain, trainKeypoints, matches, outimg);
String outputPath = OpenCVTestRunner.getOutputFileName("PTODresult.png");
Highgui.imwrite(outputPath, outimg);
Imgcodecs.imwrite(outputPath, outimg);
// OpenCVTestRunner.Log("Output image is saved to: " + outputPath);
}
}

View File

@@ -2,7 +2,7 @@ package org.opencv.test.highgui;
import org.opencv.core.MatOfByte;
import org.opencv.core.MatOfInt;
import org.opencv.highgui.Highgui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
@@ -15,29 +15,29 @@ public class HighguiTest extends OpenCVTestCase {
public void testImencodeStringMatListOfByte() {
MatOfByte buff = new MatOfByte();
assertEquals(0, buff.total());
assertTrue( Highgui.imencode(".jpg", gray127, buff) );
assertTrue( Imgcodecs.imencode(".jpg", gray127, buff) );
assertFalse(0 == buff.total());
}
public void testImencodeStringMatListOfByteListOfInteger() {
MatOfInt params40 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 40);
MatOfInt params90 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 90);
MatOfInt params40 = new MatOfInt(Imgcodecs.IMWRITE_JPEG_QUALITY, 40);
MatOfInt params90 = new MatOfInt(Imgcodecs.IMWRITE_JPEG_QUALITY, 90);
/* or
MatOfInt params = new MatOfInt();
params.fromArray(Highgui.IMWRITE_JPEG_QUALITY, 40);
params.fromArray(Imgcodecs.IMWRITE_JPEG_QUALITY, 40);
*/
MatOfByte buff40 = new MatOfByte();
MatOfByte buff90 = new MatOfByte();
assertTrue( Highgui.imencode(".jpg", rgbLena, buff40, params40) );
assertTrue( Highgui.imencode(".jpg", rgbLena, buff90, params90) );
assertTrue( Imgcodecs.imencode(".jpg", rgbLena, buff40, params40) );
assertTrue( Imgcodecs.imencode(".jpg", rgbLena, buff90, params90) );
assertTrue(buff40.total() > 0);
assertTrue(buff40.total() < buff90.total());
}
public void testImreadString() {
dst = Highgui.imread(OpenCVTestRunner.LENA_PATH);
dst = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH);
assertTrue(!dst.empty());
assertEquals(3, dst.channels());
assertTrue(512 == dst.cols());
@@ -45,7 +45,7 @@ public class HighguiTest extends OpenCVTestCase {
}
public void testImreadStringInt() {
dst = Highgui.imread(OpenCVTestRunner.LENA_PATH, 0);
dst = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH, 0);
assertTrue(!dst.empty());
assertEquals(1, dst.channels());
assertTrue(512 == dst.cols());

View File

@@ -3,8 +3,8 @@ package org.opencv.test.highgui;
import java.util.List;
import org.opencv.core.Size;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
import org.opencv.videoio.Videoio;
import org.opencv.videoio.VideoCapture;
import org.opencv.test.OpenCVTestCase;
@@ -26,8 +26,8 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testGet() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
double frameWidth = capture.get(Videoio.CV_CAP_PROP_FRAME_WIDTH);
assertTrue(0 != frameWidth);
} finally {
if (capture != null) capture.release();
@@ -36,7 +36,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testGetSupportedPreviewSizes() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
List<Size> sizes = capture.getSupportedPreviewSizes();
assertNotNull(sizes);
assertFalse(sizes.isEmpty());
@@ -53,7 +53,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testGrabFromRealCamera() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
isSucceed = capture.grab();
assertTrue(isSucceed);
} finally {
@@ -68,7 +68,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testIsOpenedRealCamera() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
isOpened = capture.isOpened();
assertTrue(isOpened);
} finally {
@@ -79,7 +79,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testOpen() {
try {
capture = new VideoCapture();
capture.open(Highgui.CV_CAP_ANDROID);
capture.open(Videoio.CV_CAP_ANDROID);
isOpened = capture.isOpened();
assertTrue(isOpened);
} finally {
@@ -89,7 +89,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testRead() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
isSucceed = capture.read(dst);
assertTrue(isSucceed);
assertFalse(dst.empty());
@@ -101,7 +101,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testRelease() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
capture.release();
assertFalse(capture.isOpened());
capture = null;
@@ -112,7 +112,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testRetrieveMat() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
capture.grab();
isSucceed = capture.retrieve(dst);
assertTrue(isSucceed);
@@ -125,9 +125,9 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testRetrieveMatInt() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
capture.grab();
isSucceed = capture.retrieve(dst, Highgui.CV_CAP_ANDROID_GREY_FRAME);
isSucceed = capture.retrieve(dst, Videoio.CV_CAP_ANDROID_GREY_FRAME);
assertTrue(isSucceed);
assertFalse(dst.empty());
assertEquals(1, dst.channels());
@@ -138,10 +138,10 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testSet() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 640);
capture.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, 480);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
capture.set(Videoio.CV_CAP_PROP_FRAME_WIDTH, 640);
capture.set(Videoio.CV_CAP_PROP_FRAME_HEIGHT, 480);
double frameWidth = capture.get(Videoio.CV_CAP_PROP_FRAME_WIDTH);
capture.read(dst);
assertEquals(640.0, frameWidth);
assertEquals(640, dst.cols());
@@ -158,7 +158,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testVideoCaptureInt() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Videoio.CV_CAP_ANDROID);
assertNotNull(capture);
assertTrue(capture.isOpened());
} finally {