Really nice things to read and learn about Matlab and Imaging in this blog post.

Keep up the good work.

]]>The Feret diameter is a great topic!

I wanted to leave a comment to a post from 2008, but comments are closed there, I hope you don’t mind me leaving it here instead. It’s about this post: https://blogs.mathworks.com/steve/2008/09/03/dilation-algorithms-introduction/ . If you run that code on R2017a (it’s the version I’ve got installed right now), you’ll see a very different plot: the right side is 5 times as high as the left side. You used to have an O(1) algorithm for the dilation, now it is O(n). What happened?

]]>function [board,succeeded] = placeQueens(board,col)

N = size(board,1);

if col > N

% There are no columns left. All the queens

% have been placed. Return with success.

succeeded = true;

return

end

safe = false(1,N);

for row = 1:N

safe(row) = isSafe(board,row,col);

end

if ~any(safe)

% There are no safe squares on this column.

% Return with failure.

succeeded = false;

return

end

for row = 1:N

if safe(row)

board(row,col) = 1;

[board,succeeded] = placeQueens(board,col+1);

if succeeded

return

else

% Backtrack. Undo the placement of the queen

% on this column and keep looking.

board(row,col) = 0;

end

end

end

% If we get here, we have checked every row on this column

% without succeeding. Return with failure.

succeeded = false;

end

function [ safe] = isSafe(board,row,col)

safe =true;

% row

if(sum(board(row,:)>0))

safe = false;

return ;

end

if(sum(board(:,col)>0))

safe = false;

return ;

end

% ncol=floor(size(board,2)/2)+1;

dcol = col-row;

if(sum(diag(board,dcol)>0))

safe = false;

return ;

end

NewcolN=size(board,2)-col+1;

dcol = NewcolN-row;

if(sum(diag(fliplr(board),dcol)>0))

safe = false;

return ;

end

end

====

also nice way to viiew the solution

figure;imshow((board),’InitialMagnification’,’fit’)