【发布时间】:2015-11-09 18:49:52
【问题描述】:
我想根据图像的中心裁剪一个框,因此我对 imcrop 感到困惑。
主要是,我想在中心上方/下方/左侧/右侧裁剪 50 像素的框,但我无法获得正确的坐标。此外,如何在原始图像上标记框。
谢谢。
脚本:
clc;
clear;
I = imread('m83.tif');
imshow(I)
[height, width, dim] = size(I);
centerWidth=round(width/2)
centerHeight=round(height/2)
BoxBottomX=centerWidth-50;
BoxBottomY=centerHeight-50;
BoxTopX=centerWidth+50;
BoxTopY=centerHeight+50
imshow(I)
hold on
plot(centerWidth, centerHeight, '-rx')
imcrop(I, [BoxBottomX BoxBottomY BoxTopX BoxTopY]);
【问题讨论】: