How do I define a window in an image from specific coordination?

1 回表示 (過去 30 日間)
Klara
Klara 2014 年 5 月 17 日
回答済み: Image Analyst 2014 年 5 月 17 日
In an image I would like to define a square window, the place where I want to define a square, its coordination in pixel is known. The size of window should be 120x120.
I have tried but it results in a line instead of window.
Any comments?

回答 (1 件)

Image Analyst
Image Analyst 2014 年 5 月 17 日
I don't know how the word coordination applies here. It means how skillful you are at doing things with your body, like walking on a balance beam or something.
If you don't know the location, try rbbox or imrect(). If the user doesn't draw exactly 120x120, you can use any corner of what they did draw to draw a 120x120 box from that corner.
If you know the rows and columns that define your box, then you can just use plot():
xBox = [row1, row1, row2, row2, row1];
yBox = [col1, col2, col2, col1, col1];
plot(xBox, yBox, 'r-', 'LineWidth', 3);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by