Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #355 from kyamagu/cv320
Browse files Browse the repository at this point in the history
UnitTest

[skip ci]
  • Loading branch information
amroamroamro authored Aug 19, 2017
2 parents f93a35e + aa2abce commit 9aefbcb
Show file tree
Hide file tree
Showing 64 changed files with 882 additions and 408 deletions.
8 changes: 7 additions & 1 deletion +mexopencv/make.m
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,13 @@ function target_test(opts)

if opts.verbose > 0, fprintf('Running unit-tests...\n'); end
cd(fullfile(mexopencv.root(),'test'));
if ~opts.dryrun, UnitTest(opts.opencv_contrib); end
if ~opts.dryrun
UnitTest(...
'ContribModules',opts.opencv_contrib, ...
'Verbosity',opts.verbose, ...
'DryRun',opts.dryrun, ...
'Progress',opts.progressbar);
end
end

function mex_flags = mex_options(opts)
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ doc:
# on exit (access violation), even when it runs just fine.
test:
ifdef WITH_OCTAVE
$(MATLAB) --eval "addpath(pwd);cd test;try,UnitTest($(WITH_CONTRIB));catch e,disp(e);exit(1);end;exit(0);" || echo "Exit code: $$?"
$(MATLAB) --eval "addpath(pwd);cd test;try,UnitTest('ContribModules',$(WITH_CONTRIB));catch e,disp(e);exit(1);end;exit(0);" || echo "Exit code: $$?"
else
$(MATLAB) -r "addpath(pwd);cd test;try,UnitTest($(WITH_CONTRIB));catch e,disp(e.getReport);end;exit;"
$(MATLAB) -r "addpath(pwd);cd test;try,UnitTest('ContribModules',$(WITH_CONTRIB));catch e,disp(e.getReport);end;exit;"
endif
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@ test_script:
- if "%WITH_MAKE%" == "yes" (
sh --login -c "cd \"$MCV_ROOT\" && mingw32-make $MAKE_OPTS test"
) else (
%OCTAVE% --eval "cd test;try,UnitTest(true);catch e,disp(e);exit(1);end;exit(0);" || ver > nul
%OCTAVE% --eval "cd test;try,UnitTest('ContribModules',true);catch e,disp(e);exit(1);end;exit(0);" || ver > nul
)
9 changes: 3 additions & 6 deletions opencv_contrib/test/unit_tests/TestBinaryDescriptorMatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
%TODO: something in this test is causing memory corruption and
%TODO: crashing MATLAB on repeated runs.. most likely an OpenCV bug!
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

X = randi([0,255], [50,32], 'uint8');
Expand Down Expand Up @@ -65,8 +64,7 @@
%TODO: something in this test is causing memory corruption and
%TODO: crashing MATLAB on repeated runs.. most likely an OpenCV bug!
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

% compute descriptors for all training images
Expand All @@ -75,8 +73,7 @@
query = [];
files = dir(fullfile(mexopencv.root(),'test','shape0*.png'));
if isempty(files)
disp('SKIP');
return;
error('mexopencv:testskip', 'missing data');
end
idxQuery = 1;
idxTrain = 2:numel(files);
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestCalibrateCameraAruco.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
%TODO: we need some aruco calibration images: aruco%d.jpg
% (or create synthetic images of board in different perspectives)
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end
N = 4;
corners = cell(1,N);
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestCalibrateCameraCharuco.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
%TODO: we need some charuco calibration images: charuco%d.jpg
% (or create synthetic images of board in different perspectives)
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end
N = 4;
corners = cell(1,N);
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestDAISY.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
function test_compute_all
%TODO: crashes MATLAB
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

img = cv.resize(imread(TestDAISY.im), [64 64]);
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestDISOpticalFlow.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
function test_1
%TODO: crashes MATLAB
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

im1 = 255*uint8([...
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestDPMDetector.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
%TODO: Octave throws error:
% (out of memory or dimension too large for Octave's index type)
if mexopencv.isOctave()
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

detector = cv.DPMDetector(...
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestDataset.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
% see: dataset_mnist_demo.m
dirMNIST = fullfile(mexopencv.root(), 'test', 'mnist', filesep());
if ~isdir(dirMNIST)
disp('SKIP');
return;
error('mexopencv:testskip', 'missing data');
end

ds = cv.Dataset('OR_mnist');
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestDctDenoising.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
function test_rgb2
% we use IMNOISE from Image Processing Toolbox
if ~mexopencv.require('images')
disp('SKIP');
return;
error('mexopencv:testskip', 'toolbox');
end

% CV_8U
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestInpaint2.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
function test_grayscale
%TODO: crashes MATLAB!
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end
end

Expand Down
6 changes: 2 additions & 4 deletions opencv_contrib/test/unit_tests/TestNet.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
% load net
[modelTxt, modelBin] = load_bvlc_googlenet();
if exist(modelTxt, 'file') ~= 2 || exist(modelBin, 'file') ~= 2
disp('SKIP');
return;
error('mexopencv:testskip', 'missing data');
end
net = cv.Net();
net.import('Caffe', modelTxt, modelBin);
Expand Down Expand Up @@ -40,8 +39,7 @@
function test_imgs
[modelTxt, modelBin] = load_bvlc_googlenet();
if exist(modelTxt, 'file') ~= 2 || exist(modelBin, 'file') ~= 2
disp('SKIP');
return;
error('mexopencv:testskip', 'missing data');
end
net = cv.Net();
net.import('Caffe', modelTxt, modelBin);
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestOpticalFlowPCAFlow.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
function test_1
%TODO: crashes MATLAB sometimes!
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

im1 = 255*uint8([...
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestRetinaFastToneMapping.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
function test_tonemap
%TODO: intermittent MATLAB crashes!
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

hdr = cv.imread(fullfile(mexopencv.root(),'test','memorial.hdr'), 'Flags',-1);
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestStructuredEdgeDetection.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
function test_custom_feat_extract
%TODO: custom feature extractor
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

img = imread(TestStructuredEdgeDetection.im);
Expand Down
6 changes: 3 additions & 3 deletions opencv_contrib/test/unit_tests/TestSuperpixelLSC.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

methods (Static)
function test_1
%TODO: OpenCV's SuperpixelLSC is buggy; sometimes crashes MATLAB when called repeatedly
%TODO: OpenCV's SuperpixelLSC is buggy;
% sometimes crashes MATLAB when called repeatedly
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

img = cv.imread(fullfile(mexopencv.root(),'test','fruits.jpg'), ...
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestSuperpixelSLIC.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
function test_1
%TODO: sometimes causes random crashes similar to TestSuperpixelLSC
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

img = cv.imread(fullfile(mexopencv.root(),'test','fruits.jpg'), ...
Expand Down
3 changes: 1 addition & 2 deletions opencv_contrib/test/unit_tests/TestWBDetector.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
%TODO: https://github.com/opencv/opencv_contrib/issues/633
%TODO: https://github.com/opencv/opencv_contrib/issues/741
if true
disp('SKIP');
return;
error('mexopencv:testskip', 'todo');
end

detector = cv.WBDetector();
Expand Down
Loading

0 comments on commit 9aefbcb

Please sign in to comment.