[英]Bounding box coordinate measuring in matlab
我是Matlab的新手。 我想测量RGB或灰度图像中边框的x和y坐标以及质心。 我不知道该怎么办才能解决这个问题。 谁能帮我解决这个问题?
这是我到目前为止的代码
frame=step(obj);
bbox=step(faceDetector,frame);
boxInserter = insertObjectAnnotation(frame,'rectangle',bbox, 'Face Detected');
imshow(boxInserter,'border','tight');
根据帧的面数, 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
这些数字的格式为:[xy width height]
因此脸部的x,y位置是[264,122]。 然后,从这些数字计算质心应该非常简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.