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

@@ -6,7 +6,7 @@ if(IOS OR NOT PYTHON_EXECUTABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDR
endif()
set(the_description "The java bindings")
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_imgcodecs opencv_highgui opencv_ml opencv_calib3d opencv_photo opencv_nonfree opencv_contrib)
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_imgcodecs opencv_videoio opencv_ml opencv_calib3d opencv_photo opencv_nonfree opencv_contrib)
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp")
if(NOT ANDROID)

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 {

View File

@@ -11,7 +11,7 @@ except:
class_ignore_list = (
#core
"FileNode", "FileStorage", "KDTree", "KeyPoint", "DMatch",
#highgui
#videoio
"VideoWriter",
)
@@ -536,13 +536,13 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
"""\n private static native String getSupportedPreviewSizes_0(long nativeObj);\n""",
'cpp_code' :
"""
JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_getSupportedPreviewSizes_10
JNIEXPORT jstring JNICALL Java_org_opencv_videoio_VideoCapture_getSupportedPreviewSizes_10
(JNIEnv *env, jclass, jlong self);
JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_getSupportedPreviewSizes_10
JNIEXPORT jstring JNICALL Java_org_opencv_videoio_VideoCapture_getSupportedPreviewSizes_10
(JNIEnv *env, jclass, jlong self)
{
static const char method_name[] = "highgui::VideoCapture_getSupportedPreviewSizes_10()";
static const char method_name[] = "videoio::VideoCapture_getSupportedPreviewSizes_10()";
try {
LOGD("%s", method_name);
VideoCapture* me = (VideoCapture*) self; //TODO: check for NULL

View File

@@ -2,7 +2,7 @@
from __future__ import print_function
import os, sys, re, string, fnmatch
allmodules = ["core", "flann", "imgproc", "ml", "imgcodecs", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "cuda", "androidcamera", "java", "python", "stitching", "ts", "photo", "nonfree", "videostab", "softcascade", "superres"]
allmodules = ["core", "flann", "imgproc", "ml", "imgcodecs", "videoio", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "cuda", "androidcamera", "java", "python", "stitching", "ts", "photo", "nonfree", "videostab", "softcascade", "superres"]
verbose = False
show_warnings = True
show_errors = True

View File

@@ -6,7 +6,7 @@ import org.opencv.R;
import org.opencv.android.Utils;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.highgui.Highgui;
import org.opencv.videoio.Videoio;
import android.app.Activity;
import android.app.AlertDialog;
@@ -46,7 +46,7 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac
protected int mMaxHeight;
protected int mMaxWidth;
protected float mScale = 0;
protected int mPreviewFormat = Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA;
protected int mPreviewFormat = Videoio.CV_CAP_ANDROID_COLOR_FRAME_RGBA;
protected int mCameraIndex = CAMERA_ID_ANY;
protected boolean mEnabled;
protected FpsMeter mFpsMeter = null;
@@ -151,10 +151,10 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
Mat result = null;
switch (mPreviewFormat) {
case Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA:
case Videoio.CV_CAP_ANDROID_COLOR_FRAME_RGBA:
result = mOldStyleListener.onCameraFrame(inputFrame.rgba());
break;
case Highgui.CV_CAP_ANDROID_GREY_FRAME:
case Videoio.CV_CAP_ANDROID_GREY_FRAME:
result = mOldStyleListener.onCameraFrame(inputFrame.gray());
break;
default:
@@ -168,7 +168,7 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac
mPreviewFormat = format;
}
private int mPreviewFormat = Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA;
private int mPreviewFormat = Videoio.CV_CAP_ANDROID_COLOR_FRAME_RGBA;
private CvCameraViewListener mOldStyleListener;
};

View File

@@ -2,8 +2,8 @@ package org.opencv.android;
import org.opencv.core.Mat;
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 android.content.Context;
import android.util.AttributeSet;
@@ -88,9 +88,9 @@ public class NativeCameraView extends CameraBridgeViewBase {
synchronized (this) {
if (mCameraIndex == -1)
mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID);
mCamera = new VideoCapture(Videoio.CV_CAP_ANDROID);
else
mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID + mCameraIndex);
mCamera = new VideoCapture(Videoio.CV_CAP_ANDROID + mCameraIndex);
if (mCamera == null)
return false;
@@ -119,8 +119,8 @@ public class NativeCameraView extends CameraBridgeViewBase {
AllocateCache();
mCamera.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, frameSize.width);
mCamera.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, frameSize.height);
mCamera.set(Videoio.CV_CAP_PROP_FRAME_WIDTH, frameSize.width);
mCamera.set(Videoio.CV_CAP_PROP_FRAME_HEIGHT, frameSize.height);
}
Log.i(TAG, "Selected camera frame size = (" + mFrameWidth + ", " + mFrameHeight + ")");
@@ -139,13 +139,13 @@ public class NativeCameraView extends CameraBridgeViewBase {
@Override
public Mat rgba() {
mCapture.retrieve(mRgba, Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
mCapture.retrieve(mRgba, Videoio.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
return mRgba;
}
@Override
public Mat gray() {
mCapture.retrieve(mGray, Highgui.CV_CAP_ANDROID_GREY_FRAME);
mCapture.retrieve(mGray, Videoio.CV_CAP_ANDROID_GREY_FRAME);
return mGray;
}

View File

@@ -25,7 +25,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;
public class OpenCVTestCase extends TestCase {
//change to 'true' to unblock fail on fail("Not yet implemented")
@@ -164,8 +164,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);