how to check if (x,y) coordinates fall within another (x,y) coordinate
조회 수: 3 (최근 30일)
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 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.