Ask Your Question
0

How haar like tilted features are represented in xml cascade?

asked 2013-05-15 19:13:24 -0600

eanes gravatar image

Hello everybody!

I am trying to flip horizontally the rectangles of xml cascade. For normal rectangles, without tilt, I simply use rect.x = img_width - rect.x - rect.width.

But, aparently, that equation does not apply when the rectangle is tilted. When the rectangle is tilted we have the following marks in xml cascade : <tilted>1</tilted>

Someone, please, could help to understand to to flip tilted rectangles in the xml cascade?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-05-25 15:22:15 -0600

greggo gravatar image

updated 2017-05-25 15:27:03 -0600

To reflect tilted haar features horizontally:

  • Change the x to img_width-x
  • Swap the width & height values.

The (x,y) are the coordinates of the upper 'corner' of the rectangle (the shape actually includes two adjacent pixels on that row, and the x coordinate is that of the rightmost one).

The 'width' is measured diagonally down from that point (increasing x and y) and the height is measured diagonally the other way (decreasing x, and increasing y) from (x-1,y).

For instance, the min ''x" corner pixel included within a tilted feature rectangle is at (x-height, y+height-1) and the max x is (x+width-1, y + width-1). The total number of pixels included in a tilted rectangle is height * width*2 - since both sides are measured in diagonal pixel units ( sqrt(2) pixels).

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-15 19:13:24 -0600

Seen: 879 times

Last updated: May 25 '17