let's say i have the image:
img =[1 0 -1; 0 -1 0; 1 1 -1];
and I'd like to get the values on the 8-connected area around the center:
vals = [0 -1 0 1 0 1 1 -1];
and then get the most common and least common values, and if there are two, to pick the lowest value.
I can only thing to do:
meh = im2col(img,[3 3],'distinct');meh(5,:) = [];answer = mode(meh);
but i can't figure out a way to get the least common thing unless i do ~mode a bunch of times…
Any ideas? Thanks 🙂
Best Answer