Hello there! I know this topic is a bit old but have you managed to do something about face detection in web2py? I'm currently trying to do the same so it will be nice if you have some advices to share.
Cheers, On Monday, September 22, 2008 4:32:29 AM UTC+7, Jailson Brito Jr. wrote: > > It worked... thanks... I`m trying to make an OpenCV face detect code to > work together with web2py... > > Sooner or later I`be here reporting my success or not.. :) > > On Sun, Sep 21, 2008 at 5:25 PM, mdipierro <[email protected]<javascript:> > > wrote: > >> >> #2 yes >> >> python web2py.py >> >> (assuming you have python 2.5) >> >> On Sep 21, 3:22 pm, "Jailson Brito Jr." <[email protected]> wrote: >> > Hi, >> > I tried both. >> > >> > #1 using double slashs to path on applications >> > >> > Traceback (most recent call last): >> > File "gluon\restricted.pyc", line 62, in restricted >> > File "G:\web2py\applications\teteia/controllers/default.py", line >> > 11, in <module> >> > File "G:\web2py\applications\teteia\modules\opencv\__init__.py", >> > line 55, in <module> >> > MemoryError >> > >> > #2 using the path on site-packages but running from server >> > >> > Traceback (most recent call last): >> > File "gluon\restricted.pyc", line 62, in restricted >> > File "G:\web2py\applications\teteia/controllers/default.py", line 9, >> > in <module> >> > ImportError: No module named opencv.cv >> > >> > when you say, running from source... it means I should run the web2py.py >> > instead of the web2py.exe ? >> > >> > >> > >> > On Sun, Sep 21, 2008 at 5:11 PM, mdipierro <[email protected]> >> wrote: >> > >> > > Try: >> > >> > > #session.forget() # comment or remove if you want to store sessions >> > > import >> > > sys.path='G:\\web2py\\applications\\teteia\\modules\\' >> > > if not path in sys.path: sys.path.append(path) >> > > import applications.teteia.modules.opencv.cv as cv >> > > def index(): >> > > response.flash=T('Welcome to web2py') >> > > return dict(message=T('Hello World')) >> > >> > > and, if you are running from source, try simply >> > >> > > import opencv.cv as cv >> > > def index(): >> > > response.flash=T('Welcome to web2py') >> > > return dict(message=T('Hello World')) >> > >> > > Paths under windows are always a mess. >> > >> > > Massimo >> > >> > > On Sep 21, 2:46 pm, "Jailson Brito Jr." <[email protected]> wrote: >> > > > Good to hear that! :) >> > > > I tried the solution 1, and I got the error: >> > >> > > > Traceback (most recent call last): >> > > > File "gluon\restricted.pyc", line 61, in restricted >> > > > File "G:\web2py\applications\teteia/controllers/default.py", line >> 4 >> > > > path='G:\web2py\applications\teteia\modules\' >> > > > ^ >> > > > SyntaxError: EOL while scanning single-quoted string >> > >> > > > I tried double-quoted string too, but got the exact same error. >> > >> > > > I'm in the beginning of my project, so I just changed the >> default.py from >> > > > the Hello World to >> > >> > > > #session.forget() # comment or remove if you want to store sessions >> > > import >> > > > sys path='G:\web2py\applications\teteia\modules\' if not path in >> > > sys.path: >> > > > sys.path.append(path) import applications.teteia.modules.opencv.cvas cv >> > > def >> > > > index(): response.flash=T('Welcome to web2py') return >> > > dict(message=T('Hello >> > > > World')) >> > >> > > > OpenCV is correctly installed in site-packages also, as you >> proposed in >> > > your >> > > > second solution, but maybe I tried to import it in a wrong way >> also. But >> > > I >> > > > prefer to put everything inside the applications path, if possible. >> > >> > > > On Sun, Sep 21, 2008 at 4:32 PM, mdipierro <[email protected] >> > >> > > wrote: >> > >> > > > > The fact is, this not a web2py error. this is a opencv error. If >> this >> > > > > is thread related you are going to face the same problem with any >> > > > > framework out there. But I think this is not the case. >> > >> > > > > Anyway, I am reading your original post again and some blogs. >> opencv >> > > > > appears to be thread safe. I think your problem is just path >> related. >> > >> > > > > If this is the case there are two possible solutions: >> > >> > > > > 1) In you app, before importing opencv, add opencv to the path: >> > >> > > > > import sys >> > > > > path='G:\web2py\applications\teteia\modules\' >> > > > > if not path in sys.path: sys.path.append(path) >> > >> > > > > 2) install opencv where it is intended to be in site-packages, not >> > > > > under your app, and run web2py from source. >> > >> > > > > I am sure this is an easy one to fix. If you want, send me the >> app and >> > > > > I will be happy yo take a look at it. >> > >> > > > > Massimo >> > >> > > > > > I`m trying to develop a web interface for OpenCV... I made a >> sketch >> > > of >> > > > > how I >> > > > > > want it, see the pictures below: >> > > > > >> http://jailson.googlepages.com/indigestus.pnghttp://jailson.googlepag. >> > > .. >> > > > > <http://jailson.googlepages.com/indigestus.png> >> > >> > > > > > Sorry for non english texts. >> > >> > > > > > For the graphical interface I think that ExtJS could do the >> trick. >> > > And >> > > > > to >> > > > > > handle with OpenCV functions I thought Web2Py could work... >> > >> > > > > > But I am starting to think that maybe I was wrong! >> > >> > > > > > On Sun, Sep 21, 2008 at 3:24 PM, mdipierro < >> [email protected]> >> > > > > wrote: >> > >> > > > > > > I do not know opencv and I need to look into this but here >> are some >> > > > > > > general comments. >> > >> > > > > > > In web2py (and many web frameworks) each request is served by >> a >> > > > > > > different thread. This if done for speed. The different >> threads >> > > share >> > > > > > > the same memory space and the same environment variables. By >> > > default, >> > > > > > > you cannot execute in a thread any function or module that >> attempts >> > > to >> > > > > > > change environment variables or gain exclusive access to >> memory or >> > > > > > > other OS resource without mutex locking. >> > >> > > > > > > For example you cannot do os.chdir('somedir') else all threads >> > > would >> > > > > > > change folder and web2py would behave weird. >> > >> > > > > > > There are ways many around this. Run processes, not thread; >> perform >> > > a >> > > > > > > mutex lock; create a background process that access >> exclusively the >> > > > > > > thread-unsafe module. >> > >> > > > > > > If this is the problem with opencv I do not know. It would >> help me >> > > to >> > > > > > > know what you are trying to do with it. >> > >> > > > > > > Massimo >> > >> > > > > > > On Sep 21, 10:04 am, [email protected] wrote: >> > > > > > > > i dont know exactly but there are ways to handle threads by >> hooks >> > > to >> > > > > > > > be thread safe , it will need to modify OpenCV or web2py to >> make >> > > it >> > > > > > > > work. >> > >> > > > > > > > massimo will be able to answer about it. >> > >> > > > > > > > On 9/21/08, Jailson Brito Jr. <[email protected]> wrote: >> > >> > > > > > > > > You say by default... so, you mean that is there an >> alternative >> > > way >> > > > > to >> > > > > > > make >> > > > > > > > > it work together? >> > >> > > > > > > > > On Sun, Sep 21, 2008 at 9:09 AM, < >> [email protected]> >> > > wrote: >> > >> > > > > > > > >> Ie , Cannot run in parallel within web2py by default. >> > >> > > > > > > > >> On 9/21/08, Jailson Brito Jr. <[email protected]> wrote: >> > > > > > > > >> > Hi , >> > > > > > > > >> > Yep, OpenCV is a Computer Vision Library... >> > > > > > > > >> >http://sourceforge.net/projects/opencvlibrary/ >> > >> > > > > > > > >> > What do you mean by thread safe? >> > >> > > > > > > > >> > I don`t know If I can send files in this group... but >> the >> > > file >> > > > > > > > >> __init__.py >> > > > > > > > >> > has quite nothing, see the code below: >> > >> > > > > > > > >> > # always import functionality from cxcore and cv to >> this >> > > > > namespace >> > >> > > > > > > > >> > from cv import * >> > >> > > > > > > > >> >> # try to import PIL and Numeric adaptors >> > >> > > > > > > > >> > # ignore import errors if one of both is not present >> > >> > > > > > > > >> > try: >> > >> > > > > > > > >> > from adaptors import * >> > >> > > > > > > > >> > except ImportError: >> > >> > > > > > > > >> > pass >> > >> > > > > > > > >> > Thanks in advance, >> > >> > > > > > > > >> > On Sun, Sep 21, 2008 at 12:04 AM, mdipierro < >> > > > > > > [email protected]> >> > > > > > > > >> wrote: >> > >> > > > > > > > >> >> As far as I know opencv is a computer vision library. >> It >> > > may >> > > > > not be >> > > > > > > > >> >> thread safe. >> > > > > > > > >> >> If you send me this file I will try take a look >> > >> > > > > > > > >> >> >> G:\web2py\applications\teteia\modules\opencv\__init__.py >> > >> > > > > > > > >> >> Massimo >> > >> > > > > > > > >> >> On Sep 20, 9:36 pm, soumn <[email protected]> wrote: >> > > > > > > > >> >> > Hi, >> > >> > > > > > > > >> >> > I`ve tried to use web2py with OpenCV, but i get the >> error >> > > > > below: >> > >> > > > > > > > >> >> > Error traceback >> > >> > > > > > > > >> >> > Traceback (most recent call last): >> > > > > > > > >> >> > File "gluon\restricted.pyc", line 62, in >> restricted >> > > > > > > > >> >> > File >> > > > > "G:\web2py\applications\teteia/controllers/default.py", >> > > > > > > line >> > > > > > > > >> >> > 3, >> > > > > > > > >> >> > in <module> >> > > > > > > > >> >> > File >> > > > > > > "G:\web2py\applications\teteia\modules\opencv\__init__.py", >> > > > > > > > >> >> > line 55, in <module> >> > > > > > > > >> >> > MemoryError >> > >> > > > > > > > >> >> > In file: >> > > G:\web2py\applications\teteia/controllers/default.py >> > > > > > > > >> >> > #session.forget() # comment or remove if you want to >> > > store >> > > > > > > sessions >> > >> > > > > > > > >> >> > import applications.teteia.modules.opencv.cv as cv >> > >> > > > > > > > >> >> > def index(): >> > >> > > > > > > > >> >> > response.flash=T('Welcome to web2py') >> > > > > > > > >> >> > return dict(message=T('Hello World')) >> > >> > > > > > > > >> >> > response._vars=index() >> > >> > > > > > > > >> >> > Any ideas? >> > >> > > > > > > > >> > -- >> > > > > > > > >> > Jailson Brito Jr. >> > >> > > > > > > > > -- >> > > > > > > > > Jailson Brito Jr. >> > >> > > > > > -- >> > > > > > Jailson Brito Jr. >> > >> > > > -- >> > > > Jailson Brito Jr. >> > >> > -- >> > Jailson Brito Jr. >> >> > > > -- > Jailson Brito Jr. > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

