From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: Squashed commit of the sb-vbs branch. Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT. --- SD-VBS/common/toolbox/MultiNcut/showmask.m | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 SD-VBS/common/toolbox/MultiNcut/showmask.m (limited to 'SD-VBS/common/toolbox/MultiNcut/showmask.m') diff --git a/SD-VBS/common/toolbox/MultiNcut/showmask.m b/SD-VBS/common/toolbox/MultiNcut/showmask.m new file mode 100755 index 0000000..6fd1142 --- /dev/null +++ b/SD-VBS/common/toolbox/MultiNcut/showmask.m @@ -0,0 +1,65 @@ +% function RGB=showmask(V,M,hue); +% Input: +% V = image +% M = nonnegative mask +% hue = a number in [0,1], red,yellow,green,cyan,...,red +% a char, 'r','g','b','y','c','m' +% or a matrix of the same size of image +% eg. hue = mask1 * 0.7 + mask2 * 1; +% +% Output: +% RGB = an RGB image with V as shades and M as saturated hues +% If no output is required, this image is displayed. + +% Stella X. YU, 2000. Based on Jianbo Shi's version. + +function RGB=showmask(V,M,hue); + +if nargin<3 | isempty(hue), + hue = 0; +end +if ischar(hue), + switch hue, + case 'r', hue = 1.0; + case 'g', hue = 0.3; + case 'b', hue = 0.7; + case 'y', hue = 0.15; + case 'c', hue = 0.55; + case 'm', hue = 0.85; + end +end + + +V=V-min(V(:)); +V=V/max(V(:)); +V=.25+0.75*V; %brighten things up a bit + +M = double(M); +M = M-min(M(:)); +M = M/max(M(:)); + +H = hue+zeros(size(V)); +S = M; +RGB = hsv2rgb(H,S,V); + +if nargout>0, + return; +end + +hold off; image(RGB); axis('image'); +s = cell(1,2); +if isempty(inputname(1)), + s{1} = 'image'; +else + s{1} = inputname(1); +end +if isempty(inputname(2)), + s{2} = 'mask'; +else + s{2} = inputname(2); +end +title(sprintf('%s and colored %s',s{1},s{2})); + +if nargout==0, + clear RGB; +end -- cgit v1.2.2