function [rimg] = tri_fill_image(t, upts, img)
[rows,cols,planes]=size(img);
rimg=double(reshape(img,rows*cols,planes));
mxi=upts(t,1);
myi=upts(t,2);
mm=roipoly(img,mxi,myi); % find enclosed pixels
ind=find(mm); % and substitute NaN
rimg(ind,:)=[1 0 0]*ones(length(ind),1);



