vrabaud / gPb

gPb implementation for OpenCV
102 stars 36 forks source link

bug (i guess) in contours2ucm.m #9

Open legalup opened 7 years ago

legalup commented 7 years ago

i am on ubuntu 1404, using g++ 4.7.

git cloned, and did set up. was not able to run compile.m, but was able to compile mex from source. when i ran 'example.m', i gave me an error that i was using 'rows' incorrectly. the code was this:

function [seg8] = to_8(seg4)

seg8 = seg4; for i = 1 : rows(seg4)-1, for j = 1 : columns(seg4)-1, if (seg8(i,j) > 0 && seg8(i+1, j+1) > 0 && seg8(i,j+1) == 0 && seg8(i+1,j) == 0), seg8(i,j+1) = ( seg8(i,j) + seg8(i+1,j+1) )/2;
end end end

and i changed it to:

function [seg8] = to_8(seg4)

seg8 = seg4; [rs cs]=size(seg4);

for i = 1 : rs-1, for j = 1 : cs-1, if (seg8(i,j) > 0 && seg8(i+1, j+1) > 0 && seg8(i,j+1) == 0 && seg8(i+1,j) == 0), seg8(i,j+1) = ( seg8(i,j) + seg8(i+1,j+1) )/2;
end end end

not sure where the previous 'rows' function was defined, but it is also defined the Database toolkit.

you may want to fix it!