Hi AAT,
Sorry, it must have been the way I worded it, I didn't need you to test it for me - I knew it worked, I only made it available as a test / comparison for you to fix your code, demonstrating my results.
Quote:
I have tested your programm "with change.pb", it works fine.
Either I misunderstood your requirements, or you missed this in my last post:
Quote:
a workaround would only require a little math and the cvPolyLine Function
- I'll update the package later with a new example, including the Structure & Functions from your post (thanks!)
- you said rotated, not rotated and bound (too include bounded requires a little more math)
- I noticed a small caveat - if the lines are aliasing, use the context menu to open the image a second time (something still too figure out)
Code:
Dim pts.CvPoint(4)
npts = ArraySize(pts())
angle.d = 0.45
For rtnCount = 1 To nContours
area.d = cvContourArea(*contours, 0, $3fffffff, 0)
If area >= 35
cvDrawContours(*contour, *contours, 255, 155, 0, 0, 155, 255, 0, 0, -1, 1, #CV_AA, 0, 0)
x = Round(*contours\rect\x + *contours\rect\width / 2, #PB_Round_Up)
y = Round(*contours\rect\y + *contours\rect\height / 2, #PB_Round_Up) width = *contours\rect\width
height = *contours\rect\height
pts(0)\x = Round(x + (width / 2) * Cos(angle) - (height / 2) * Sin(angle), #PB_Round_Nearest)
pts(0)\y = Round(y + (height / 2) * Cos(angle) + (width / 2) * Sin(angle), #PB_Round_Nearest)
pts(1)\x = Round(x - (width / 2) * Cos(angle) - (height / 2) * Sin(angle), #PB_Round_Nearest)
pts(1)\y = Round(y + (height / 2) * Cos(angle) - (width / 2) * Sin(angle), #PB_Round_Nearest)
pts(2)\x = Round(x - (width / 2) * Cos(angle) + (height / 2) * Sin(angle), #PB_Round_Nearest)
pts(2)\y = Round(y - (height / 2) * Cos(angle) - (width / 2) * Sin(angle), #PB_Round_Nearest)
pts(3)\x = Round(x + (width / 2) * Cos(angle) + (height / 2) * Sin(angle), #PB_Round_Nearest)
pts(3)\y = Round(y - (height / 2) * Cos(angle) + (width / 2) * Sin(angle), #PB_Round_Nearest)
cvPolyLine(*contour, pts(), @npts, 1, #True, 0, 0, 255, 0, 1, #CV_AA, #Null)
cvRectangleR(*contour, *contours\rect\x, *contours\rect\y, *contours\rect\width, *contours\rect\height, 0, 255, 255, 0, 1, #CV_AA, #Null)
EndIf
*contours = *contours\h_next
Next