Using example calibration target code

New user here. I’m trying to utilize the gen_pattern.py example to create a checkboard pattern, but I’m having difficulty getting the necessary svgfig package to install. I’ve cloned the package from https://github.com/jpivarski/svgfig but when I try to install, I get a "failed to compile exception on _curve. Any recommendations for a workaround/solution?

I’m currently running it with Python 2.7 (I believe svgfig only works with python 2).

hmm, it’s all here no need to install anything further.

also, if you just need a standard chessboard, there’s a ready made one here

My apologies, I wasn’t kidding when I said I’m a new user (including to python), I’m not typically programming/scripting so I’m having a little difficulty getting my environment, etc. set up and running. So this will seem a stupid question but I haven’t managed to get it figured out.

I’ve gotten anaconda and opencv installed in a new environment. From there I’m a little confused as to how to call this function. Can I call these once I’ve imported cv2, or do I need to run them separately? I’ve tried pulling both files down into a separate folder and running them from the conda prompt, and they appear to run, but I don’t get any output, just a python cache file name svgfig.cpython-38.

Unfortunately I do need a custom one, as we are trying to set up several cameras with different fields of view, so I’ll need different sizes; it would be great to use this to customize to the application.

A little more information.

I’ve tried running this using both python 3.8 and 2.7, and get the same result (cache file, svgfig.pyc). I’m pretty confident now that I’m at least calling everything correctly after doing some minor debugging, but I haven’t yet identified the point where the code is failing and outputting the cache. From all appearances in the command prompt the program is running to completion without errors, I just don’t get any output other than the cache.

Is there something system-wise that could be preventing output from the conda prompt? I tried running as administrator, but that did not alter the behavior.

maybe you can show us your cmdline ?

cmd line with output from various print commands placed in both svgfig and gen_pattern.

btw, please make it a habit to report things like that AS TEXT,
instead of posting useless screenshots
(so e.g. it can be properly indexed for search, ppl can try to reproduce it, etc,)
((k,k, my bad, i asked for the cmdline, not for “how do you invoke this script”…))

Re-posting as text. Just updated my call to the following:

(py2) C:\Users\user\Desktop\Ullage>python gen_pattern.py -o circleboard.svg -r 7 -c 5 -T checkerboard -s 15 -u mm -w 200 -h 200

This outputs all of my print commands that I placed throughout gen_pattern.py and svgfig.py without errors.

1 Like

indeed, it does not produce anything (apart from the __pycache__) like that ;(

so, problem reproduced, but no cure yet

Well, if nothing else it makes me feel a bit better that it’s not just me. Thanks for checking. Should I start a new issue on github then?

1 Like

well it actually does write the svg, just to a weird place:

so, on windows, it ends up on the user’s desktop (quite unexpected…)

i think so.
there should be either a fat note about this “behaviour”, or those 2 lines be removed

Much appreciated, thanks for catching that, serves me right for having too many windows open I guess. Issue created under #21708.

2 Likes

well done !
now this ofc needs a proper fix
(we’ve got green light to remove the silly desktop indirection)

would you like to do this ?
(i’d rather leave the honour to you, and guide you through it, than doing it myself)

Hi there, I ran into this issue myself. I see that solution was already proposed, but not applied. If @kbrady doesn’t have time to execute it, than I would gladly take over. :slight_smile:
@berak, I would definitely appreciate your guidance through the process.

It has been on my to-do list, but that list unfortunately got quite long. If you’d like to take over, please do.