MATLAB: I want to mark the highest point of any non-black pixel within the image to find the max point.

algorithmduplicate postimage analysisimage processingpoint location

here is my image. I had ask before at https://www.mathworks.com/matlabcentral/answers/213198-i-want-to-mark-only-the-highest-middle-point-of-binary-image-but-it-show-the-min-point-too but i might ask in not clear question.
<<
the last of my output will be like this.
>>

Best Answer

row=find(sum(BWImage,2)==0,1,'last')+1;
col=find(BWImage(row,:)~=0);
row=row*ones(size(col));
Points=[row(:) col(:)];
Points contains the row and column of the point or points at the top.