Logan Status Updates
- Was successfully able to fix opencv issue by changing the single line "import opencv" in "configure" to be "import cv".
- When trying to run mousetrap receiving error "ImportError: No module named mousetrap.app.main"
- As Amber had mentioned, must be in the src directory before running the "mousetrap" command. Thank you =]
- >> Fix: Are you in the src directory when you run the command 'mousetrap', for the moustrap.app.main error? (Amber)
- As Amber had mentioned, must be in the src directory before running the "mousetrap" command. Thank you =]
- ImportError: could not import gobject (error was: ImportError('When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".',))
- Changed all instances by running
grep -rl 'import gobject' ./ | xargs sed -i 's/import gobject/from gi.repository import GObject/g
- Then changed all instances of gobject to GObject with command
grep -rl 'gobject' ./ | xargs sed -i 's/gobject/GObject/g
- New Error:
/usr/lib64/python2.7/site-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed import gobject._gobject [foss2serve@foss2serve src]$ Traceback (most recent call last): File "<string>", line 1, in <module> File "mousetrap/app/main.py", line 91, in start idm = pocv.get_idm(self.cfg.get("main", "algorithm")) File "mousetrap/ocvfw/pocv.py", line 43, in get_idm ) File "mousetrap/ocvfw/idm/forehead.py", line 32, in <module> from mousetrap.ocvfw.dev.camera import Capture, Point File "mousetrap/ocvfw/dev/camera.py", line 34, in <module> from mousetrap.ocvfw import _ocv as ocv File "mousetrap/ocvfw/_ocv.py", line 282, in <module> class OcvfwPython(OcvfwBase): File "mousetrap/ocvfw/_ocv.py", line 298, in OcvfwPython ) ImportError: No module named highgui
- Changed "opencv.highgui" in mousetrap/ocvfw/backends/OcvfwPython.py to "cv"
- Another error:
/usr/lib64/python2.7/site-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed import gobject._gobject [foss2serve@foss2serve src]$ DEBUG: mousetrap.ocvfw.idm -> Starting Forehead idm INFO: mousetrap.ocvfw.idm -> Forhead Algorithm loaded DEBUG: mousetrap.ocvfw.idm -> Setting Capture DEBUG: Commons -> New Singleton Add (mousetrap.ocvfw.dev.camera.Camera) Traceback (most recent call last): File "<string>", line 1, in <module> File "mousetrap/app/main.py", line 93, in start self.idm.set_capture(self.cfg.getint("cam", "inputDevIndex")) File "mousetrap/ocvfw/idm/forehead.py", line 108, in set_capture self.cap = Capture(async=True, idx=cam, backend="OcvfwPython") File "mousetrap/ocvfw/dev/camera.py", line 71, in __init__ Camera.start_camera() File "mousetrap/ocvfw/_ocv.py", line 111, in start_camera self.capture = co.hg.cvCreateCameraCapture( int(self.idx) ) AttributeError: 'module' object has no attribute 'cvCreateCameraCapture'
- As Amber mentioned, 'cvCreateCameraCapture' no longer exhists. Replaced the line "self.capture = co.hg.cvCreateCameraCapture( int(self.idx) )" with self.capture = co.hg.CaptureFromCAM( int(self.idx) ) in mousetrap/ocvfw/backends/OcvfwBase.py and mousetrap/ocvfw/_ocv.py.
- Now receiving the same GObject error as Amber:
Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed import gobject._gobject [foss2serve@foss2serve src]$ DEBUG: mousetrap.ocvfw.idm -> Starting Forehead idm INFO: mousetrap.ocvfw.idm -> Forhead Algorithm loaded DEBUG: mousetrap.ocvfw.idm -> Setting Capture DEBUG: Commons -> New Singleton Add (mousetrap.ocvfw.dev.camera.Camera) VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument DEBUG: ocvfw -> cmStartCamera: Camera Started DEBUG: Camera -> Loaded backend OcvfwPython DEBUG: OcvfwBase -> Changed lk_swap value to True INFO: mousetrap - Idm loaded and started Traceback (most recent call last): File "<string>", line 1, in <module> File "mousetrap/app/main.py", line 101, in start self.itf = MainGui(self) File "mousetrap/app/ui/main.py", line 54, in __init__ self.script = self.ctr.script() File "mousetrap/app/main.py", line 229, in script return get_script_class(self.cfg.get("scripts", "name"))() File "mousetrap/app/ui/scripts/__init__.py", line 45, in get_script_class script = __import__(script_name, globals(), locals()) File "mousetrap/app/ui/scripts/joystick.py", line 36, in <module> from ..widgets import Mapper File "mousetrap/app/ui/widgets.py", line 237, in <module> GObject.type_register(Mapper) TypeError: argument must be a GObject subclass
- As Amber mentioned, widget.py must use gobject and not GObject.
- New error when running. Window pops up for a momment and then this error appears.
Mousetrap - MouseTrap's Interface Built and Loaded Traceback (most recent call last): File "mousetrap/ocvfw/dev/camera.py", line 116, in sync Camera.query_image() File "mousetrap/ocvfw/_ocv.py", line 125, in query_image frame = co.hg.cvQueryFrame( self.capture ) AttributeError: 'module' object has no attribute 'cvQueryFrame' Traceback (most recent call last): File "mousetrap/app/main.py", line 238, in update_frame self.itf.update_frame(self.idm.get_capture(), self.idm.get_pointer()) File "mousetrap/ocvfw/idm/forehead.py", line 128, in get_capture self.get_forehead() File "mousetrap/ocvfw/idm/forehead.py", line 148, in get_forehead face = self.cap.get_area(commons.haar_cds['Face']) File "mousetrap/ocvfw/dev/camera.py", line 373, in get_area return Camera.get_haar_points(haar_csd) File "mousetrap/ocvfw/_ocv.py", line 335, in get_haar_points cascade = co.cv.cvLoadHaarClassifierCascade( haarCascade, self.imgSize ) AttributeError: 'module' object has no attribute 'cvLoadHaarClassifierCascade' /usr/local/bin/mousetrap: line 139: 9390 Segmentation fault (core dumped) /usr/bin/python -c "import mousetrap.app.main as mousetrap; mousetrap.Controller().start();" "$ARGS"
- Changed "cvLoadHaarClassifierCascade" to "CascadeClassifier" on line 335 of _ocv.py
- Changed "cvQueryFrame" to "QueryFrame" on line 125 of _ocv.py
- Changed "cvResize" to "Resize" on line 341
- Removed cv.cvXXX in _ocv.py to cv.XXXX (Methods no longer start with cvXXX)
- Now have error of
Camera instance has no attribute 'small_img'
- It appears that the error is appearing becuase there is no image being captured from the webcam. I am working on trying to figure out why that is.
I updated to Fedora 18 the other day and my installation became corrupt. I have started a fresh install of Fedora 18 and am working on reinstalling mousetrap to try and pick up where I left off.
I have now downloaded and installed mousetrap. I have branched off or Amber's 'fix_install' branch and created my own.
I have switched over to looking into the CV code to try and get a better idea of the code changes and differences between CV and CV2, and working on getting a better idea on the functions that are available to python-opencv
Posted a link to a quick explanation on what the difference between CV and CV2 are. I also have been looking for documentation from OpenCV 2.4.3, but can't find any. OpenCV released OpenCV 2.4.4 on 2/15/13, and they do not keep a copy of previous documentation accessible on their website. I will be working in documentation of 2.4.4, and will try to determine what has changed. I am going through the OpenCV Tutorial in order to understand it all.
I tried out a fix someone on stackoverflow mentioned of just importing "import cv2.cv as cv" and have it work. I tried that, which worked for some things, but highgui was not included. I now am looking at going through the whole _ocv.py file and trying to update every method to use the correct new functions, not just for errors that are popping up, but everything if possible.
I kind of have mousetrap running on Fedora. The window is showing, and its capturting my picture, but in many colors. Working to figure out why the image is like it is.
By changing showPointMapper to False in the user config file, I was able to get the GUI running, and king of displaying a picture. There is no mouse function currently. The picture is only focusing on the top portion of the image, so it doens't capture the face. It also displays 3 copies of the image, virtically next to each other, each in a different color shade (red, blue, green).
After getting that far, I had an issue with my VM and had to rebuild. With my new installtion I am having issues with it constantly freezing, losing camera connection, and not being able to kill the program. I am working on trying to resolve these issues so that I can return to the location where I was before.
My next step is trying to determine why the capture is focusing on the upper location of the frame. If I can get the capture to work properly, I will move to trying to fix the mouse movements.
6/2 - 6/7
Still having issues with the VM. I have been able to work on some things, but the freezing is making it very difficult. I have been able to perform some runs, where I am having an error with GetSubRect having incorrect input array size. While trying to work on that, I ran into more VM issues, where the camera would not be freed after the program terminated. I am working on trying to get a dedicated machine setup to see if any of these issues can be alleviated.
6/8 - 6/14
I have installed Fedora and Mousetrap on a dedicated computer, and am receiving much better performance. I have the mousetrap window showing a portion of the camera issue (as mentioned a couple weeks ago), with the weird colors. Unlike before, the screen is continually running without any errors or freezes.
Currently, pressing any of the buttons creates a segfault. I also have to disable the Point Mapper, or else there the window never loads.
Running a backtrace after pressing one of the buttons indicates "Cannot access memory at address ...".
I am receiving an error about GetSubRect once in a while. Trying to determine if this is effecting the reason the screen looks how it does.
Incorrect size of input array () in cvGetSubRect File "/home/foss2serve/git/mousetrap/src/mousetrap/ocvfw/_ocv.py", line 400, in get_haar_roi_points imageROI = co.cv.GetSubRect(self.img, rect
6/16 - 6/22
I implemented the color fix that Stoney had into my branch, which fixed the issue. I have also added code to try and prevent the GetSubRect error for incorrect size. I added a check for the rect size, and if it will be too large, hardcode a smaller size in. Will work on detemerming a permenant fix. I have pushed these changes to the logan_test branch.
After talking with Joanie during the meeting, we talked about issues in my code with gtk, gdk, and gobject-introspection. Joanie sent me a patch which fixed the menu buttons for her, but I receive an error after implementing the patch. I have pushed this code to logan_gtk_fix, so that people could still work on the other branch that runs.
I fixed the issue I had with Joanie's patch, and now have the menu showing up.
It appears the issue with the camera is due to a bug. (https://bugzilla.gnome.org/show_bug.cgi?id=674691). The GtkPixbuf new_from_data method takes 7 arguments, but it wants 9 (The last 2 are memory management functions for C). I am working on finding a work around.
SUCCESS :) I applied a work around to the bug for pixbuf. Now the camera shows, and the menu's show. There is currently one error in the menu's that I am getting, but I will continue to work on that. Below is a screenshot of the camera working, as well as the menu being up.
6/23 - 6/30
Implemented Nikki's changes for window size and button size. Have determined that making changes in the preferences window does change the userSettings.cfg fill. Restarting Mousetrap will put the changes into effect.
7/1 - 7/7
I completed the python 2to3 conversion utility for converting python 2 code to python 3 code, but only doing what was compatable with 2.7. I have pushed that back to github. Took a long time to get it to work, since I was missing some required libraries. You need to install python-tools to get the 2to3 utility. I also modified the .gitignore to ignore all of the 2to3 backup files.
7/8 - 7/14
I have been working on trying to figure out why the mouse movement isn't working. I have tracked down that the point that is being calculated for the forehead is way outside of the size of the frame, which may be causing the issue. I am working on trying to figure out where the calculation is happening, and see if I can correct it.
8/4 - 8/10
I have the rectangle showing where the face tracking is, but it doesn't update. I have found that it maintains the coordinates from the first get_haar_points call. I have been trying different ways to get the rectangle to update to the new dimensions with each iteration, but it isn't working. Continuing to try and figure out what is going on with it, that way we can try and see the tracking in action.