【问题标题】:How to expand the pixel coordinates in matlab?如何在matlab中扩展像素坐标?
【发布时间】:2013-10-15 12:34:39
【问题描述】:

我想开发一个 matlab 的应用程序,可以显示图像中对象的边界框。

我已检测到该对象,并将其裁剪。

现在,对于边界框,我只需在所有像素中添加 10。

例如:

       x=x+10;  
       y=y+10;  
       w=w+10;  
       h=h+10;  

我使用 imcrop 功能。 但问题是我不明白如何从 imcrop 中获取像素坐标。

     [I_crop, I_rect]=imcrop(ImSeq(:,:,1),[])
     I_rect=floor(I_rect);

     final_rect=I_rect;
     for t=1:NumImages
       cur_r=final_rect(2);
       cur_c=final_rect(1);
         for r= cur_r -10:cur_r+10
           for c=cur_c-10:cur_c+10
             temp= abs(I_crop-ImSeq(r:r+I_rect(4),c:c+I_rect(3),t));

final_rect(2)final_rect(1)I_rect(4)I_rect(3) 是什么?
如何获取裁剪图像的 x,y,w,h 坐标??

谢谢

【问题讨论】:

    标签: image matlab image-processing coordinates


    【解决方案1】:

    [I2 rect] = imcrop(I)中,rect是裁剪矩形,一个四元素位置向量。在原始图像中,裁剪区域定义为:

    rect(2)当前行 rect(1) 当前列
    rect(3) 是宽度 rect(4) 高度。

    【讨论】:

    • 如果我使用自动裁剪。我有: lminc=min(n_bb);lmaxc=max(n_bb); lmaxr=max(m_bb);lminr=min(m_bb);我必须为 r、c 和 temp 更改什么??
    • r = lminr:lmaxrc = lminc:lmaxctemp 取决于您想要实现的目标。
    猜你喜欢
    • 2011-12-04
    • 1970-01-01
    • 2014-06-18
    • 1970-01-01
    • 2011-09-26
    • 1970-01-01
    • 1970-01-01
    • 2014-07-21
    • 1970-01-01
    相关资源
    最近更新 更多