天天看點

matlab-圖檔-imrect使用

1.使用固定大小的框

Display updated position in the title. Specify a position constraint function using makeConstrainToRectFcn to keep the rectangle inside the original Xlim and Ylim ranges.

    f igure, imshow('cameraman.tif');

    h = imrect(gca, [10 10 100 100]);

    addNewPositionCallback(h,@(p) title(mat2str(p,3)));

    fcn = makeConstrainToRectFcn('imrect',get(gca,'XLim'),get(gca,'YLim'));

    setPositionConstraintFcn(h,fcn); 

Now drag the rectangle using the mouse.

繼續閱讀