how to check if (x,y) coordinates fall within another (x,y) coordinate

6 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2020 年 5 月 31 日
回答済み: Image Analyst 2020 年 5 月 31 日
i have the x,y,w,h --> [x position, y position ,width and height] of the two black boxes and the red boxes inside the black boxes (5 in one box and 3 in the other)
say i have the (x,y,w,h) of black boxes in matrix named black_boundingbox (dimension = 2x4) and
that of red in matrix named red_boundingbox (8x4)
based on a condition, only one blackbox gets selected
eg, if box 1 is selected based on my condition, i want to get all the coordinates of the 5 red boxes
how can i select only the 5 red boxes in black box 1, how can i check it based on coordinates because some of the red boxes are outside the black box, but i need those also, how can i do that

採用された回答

Image Analyst
Image Analyst 2020 年 5 月 31 日
Are you sure you want to do this via bounding boxes instead of imreconstruct()?
The easiest way might be to just turn them into digital images, label the red mask, AND the black mask and red labeled images, and use unique() to find out what labels of red are inside the black.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by