Hallo Leute,
ich hab mich mal zu gerungen eine UDF zumachen um OpenCV in AutoIt verwenden zu können. Da ich einige Probleme wahrscheinlich haben werde, wird dieser Thread wahrscheinlich lang werden. Und wenn dann die UDF fertig ist, werd ich ihn dann auf gelöst setzen ( autoBert ;)).
Zum ersten Problem:
Ich bin grad dabei die Funktion cvCircle umzusetzen.
http://www.emgu.com/wiki/files/1.5…b7ad03cefae.htm
In AutoIt bin ich nun schon soweit:
Spoiler anzeigen
Global Const $tagCvPoint = _
"int x;" & _
"int y"
Global Const $tagCvScalar = "double val[4]"
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]_OpenCV_Circle($iImage, 50, 100, 20)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Func _OpenCV_Circle($_iImage, $_iX, $_iY, $_iRadius, $_iThickness = 1, $_iLineType = 8, $_iShift = 0)
Local $_tCenter = DllStructCreate($tagCvPoint)
If @error Then Return SetError(1, @error, 0)
Local $_tColor = DllStructCreate($tagCvScalar)
If @error Then Return SetError(2, @error, 0)
DllStructSetData($_tCenter, "x", $_iX)
DllStructSetData($_tCenter, "y", $_iY)
DllStructSetData($_tColor, "val", 150, 1)
DllStructSetData($_tColor, "val", 150, 2)
DllStructSetData($_tColor, "val", 150, 3)
DllStructSetData($_tColor, "val", 0, 4)
Local $_aResult = DllCall($__ghOCVDll_1, "int:cdecl", "cvCircle", "int", $_iImage, "ptr", DllStructGetPtr($_tCenter), "int", $_iRadius, _
"ptr", DllStructGetPtr($_tColor), "int", $_iThickness, "int", $_iLineType, "int", $_iShift)
If @error Then Return SetError(3, @error, 0)
Return $_aResult[0]
EndFunc
Nun bekomme ich aber eine Fehlermeldung von der Dll.
OpenCV Error: Assertion failed (radius >= 0 && thickness <= 255 && 0 <= shift && shift <= XY_SHIFT) in unknown function, file ..\..\..\src\opencv\modules\core\src\drawing.cpp, line 1628
Die dazugehörige Funktion in der Cpp sieht so aus:
Spoiler anzeigen
void circle( Mat& img, Point center, int radius,
const Scalar& color, int thickness, int line_type, int shift )
{
if( line_type == CV_AA && img.depth() != CV_8U )
line_type = 8;
CV_Assert( radius >= 0 && thickness <= 255 &&
0 <= shift && shift <= XY_SHIFT );
double buf[4];
scalarToRawData(color, buf, img.type(), 0);
if( thickness > 1 || line_type >= CV_AA )
{
center.x <<= XY_SHIFT - shift;
center.y <<= XY_SHIFT - shift;
radius <<= XY_SHIFT - shift;
EllipseEx( img, center, Size(radius, radius),
0, 0, 360, buf, thickness, line_type );
}
else
Circle( img, center, radius, buf, thickness < 0 );
}
Alles anzeigen
Weiß jemand vielleicht wo der Fehler liegt?