【问题标题】:Bounding box coordinate measuring in matlabmatlab中的边界框坐标测量
【发布时间】:2016-07-07 12:26:05
【问题描述】:

我是 matlab 新手。我想测量 RGB 或灰度图像中边界框的 x 和 y 坐标和质心。我不知道我应该怎么做才能解决这个问题。谁能帮我解决这个问题?

这是我目前的代码

frame=step(obj);
bbox=step(faceDetector,frame);
boxInserter  = insertObjectAnnotation(frame,'rectangle',bbox, 'Face Detected');
imshow(boxInserter,'border','tight');  

【问题讨论】:

    标签: matlab


    【解决方案1】:

    根据您的框架具有的面数,step 方法返回一个具有不同维度的bbox 矩阵,其中包含边界框本身的坐标。关于bbox的描述见这里:

    https://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetector.step.html

    例如,

    % Create a cascade detector object.
    faceDetector = vision.CascadeObjectDetector();
    
    % Read a video frame and run the detector.
    videoFileReader = vision.VideoFileReader('visionface.avi');
    videoFrame      = step(videoFileReader);
    bbox            = step(faceDetector, videoFrame); 
    

    bbox中返回这个:

    264   122    93    93
    

    这些数字的格式是:[x y width height]

    所以人脸的 x, y 位置是 [264, 122]。从这些数字计算质心应该相当简单。

    【讨论】:

      猜你喜欢
      • 2017-10-08
      • 2019-06-29
      • 1970-01-01
      • 2019-06-18
      • 2021-08-29
      • 2019-11-01
      • 2015-11-26
      • 2015-05-14
      • 2017-07-15
      相关资源
      最近更新 更多