how to draw a rectangle on the matlab.ui.control.image object?
Show older comments
I have a matlab.ui.control.image object in my aplication class
classdef GreenScreenUI < matlab.apps.AppBase
properties (Access = public)
OriginalImage matlab.ui.control.Image
end
I'm loaging image in it
app.OriginalImage.ImageSource = app.vImage;
I have a rectangle rect = [x y width height]
How do I draw this rectangle on the image inside OriginalImage?
Accepted Answer
More Answers (1)
Image Analyst
on 17 Aug 2019
If you want to draw a rectangle into the overlay above an image, use rectangle():
hold on;
rectangle('Position', [xleft, yTop, width, height]);
If you want to burn a line into an image at column col, use indexing and assignment:
yourImage(:, col, :) = 0; % Burn black line into column col.
If you want a grid, put the above line into two loops, one over columns, and a separtae one over rows.
1 Comment
Hakob Bazoyan
on 17 Aug 2019
Categories
Find more on Graphics Performance 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!