Skip to content
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

BUG: Using the lk method with array videos #17

Closed
domengorjup opened this issue Apr 8, 2021 · 1 comment
Closed

BUG: Using the lk method with array videos #17

domengorjup opened this issue Apr 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@domengorjup
Copy link
Collaborator

domengorjup commented Apr 8, 2021

Although pyIDI supports inputting numpy.ndarray objects into the pyIDI constructor, instead of paths to .cih files (#13 ), setting the LucasKanade ('lk') method up with such objects currently won't work, because this method will automatically attempt to create temporary analysis files, looking at the .cih file path for their location.

This is the error log:

TypeError                                 Traceback (most recent call last)
<ipython-input-10-7ed824ef8d61> in <module>
----> 1 video.set_method('lk', roi_size=(31, 31))
      2 video.show_points()

c:\program files\python38\lib\site-packages\pyidi\pyidi.py in set_method(self, method, **kwargs)
     78         """
     79         if isinstance(method, str) and method in self.available_methods.keys():
---> 80             self.method = self.available_methods[method]['IDIMethod'](self, **kwargs)
     81         elif callable(method) and hasattr(method, 'calculate_displacements'):
     82             try:

c:\program files\python38\lib\site-packages\pyidi\methods\idi_method.py in __init__(self, video, *args, **kwargs)
     13         """
     14         self.video = video
---> 15         self.configure(*args, **kwargs)
     16 
     17 

c:\program files\python38\lib\site-packages\pyidi\methods\_lucas_kanade.py in configure(self, roi_size, pad, max_nfev, tol, int_order, verbose, show_pbar, processes, pbar_type, multi_type, resume_analysis, process_number, reference_image)
    107 
    108         self.start_time = 1
--> 109         self.temp_dir = os.path.join(os.path.split(self.video.cih_file)[0], 'temp_file')
    110         self.settings_filename = os.path.join(self.temp_dir, 'settings.pkl')
    111         self.analysis_run = 0

c:\program files\python38\lib\ntpath.py in split(p)
    183     Return tuple (head, tail) where tail is everything after the final slash.
    184     Either part may be empty."""
--> 185     p = os.fspath(p)
    186     seps = _get_bothseps(p)
    187     d, p = splitdrive(p)

TypeError: expected str, bytes or os.PathLike object, not numpy.ndarray

This could be solved either by omitting the automatic creation of analysis files if the cih_file argument of the pyIDI constructor is not a valid path, choosing another location (e.g. os.getcwd()) for these files.

@domengorjup domengorjup added the bug Something isn't working label Apr 8, 2021
@domengorjup
Copy link
Collaborator Author

solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant