Adding black border within video (similar to padarray)
Show older comments
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!
Accepted Answer
More Answers (2)
Keith
on 9 Aug 2014
0 votes
Image Analyst
on 9 Aug 2014
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.
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!