Hello, can anyone please help me learn how to use an OpenCV method/function that was recently implemented in version 4.4.0 called Stroke Width Transform? The problem is that I am not an expert and there isn't enough documentation yet for someone like me, and I can't really even figure out how to call it properly in my Python program.
This seems to be the function implementation of SWT:
https://docs.opencv.org/master/d8/de7/namespacecv_1_1text.html#a9370f4e7849c94fb418eebd915a6839d
https://docs.opencv.org/4.5.0/javadoc/org/opencv/text/Text.html#detectTextSWT(org.opencv.core.Mat,org.opencv.core.MatOfRect,boolean)
I would like to have the program to detect any characters in the image and then draw/display the characters similar to how it is shown in the Github pull request for the implementation here:
https://github.com/opencv/opencv_contrib/pull/2464#issuecomment-605538667
So far, in my program I can read in the image using imread and then call the function, which gives me the output below. (Which I have no idea how to interpret btw).
But when I try to include the last two parameters to draw the characters, I get the errors you see below.
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm 2020.2.2\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2020.2.2\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/Warre/PycharmProjects/OpencvPython/strokeWT.py", line 7
result, draw, chainBBs = cv.text.detectTextSWT(img, True [, cv.CV_8UC3])
^
SyntaxError: invalid syntax
Any help would be appreciated.