Adding black border within video (similar to padarray)
显示 更早的评论
Hi, I am a new user to Matlab, and I was wondering if there is a function to add a black border within a video frame such that the size of the matrix does not change. Thank you in advance!
采纳的回答
更多回答(2 个)
Image Analyst
2014-8-9
If you want a box over a live or recorded video that is playing, you can put hold on and then use plot() or line() to put up a frame/box in the overlay. Make the color black and the line width whatever you want
xBox = [x1,x2,x2,x1,x1];
yBox = [y1,y1,y2,y2.y1];
hold on;
plot(xBox, yBox, 'Color', 'k', 'LineWidth', 7);
This way might be faster since you don't actually have to change any image values and redisplay the new image - it all just happens in the overlay. The black box in the overlay "covers up" the underlying image. I do it all the time to show various region outlines over a live video stream.
类别
在 帮助中心 和 File Exchange 中查找有关 Video Formats and Interfaces 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!