function data=produce_figure(cross,indices,pts1,option,img1)
if size(pts1,2)>1
    x=pts1(:,1);
    y=pts1(:,2);
else
    x=pts1(1:2:end);
    y=pts1(2:2:end);
end
markersize=11;
col=colormap('hsv');
len=length(indices);
k=floor(length(col)/(len));
if nargin>4
    %data.imh=imshow(img1);
    data.imh=imshow(img1); %imagesc(img1);
    axis image
    axis equal
    hold on
end
j=1;
sumx=0;
eyemeanx=0; eyemeany=0;
for i=1:length(indices)
    x1=x(indices(i));
    y1=y(indices(i));
    if i==6
        eyemeanx=x1; eyemeany=y1;
    elseif i==7
        eyemeanx=eyemeanx+x1; eyemeany=eyemeany+y1;
    end
    c=col(j,:);
    colouring.x(i)=x1;
    colouring.y(i)=y1;
    colouring.c(i,:)=c;
    colouring.indices(i)=indices(i);
    if nargin>4
        if cross<2
            data.ph(i)=plot(x1,y1,'o','MarkerFaceColor',col(j,:),'markersize',markersize);
        else
            plot(x,y,'O','MarkerFaceColor',col(j,:),'markersize',markersize);
            plot(x,y,'xk','markersize',markersize);
            %data.ph(i)=plot(x1,y1,'o','MarkerEdgeColor',col(j,:),'markersize',10,'MarkerFaceColor','none');
%             th(1)=text(x1-10,y1+1,'+','color','k','FontWeight','normal','fontsize',2*markersize);
%             th(2)=text(x1-13,y1+1,'O','color',col(j,:),'FontWeight','bold','fontsize',2*markersize);
        end
        %ph=plot(x1,y1,option,'MarkerFaceColor',col(j,:),'markersize',10);
    else
        if cross<2
            data.ph(i)=plot(x1,y1,'o','MarkerFaceColor',col(j,:),'markersize',markersize);
        else
            plot(x,y,'O','MarkerFaceColor',col(j,:),'markersize',markersize);
            plot(x,y,'xk','markersize',markersize);
            %data.ph(i)=plot(x1,y1,'o','MarkerFaceColor',col(j,:),'markersize',markersize);
        end
    end
    j=j+k;
end
if cross==2
    save colouring.mat colouring
end
mx=mean(x(indices));
my=mean(y(indices));
data.eyemeanx=eyemeanx/2; 
data.eyemeany=eyemeany/2;

if cross==1
    data.ph(i)=plot(mx,my,'o','MarkerFaceColor','w','markersize',markersize*1.6);
    data.ph(i)=plot(mx,my,'x','MarkerFaceColor','k','markersize',markersize*1.6);
%     
%     %plot(mx,my,'xk','markersize',15,'markerfacecolor','k','markeredgecolor','w');
%     data.th(1)=text(mx-11,my,'X','fontsize',22,'FontWeight','bold','Color','w');
%     data.th(2)=text(mx-10,my,'X','fontsize',20,'FontWeight','normal','Color','k');
end
hold off
data.mx=floor(mx);
data.my=floor(my);
data.x=x;
data.y=y;
if nargin>4
    data.img=img1;
end

function plot_cross_in_circle(x,y,color,siz)
if nargin<3
    color=[1 0 0];
end
if nargin<4
    siz=10;
end
plot(x,y,'O','MarkerFaceColor',color,'markersize',siz);
plot(x,y,'xk','markersize',siz);
%plot(x,y,'O','MarkerFaceColor',[1,1,1],'markersize',ceil(siz*0.8));

