Changeset 362
- Timestamp:
- 12/29/07 13:21:57 (10 months ago)
- Files:
-
- trunk/FastImage/motmot.FastImage.egg-info/stdeb.cfg (modified) (1 diff)
- trunk/FastImage/motmot/FastImage/__init__.py (added)
- trunk/FastImage/setup.py (modified) (2 diffs)
- trunk/flytrax/motmot.flytrax.egg-info/stdeb.cfg (modified) (1 diff)
- trunk/flytrax/motmot/flytrax/flytrax.py (modified) (2 diffs)
- trunk/flytrax/motmot/flytrax/traxio.py (modified) (7 diffs)
- trunk/flytrax/setup.py (modified) (1 diff)
- trunk/fview/motmot/fview/plugin_manager.py (modified) (2 diffs)
- trunk/realtime_image_analysis/motmot (added)
- trunk/realtime_image_analysis/motmot.realtime_image_analysis.egg-info (moved) (moved from trunk/realtime_image_analysis/realtime_image_analysis.egg-info)
- trunk/realtime_image_analysis/motmot.realtime_image_analysis.egg-info/stdeb.cfg (modified) (1 diff)
- trunk/realtime_image_analysis/motmot/__init__.py (copied) (copied from trunk/imops/motmot/__init__.py)
- trunk/realtime_image_analysis/motmot/realtime_image_analysis (moved) (moved from trunk/realtime_image_analysis/realtime_image_analysis)
- trunk/realtime_image_analysis/motmot/realtime_image_analysis/__init__.py (modified) (1 diff)
- trunk/realtime_image_analysis/setup.py (modified) (4 diffs)
- trunk/realtime_image_analysis/src/_realtime_image_analysis.c (deleted)
- trunk/realtime_image_analysis/src/motmot.FastImage.FastImage.pxd (moved) (moved from trunk/realtime_image_analysis/src/FastImage.pxd)
- trunk/realtime_image_analysis/src/realtime_image_analysis.c (added)
- trunk/realtime_image_analysis/src/realtime_image_analysis.pyx (moved) (moved from trunk/realtime_image_analysis/src/_realtime_image_analysis.pyx) (36 diffs)
- trunk/trackem/motmot.trackem.egg-info/stdeb.cfg (modified) (1 diff)
- trunk/trackem/motmot/trackem/trackem.py (modified) (1 diff)
- trunk/trackem/setup.py (modified) (1 diff)
- trunk/wxvideo/motmot.wxvideo.egg-info (added)
- trunk/wxvideo/motmot.wxvideo.egg-info/stdeb.cfg (moved) (moved from trunk/wxvideo/wxvideo.egg-info/stdeb.cfg) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/FastImage/motmot.FastImage.egg-info/stdeb.cfg
r186 r362 1 [FastImage] 2 Package: python-fastimage 3 Build-Depends: python-pyrex, libipp-dev, python-motmotutils 1 [DEFAULT] 2 Depends: libipp, python-numpy 3 Build-Depends: python-pyrex, libipp-dev 4 Build-Conflicts: python-fastimage trunk/FastImage/setup.py
r361 r362 1 import glob, os 2 from setuptools import setup, find_packages 3 from distutils.extension import Extension 1 import os, sys 2 from setuptools import setup, find_packages, Extension 4 3 5 import FastImage_util 6 vals = FastImage_util.get_build_info() 4 # I need to import a module I'm about to install. How naughty is this? 5 sys.path.insert(0, os.path.abspath(os.path.join('motmot','FastImage'))) 6 import util as FastImage_util 7 8 vals = FastImage_util.get_build_info(ipp_static=False) 7 9 8 10 ipp_sources = vals.get('ipp_sources',[]) … … 22 24 license="BSD", 23 25 version='0.5.2', 24 namespace_package =['motmot'],26 namespace_packages=['motmot'], 25 27 packages = find_packages(), 26 28 ext_modules=[Extension(name="motmot.FastImage.FastImage", trunk/flytrax/motmot.flytrax.egg-info/stdeb.cfg
r331 r362 1 1 [DEFAULT] 2 Package: python-motmot-flytrax3 2 Depends: python-motmot-fview, python-motmot-realtimeimageanalysis, python-motmot-wxvideo, python-motmot-wxvalidatedtext, python-scipy trunk/flytrax/motmot/flytrax/flytrax.py
r294 r362 23 23 24 24 import sys, threading, Queue, time, socket, math, struct, os 25 import pkg_resources 25 26 import traxio 26 27 … … 32 33 import motmot.wxvideo.wxvideo as wxvideo 33 34 import motmot.imops.imops as imops 34 import FastImage 35 36 import realtime_image_analysis 37 38 import pkg_resources 35 import motmot.FastImage.FastImage as FastImage 36 37 import motmot.realtime_image_analysis.realtime_image_analysis as realtime_image_analysis 38 39 39 import numpy 40 40 41 import wxvalidatedtext as wxvt41 import motmot.wxvalidatedtext.wxvalidatedtext as wxvt 42 42 43 43 import wx trunk/flytrax/motmot/flytrax/traxio.py
r294 r362 1 import FlyMovieFormat1 import motmot.FlyMovieFormat.FlyMovieFormat as FlyMovieFormat 2 2 import numpy as nx 3 3 from numpy import nan … … 18 18 version 2 does save area 19 19 """ 20 20 21 21 data_fname = fname_prefix+'.trx' 22 22 self.data_fd = open(data_fname,'wb') 23 23 bgimage = nx.asarray(bgimage) 24 24 25 25 assert len(bgimage.shape)==2 26 26 assert bgimage.dtype==nx.dtype(nx.uint8) … … 28 28 assert version in VALID_VERSIONS 29 29 self.version = version 30 30 31 31 self.data_fd.write( struct.pack(header_fmt, 32 32 self.version, … … 37 37 fmf_fname = fname_prefix + '.fmf' 38 38 self.fmf = FlyMovieFormat.FlyMovieSaver( fmf_fname) 39 39 40 40 def close(self): 41 41 self.fmf.close() … … 113 113 f1.data_fd.truncate() 114 114 f1.close() 115 115 116 116 im,rows=readtrax(fname+'.trx') 117 117 finally: 118 118 shutil.rmtree(dirname) 119 119 120 120 assert nx.allclose(im,a) 121 121 assert nx.allclose(r1,rows[0]) … … 130 130 print 'all_vals[0]',all_vals[0] 131 131 print 'all_vals[-1]',all_vals[-1] 132 132 133 133 fmf = FlyMovieFormat.FlyMovie(fmf_fname,check_integrity=True) 134 134 print 'fmf.get_n_frames()',fmf.get_n_frames() … … 146 146 def test_fmt2(self): 147 147 test_version(2) 148 148 149 149 def test_fmt1_incomplete(self): 150 150 test_version(1,incomplete=True) trunk/flytrax/setup.py
r294 r362 9 9 url='http://code.astraw.com/projects/motmot', 10 10 entry_points = { 11 ' cam_iface.fview_plugins':'flytrax = motmot.flytrax.flytrax:Tracker',11 'motmot.fview.plugins':'flytrax = motmot.flytrax.flytrax:Tracker', 12 12 'console_scripts': [ 13 13 'flytrax_print_info = motmot.flytrax.traxio:print_info_main', trunk/fview/motmot/fview/plugin_manager.py
r177 r362 11 11 modules = [] 12 12 13 for name in egg.get_entry_map(' cam_iface.fview_plugins'):13 for name in egg.get_entry_map('motmot.fview.plugins'): 14 14 egg.activate() 15 entry_point = egg.get_entry_info(' cam_iface.fview_plugins', name)15 entry_point = egg.get_entry_info('motmot.fview.plugins', name) 16 16 if entry_point.module_name not in loaded_components: 17 17 try: … … 22 22 else: 23 23 import warnings 24 warnings.warn('could not load plugin %s: %s'%(str(entry_point),str(x)))24 warnings.warn('could not load plugin (set env var FVIEW_RAISE_ERRORS to raise error) %s: %s'%(str(entry_point),str(x))) 25 25 continue 26 26 PluginClasses.append( PluginClass ) trunk/realtime_image_analysis/motmot.realtime_image_analysis.egg-info/stdeb.cfg
r208 r362 1 [realtime_image_analysis] 2 Source: python-realtimeimageanalysis 3 Package: python-realtimeimageanalysis 4 Build-Depends: python-fastimage, libipp-dev, python-motmotutils, python-pyrex, python-numpy 5 Depends: python-fastimage, python-numpy 1 [DEFAULT] 2 Build-Depends: python-motmot-fastimage, libipp-dev, python-pyrex, python-numpy, python-setuptools 3 Depends: python-motmot-fastimage, python-numpy trunk/realtime_image_analysis/motmot/realtime_image_analysis/__init__.py
r93 r362 1 from _realtime_image_analysis import *trunk/realtime_image_analysis/setup.py
r209 r362 1 1 import os 2 from setuptools import setup, Extension 2 from setuptools import setup, Extension, find_packages 3 import pkg_resources # make sure FastImage is importable 3 4 4 install_requires = ['FastImage'] 5 6 import FastImage 5 import motmot.FastImage.FastImage as FastImage 7 6 major,minor,build = FastImage.get_IPP_version() 8 import FastImage_util7 import motmot.FastImage.util as FastImage_util 9 8 10 9 # build with same IPP as FastImage … … 26 25 if 1: 27 26 # Pyrex build of realtime_image_analysis 28 realtime_image_analysis_extension_name='_realtime_image_analysis' 29 realtime_image_analysis_sources=['src/_realtime_image_analysis.pyx', 27 realtime_image_analysis_sources=['src/realtime_image_analysis.pyx', 30 28 'src/c_fit_params.c', 31 29 'src/eigen.c', 32 30 'src/c_time_time.c', 33 31 ]+ipp_sources 34 ext_modules.append(Extension(name= realtime_image_analysis_extension_name,32 ext_modules.append(Extension(name='motmot.realtime_image_analysis.realtime_image_analysis', 35 33 sources=realtime_image_analysis_sources, 36 34 include_dirs=ipp_include_dirs, … … 41 39 extra_compile_args=ipp_extra_compile_args, 42 40 )) 43 44 if os.name.startswith('posix'):45 install_requires.append('posix_sched')46 41 47 setup(name=' realtime_image_analysis',42 setup(name='motmot.realtime_image_analysis', 48 43 description="several image analysis functions that require Intel IPP and FastImage", 49 44 long_description= … … 57 52 url='http://code.astraw.com/projects/motmot', 58 53 license='BSD', 59 packages = ['realtime_image_analysis'],54 packages = find_packages(), 60 55 ext_modules= ext_modules, 61 install_requires = install_requires,62 56 zip_safe = True, 63 57 ) trunk/realtime_image_analysis/src/realtime_image_analysis.pyx
r119 r362 18 18 import numpy.dual 19 19 20 cimport FastImage 21 import FastImage 20 #cimport FastImage 21 cimport motmot.FastImage.FastImage as FastImage 22 import motmot.FastImage.FastImage as FastImage 22 23 23 24 cdef double nan … … 33 34 cdef extern from "unistd.h": 34 35 ctypedef long intptr_t 35 36 36 37 cdef extern from "c_fit_params.h": 37 38 ctypedef enum CFitParamsReturnType: … … 58 59 cdef extern from "c_time_time.h": 59 60 double time_time() 60 61 61 62 cdef void CHK_HAVEGIL( ipp.IppStatus errval ) except *: 62 63 if (errval != ipp.ippStsNoErr): … … 98 99 L = nx.dot(A,nx.transpose(B)) - nx.dot(B,nx.transpose(A)) 99 100 return Lmatrix2Lcoords(L) 100 101 101 102 cdef class RealtimeAnalyzer: 102 103 … … 110 111 111 112 cdef double _scale_factor 112 113 113 114 # runtime parameters 114 115 cdef ipp.Ipp8u _diff_threshold 115 116 cdef float _clear_threshold 116 117 117 118 # calibration matrix 118 119 cdef object _pmat, _pmat_inv, camera_center # numpy ndarrays … … 122 123 123 124 cdef ipp.Ipp8u _despeckle_threshold 124 125 125 126 cdef FastImage.Size _roi_sz 126 127 127 128 cdef int n_rot_samples 128 129 … … 133 134 # input image size. The roi is a view of the active part. The roi2 134 135 # is a view of the sub-region of the active part. 135 136 136 137 cdef FastImage.FastImage8u absdiff_im, cmpdiff_im # also raw_im 137 138 … … 174 175 self._diff_threshold = 11 175 176 self._clear_threshold = 0.2 176 177 177 178 self._pmat = None 178 179 self._pmat_inv = None 179 180 self._set_pmat = False 180 181 181 182 self.camera_center = None 182 183 self.camera_center_meters = None 183 184 184 185 self._pmat_meters_inv = None 185 186 … … 198 199 self.mask_im=FastImage.FastImage8u(sz) 199 200 self.mask_im.set_val(0,sz) 200 201 201 202 self.mean_im=FastImage.FastImage8u(sz) 202 203 self.cmp_im=FastImage.FastImage8u(sz) 203 204 self.cmpdiff_im=FastImage.FastImage8u(sz) 204 205 205 206 # create and update self.imname2im dict 206 207 self.imname2im = {'absdiff' :self.absdiff_im, … … 212 213 213 214 self.roi = lbrt 214 215 215 216 # initialize background images 216 217 self.mean_im_roi_view.set_val( 0, self._roi_sz ) … … 218 219 def set_reconstruct_helper( self, helper ): 219 220 self._helper = helper 220 221 221 222 def get_pmat(self): 222 223 return self._pmat 223 224 224 225 def set_pmat(self,value): 225 226 self._pmat = nx.asarray(value) … … 277 278 inputs 278 279 ------ 279 280 280 281 timestamp 281 282 framenumber … … 289 290 outputs 290 291 ------- 291 292 292 293 [ (x0_abs, y0_abs, area, slope, eccentricity, p1, p2, p3, p4) ] 293 294 294 295 """ 295 296 cdef double x0, y0 … … 302 303 cdef double evalA, evalB 303 304 cdef double evecA1, evecB1 304 305 305 306 cdef double Mu00, Uu11, Uu02, Uu20 306 307 cdef int i 307 308 cdef int result, eigen_err 308 309 309 310 cdef int index_x,index_y 310 311 311 312 cdef ipp.Ipp8u max_val 312 313 cdef ipp.Ipp8u* max_val_ptr 313 314 cdef ipp.Ipp8u max_std_diff 314 315 315 316 cdef ipp.Ipp8u clear_despeckle_thresh 316 317 317 318 cdef FastImage.Size roi2_sz 318 319 cdef int left2, right2, bottom2, top2 319 320 320 321 cdef int found_point 321 322 cdef int n_found_points … … 330 331 331 332 roi2_sz = FastImage.Size(21,21) 332 333 333 334 all_points_found = [] # len(all_points_found) == n_found_points 334 335 n_found_points = 0 … … 351 352 <ipp.Ipp8u*>self.absdiff_im_roi_view.im,self.absdiff_im_roi_view.step, 352 353 self._roi_sz.sz)) 353 354 354 355 # mask unused part of absdiff_im to 0 355 356 #self.absdiff_im.fast_set_val_masked( 0, … … 359 360 CHK_NOGIL( ipp.ippiSet_8u_C1MR( 0, <ipp.Ipp8u*>self.absdiff_im.im, self.absdiff_im.step, self.absdiff_im.imsiz.sz, 360 361 <ipp.Ipp8u*>self.mask_im.im, self.mask_im.step)) 361 362 362 363 if use_cmp: 363 364 # clip the minimum comparison value to diff_threshold … … 520 521 if not (n_found_points+1==self.max_num_points): # only modify the image if more follow... 521 522 self.absdiff_im_roi2_view.set_val(0, roi2_sz ) 522 523 523 524 if return_first_xy: 524 525 #nominal: (x0_abs, y0_abs, area, slope, eccentricity, p1, p2, p3, p4, line_found, slope_found) 525 526 rval = [(index_x, index_y, max_std_diff, max_val, eccentricity, p1, p2, p3, p4, 0, found_point)] 526 527 return rval 527 528 528 529 if not found_point: 529 530 break … … 570 571 x0u = x0_abs # fake undistorted data 571 572 y0u = y0_abs 572 573 573 574 p1,p2,p3,p4 = -1, -1, -1, -1 # sentinel value (will be converted to nan) 574 575 line_found = False … … 585 586 if c_lib.isinf(eccentricity): 586 587 eccentricity = near_inf 587 588 588 589 if c_lib.isinf(slope): 589 590 slope = near_inf 590 591 591 592 all_points_found.append( 592 593 (x0_abs, y0_abs, area, slope, eccentricity, … … 603 604 im = self.imname2im[which] 604 605 return im 605 606 606 607 property roi2_radius: 607 608 def __get__(self): … … 609 610 def __set__(self,value): 610 611 self._roi2_radius = value 611 612 612 613 property clear_threshold: 613 614 def __get__(self): … … 615 616 def __set__(self,value): 616 617 self._clear_threshold = value 617 618 618 619 property diff_threshold: 619 620 def __get__(self): … … 621 622 def __set__(self,value): 622 623 self._diff_threshold = value 623 624 624 625 property scale_factor: 625 626 def __get__(self): … … 628 629 print 'setting scale_factor to',value 629 630 self._scale_factor = value 630 631 631 632 property roi: 632 633 def __get__(self): … … 634 635 def __set__(self,object lbrt): 635 636 cdef int l,b,r,t 636 637 637 638 l,b,r,t = lbrt 638 639 if (l==self._left and b==self._bottom and … … 640 641 # nothing to do 641 642 return 642 643 643 644 self._left = l 644 645 self._bottom = b … … 656 657 657 658 self._roi_sz = FastImage.Size( self._right-self._left+1, self._top-self._bottom+1 ) 658 659 659 660 self.absdiff_im_roi_view = self.absdiff_im.roi(self._left,self._bottom,self._roi_sz) 660 661 self.mean_im_roi_view = self.mean_im.roi(self._left,self._bottom,self._roi_sz) … … 694 695 running_mean8u_im.get_compare_put( 200, noisy_pixels_mask, max_frame_size, FastImage.CmpGreater) 695 696 compareframe8u.set_val_masked(25, noisy_pixels_mask, max_frame_size) 696 697 697 698 698 699 def bg_help( FastImage.FastImage32f running_mean_im, 699 700 FastImage.FastImage32f fastframef32_tmp, … … 715 716 <ipp.Ipp32f*>running_mean_im.im, running_mean_im.step, 716 717 max_frame_size.sz, ALPHA)) 717 718 718 719 # maintain 8bit unsigned background image 719 720 #running_mean_im.fast_get_8u_copy_put( running_mean8u_im, max_frame_size ) # done … … 722 723 <ipp.Ipp8u*>running_mean8u_im.im,running_mean8u_im.step, 723 724 max_frame_size.sz, ipp.ippRndNear )) 724 725 725 726 # standard deviation calculation 726 727 #hw_roi_frame.fast_get_32f_copy_put(fastframef32_tmp,max_frame_size) # done … … 728 729 <ipp.Ipp32f*>fastframef32_tmp.im, fastframef32_tmp.step, 729 730 max_frame_size.sz )) 730 731 731 732 #fastframef32_tmp.fast_toself_square(max_frame_size) # current**2 # done 732 733 CHK_NOGIL( ipp.ippiSqr_32f_C1IR( <ipp.Ipp32f*>fastframef32_tmp.im, fastframef32_tmp.step, 733 734 max_frame_size.sz)) 734 735 735 736 #running_sumsqf.fast_toself_add_weighted_32f( fastframef32_tmp, max_frame_size, ALPHA) # done 736 737 CHK_NOGIL( ipp.ippiAddWeighted_32f_C1IR( <ipp.Ipp32f*>fastframef32_tmp.im, fastframef32_tmp.step, … … 746 747 <ipp.Ipp32f*>running_stdframe.im, running_stdframe.step, 747 748 max_frame_size.sz)) 748 749 749 750 # now create frame for comparison 750 751 #running_stdframe.fast_toself_multiply(C,max_frame_size) # done … … 756 757 <ipp.Ipp8u*>compareframe8u.im,compareframe8u.step, 757 758 max_frame_size.sz, ipp.ippRndNear )) 758 759 759 760 # now we do hack, erm, heuristic for bright points, which aren't gaussian. 760 761 #running_mean8u_im.fast_get_compare_int_put_greater( 200, noisy_pixels_mask, max_frame_size) … … 764 765 max_frame_size.sz, 765 766 ipp.ippCmpGreater)) 766 767 767 768 #compareframe8u.fast_set_val_masked(25, noisy_pixels_mask, max_frame_size) # done 768 769 CHK_NOGIL( ipp.ippiSet_8u_C1MR( 25, <ipp.Ipp8u*>compareframe8u.im, compareframe8u.step, max_frame_size.sz, … … 876 877 return res 877 878 878 879 trunk/trackem/motmot.trackem.egg-info/stdeb.cfg
r329 r362 1 1 [DEFAULT] 2 Package: python-motmot-trackem3 2 Depends: python-motmot-fview, python-motmot-fastimage, python-motmot-wxvalidatedtext, python-numpy, python-motmot-imops, python-motmot-flytrax trunk/trackem/motmot/trackem/trackem.py
r294 r362 5 5 import wx 6 6 from wx import xrc 7 import FastImage7 import motmot.FastImage.FastImage as FastImage 8 8 import numpy 9 import wxvalidatedtext as wxvt9 import motmot.wxvalidatedtext.wxvalidatedtext as wxvt 10 10 import os, sys, socket, signal, time, math, threading, Queue 11 11 import motmot.flytrax.flytrax as flytrax trunk/trackem/setup.py
r294 r362 5 5 version='0.4.1', 6 6 entry_points = { 7 ' cam_iface.fview_plugins':'trackem = motmot.trackem.trackem:TrackemClass',7 'motmot.fview.plugins':'trackem = motmot.trackem.trackem:TrackemClass', 8 8 }, 9 9 namespace_packages = ['motmot'], trunk/wxvideo/motmot.wxvideo.egg-info/stdeb.cfg
r177 r362 1 [wxvideo] 2 Package: python-wxvideo 3 Conflicts: python-ads-wxvideo 4 Replaces: python-ads-wxvideo 5 Depends: python-imops 6 Build-Depends: python-motmotutils 1 [DEFAULT] 2 # should probably depend on wxpython 3 Depends: python-motmot-imops
