-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for python 3? #11
Comments
Hi! Thanks for your interest in this project! Unfortunately, I am not currently developing it, so I'm not planning to support Python 3 right now. Although I suspect that after using |
I have started to translate in Python3 thanks to 2to3 and Pylint but I am stucked by "import pcf" not found : |
As I have found that pcf.so is a compilation result of pcf.c file, I have change the make file with python3.8 . before after When I run make I get this message Then when I run imago, I get this error " module 'pcf' has no attribute 'edge' " Have you heard about discrepancies in calling C between python2.7 and python3 ? |
Hi, thanks for your interest in this project! I started the conversion from Python2 to Python3 some time ago, but haven't finished it. As for the I see that I have converted some Python files as well. I'm not sure what's left to fix. Unfortunately, I don't have time to test it right now. If you find out, plese let me know. |
Hi, I plan to use a subset of Imago (ie the command : python3.8 imago -S image.jpg), so my conversion will not be complete but relative. Today the compilation is OK but I am stuck between Python and C Langage : Python don't recognize Py_edge in the library. I am a retired engineer, I started in 1980 and I leaved the development job for management job in 1993. My knowledge in C Langage is completely vanished but I remember it's a powerful Langage and I liked it. I have created a PWA application in HTML, CSS and Javascript and it's OK on Android smartphone. As Imago requires Python2.7 and I am thinking a PWA is possible in Python, I try to converse Imago then I will converse my application in Python (or calling Python from Javascript ....). So thanks you for your answer I will try your new files and return to you. Keep in touch. PS: I visited Prague, it's a very nice city. |
Hi, UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9c in position 1054: invalid start byte Python transfers image raw data (tobytes), instead of pointer on this data... To suppress this error, I have encoding tobytes in ASCII before transferring like this : def edge_detection(image):
Of course pcf.c must be changed to take into account the modification of interface and to add encoding/decoding ASCII/raw data. So two solutions : modify pcf or converting pcf in Python. Questions : 1> to be able to have imago in a single langage ie Python, do you know if all mathematical functions (math.h) are available in Python ? 2> If I wanted to modify pcf.c, could you give me guidelines or advices for parsing the parameters and using of PyArg_ParseTuple ? |
Third solution to wrap imago in a virtual machine with python2.7 (or 3.6) with virtualenv. |
The reason why some of the functions were written in C is that I thought they would be quite slow in Python. I have not actually measured the exact difference in speed, but I'm not sure if just rewriting it all to Python would be a good idea. (I was actually thinking about going the other way and rewriting the RANSAC algorithm to C as well, because my Python implementation is quite slow, but that one is a bit more complex than for example the Hough transform.) You could try to write these functions with the help of some Python library that is better suited for array computations than pure Python, e.g. NumPy. Or you can try to find libraries that already implement these functions efficiently. I don't think that there was a library for Hough transform at the time that I wrote Imago, but I didn't look for it very hard, because I wanted to try to program it myself. I think I took a course in low level algorithm optimization in C that year, that might have also contributed to my decision :-D I haven't done any project where I would interface C and Python recently, so I don't know how to do that properly with the new Python. To be honest, even when I wrote the original version, I just copied something from the Python documentation and tweeked it until it worked. Since I only needed to interface these few funcions in the If I have some free time, I'd like to finish porting Imago to Python3, but I can't really promise if and when that would happen. |
Since python2 is end-of-life'd, are you going to support python 3?
The text was updated successfully, but these errors were encountered: