• JonB

    Is it fair to say the the corner points seem to be behaving correctly, and the lines have the correct angles, however the line positions appear incorrect?

    One problem I see is that you should not be using update. This calls the function even if it is not needed. Instead, rename it to update_points and call that from touch_moved and touch_ended.

    A second issue is that you are creating many, many Vector3D objects, since .center() creates new instances. Might be a memory problem.

    As a debug, maybe you can change Linea as follows, and see if the orig/dest are being set correctly (this adds a label to the center of each line).

    class Linea (ShapeNode):
        def __init__(self, orig, dest, *args, **kwargs):
            ShapeNode.__init__(self, *args, **kwargs)
            self.lbl=LabelNode('{},{}'.format(orig,dest),font=('<System>',6),color='red')
            self.add_child(self.lbl)
            self.line_path(orig, dest)
            self.stroke_color = '#ffffff'
            self.anchor_point=(.5,.5)
        def line_path(self, orig, dest):
            x1,y1 = orig
            x2,y2 = dest
            self.position=((x2-x1)/2. + x1, (y2-y1)/2. + y1)
            path = ui.Path()
            path.line_width = 2
            path.move_to(x1,y2)
            path.line_to(x2,y1)
            self.lbl.text='{}\n{}'.format(orig,dest)
            self.path = path
    

    I suspect the issue has something to do with how Paths auto reset the bounds, which the original code depends on. Maybe ios12 behaves differently.
    Finally, here is a numpy'd version of the code. Does this work for you, and is it faster?

    https://gist.github.com/6881aaaf165e248b3f8c0549df03503c

    posted in Pythonista read more
  • JonB

    fwiw, requests lets you use req.json() rather than json.loads(req.contents). also, you can use json=values instead of json.dumps(values) in the request.

    posted in Pythonista read more
  • JonB

    When you say that, in addition to slowness, the picture does not look corredt, can you post a screenie? maybe if we can figure out the cause of the drawing error, we will get to the cause of the slowness.

    Does the initial picture, before using touch look ok?
    Could you try using update to rotate directly, without using touch?
    If those are messed up, then you can set a specific rotation angle, and dump out the points and rotation matricies, and we can check against the theoretical.

    posted in Pythonista read more
  • JonB

    so, did you try the bytesio code, followed by b64encode? Post that completed attempt, then we can work from there. You might need to pass that through .decode('ascii') after that. you might need json= instead of data=.

    I found a complete python api:

    https://github.com/ffmmjj/kairos-face-sdk-python/blob/master/kairos_face/enroll.py

    which uses those two other modifications I mentioned (they read the file directly, but the important thing is just getting the bytes out into b64encode)

    posted in Pythonista read more
  • JonB

    he is getting an error during import.

    This was previously discussed on the forum, and in that case it was a failed import, fixed by a force quit of pythonista

    https://forum.omz-software.com/topic/1372/import-numpy-fails/3

    posted in Pythonista read more
  • JonB

    Out of curiosity, have you tried writing this as numpy arrays? You can transform all of the points at the same time, should be a lot faster...

    posted in Pythonista read more
  • JonB

    A common approach is to use BytesIO:

    import io
    
    with io.BytesIO() as output:
        img.save(output)
        contents = output.getvalue()
    

    You might need to then pass contents through base64.b64encode

    posted in Pythonista read more
  • JonB

    Did you try to a numpy update ? That causes problems since you cannot update numpy.

    The other problem people have is that since numpy can take a while to load, if you can cancel a script, it might be only partially imported. Try force quitting the app and try again.

    If that doesn't work, push the Print Traceback button, and paste the full Traceback to the forum.

    posted in Pythonista read more
  • JonB

    Guys, this is what insert_rows is for! Don't use reload_table!

    posted in Pythonista read more
  • JonB

    This is a very well known problem:

    pandas does not work in pythonista. You cannot install it.

    You may have also tried to install numpy, which is already installed and cannot be reinstalled. Go to your site-packages-3 and site-packages folder and delete any numpy folders you see.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!