Skip to content

gaussian_filter of long videos error #17

Description

@gabriel-ing

There appears to be an error with openCV gaussian_filter causing an error with my filtering. With one video with >900 frames, the gaussian_filter errored with:


AxisError Traceback (most recent call last)
Cell In[6], line 2
1 cc=vid.clip_contrast()
----> 2 cc = cc.gaussian_filter(3)
3 cc = cc.make_scalebar()
4 cc = cc.convert_to_8bit()

File ~/opt/anaconda3/envs/Test/lib/python3.10/site-packages/SimpliPyTEM/MicroVideo_class.py:1222, in MicroVideo.gaussian_filter(self, kernal)
1220 #print(kernal)
1221 swapped = cv.GaussianBlur(swapped, (kernal,kernal), 0)
-> 1222 swapped = np.swapaxes(swapped, 0, 2)
1224 filtered_object = deepcopy(self)
1225 filtered_object.frames = swapped

File <array_function internals>:200, in swapaxes(*args, **kwargs)

File ~/opt/anaconda3/envs/Test/lib/python3.10/site-packages/numpy/core/fromnumeric.py:594, in swapaxes(a, axis1, axis2)
550 @array_function_dispatch(_swapaxes_dispatcher)
551 def swapaxes(a, axis1, axis2):
552 """
553 Interchange two axes of an array.
554
(...)
592
593 """
--> 594 return _wrapfunc(a, 'swapaxes', axis1, axis2)

File ~/opt/anaconda3/envs/Test/lib/python3.10/site-packages/numpy/core/fromnumeric.py:57, in _wrapfunc(obj, method, *args, **kwds)
54 return _wrapit(obj, method, *args, **kwds)
56 try:
---> 57 return bound(*args, **kwds)
58 except TypeError:
59 # A TypeError occurs if the object does have such a method in its
60 # class, but its signature is not identical to that of NumPy's. This
(...)
64 # Call _wrapit from within the except clause to ensure a potential
65 # exception has a traceback chain.
66 return _wrapit(obj, method, *args, **kwds)

AxisError: axis2: axis 2 is out of bounds for array of dimension 2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions