Cody

Solution 114473

Submitted on 18 Jul 2012 by Aurelien Queffurust
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% f = fopen('mymorphop.m','rt'); code = lower(fread(f,Inf,'*char'))'; fclose(f); assert(isempty(strfind(code,'dilat'))) assert(isempty(strfind(code,'erode'))) assert(isempty(strfind(code,'bwmorph'))) assert(isempty(strfind(code,'filt'))) assert(isempty(strfind(code,'conv')))
2   Pass
%% in = zeros(3,3); out = in; assert(isequal(mymorphop(in),out));
M = 3 N = 3 row = Empty matrix: 0-by-1 col = Empty matrix: 0-by-1 out = 0 0 0 0 0 0 0 0 0
3   Pass
%% in = zeros(10,5); in(4,3) = 1; out = in; out(3:5,2:4) = 1; assert(isequal(mymorphop(in),out));
M = 10 N = 5 row = 4 col = 3 out = 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4   Pass
%% in = [0,0,1,0,0,1,0 0,1,0,0,0,1,1 1,1,0,0,0,0,0 1,0,0,0,0,0,1 1,0,0,0,0,1,1]; out = [1,1,1,1,1,1,1 1,1,1,1,1,1,1 1,1,1,0,1,1,1 1,1,1,0,1,1,1 1,1,0,0,1,1,1]; assert(isequal(mymorphop(in),out));
M = 5 N = 7 row = 3 4 5 2 3 1 1 2 5 2 4 5 col = 1 1 1 2 2 3 6 6 6 7 7 7 out = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1
5   Pass
%% in = [0,0,1,0,0,0,0,0,1 0,1,0,0,0,0,0,0,1 1,1,0,0,0,0,0,0,1 1,0,0,0,0,0,0,0,1 1,0,0,0,0,0,0,0,1]; out = [1,1,1,1,0,0,0,1,1 1,1,1,1,0,0,0,1,1 1,1,1,0,0,0,0,1,1 1,1,1,0,0,0,0,1,1 1,1,0,0,0,0,0,1,1]; assert(isequal(mymorphop(in),out));
M = 5 N = 9 row = 3 4 5 2 3 1 1 2 3 4 5 col = 1 1 1 2 2 3 9 9 9 9 9 out = 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1