Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .test_benchmarks.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pkg load image
test_benchmarks

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ To compile the benchmark on 32-but/64-bit Linux follow the instructions found in
> This script should compile the correspondPixels mex file and copy it into the
> ../benchmarks/ directory.

## Running benchmark
To run bench mark from project root run:
> source ./run.sh

## Measures and Usage

The original benchmark already includes the following measures:
Expand Down Expand Up @@ -118,4 +122,4 @@ Redistribution and use in source and binary forms, with or without modification,
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 changes: 39 additions & 0 deletions benchmarks/bwmorph.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Copyright (C) 2017 Arslan Khan <arslankhan52@gmail.com>, Muhammad Talha <m.talha.imran01@gmail.com>
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## gradMag = bwmorph(image)
## where image is the binary image, and grad image is the morphological operation
##
## This function implements a minimum implementation of bwmorph enough to carry
## out benchmarking. This helper API performs Morphological operations on
## binary images

## The first output @var{gradMag} returns image skeleton
##
## @end deftypefn

function [gradMag] = bwmorph (img)
gradMag=zeros(size(img));
for x=1:size(img)(1)
for y=1:size(img)(2)
if (x-1>1 && y-1>1)
gradMag(x,y) = img(x,y) - img(x-1,y-1);
end
end
end

endfunction

2 changes: 1 addition & 1 deletion benchmarks/plot_eval.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function plot_eval(evalDir,col)
fwrite(2,sprintf('\n%s\n',evalDir));

if exist(fullfile(evalDir,'eval_bdry_thr.txt'),'file'),
open('isoF.fig');
figure(1)
hold on
prvals = dlmread(fullfile(evalDir,'eval_bdry_thr.txt')); % thresh,r,p,f
f=find(prvals(:,2)>=0.01);
Expand Down
3 changes: 3 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if ! matlab -nodisplay -nojvm -r "test_benchmarks; exit"; then
sudo octave --no-gui .test_benchmarks.m
fi
12 changes: 11 additions & 1 deletion source/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
matlab -nodisplay -nojvm -r "build; exit"
if ! matlab -nodisplay -nojvm -r "build; exit" ; then
echo "Matlab Not Found, Trying Octave"
if mkoctfile correspondPixels.cc csa.cc kofn.cc match.cc Exception.cc Matrix.cc Random.cc String.cc Timer.cc -Wno-format-security -O3 -Wno-format -Wno-write-strings -DNOBLAS --mex ; then
echo "Octave Found, Build Successful"
else
echo "Kindly Install either Matlab or Octave"
fi
fi
echo "Moving output artifacts"
cp -f correspondPixels.mex* ../benchmarks/
echo "Done, to run benchmark run 'source ./run.sh'"
cd ..
3 changes: 3 additions & 0 deletions test_benchmarks.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
addpath benchmarks
clear all;close all;clc;

% Create root directory for output results
mkdir('tests');

%% 1. Test all the benchmarks for results stored in 'ucm2' format:

imgDir = 'data/BSDS500/images';
Expand Down