-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Describe what you are looking for
There is a transform in Albumentations, called ChannelShuffle, it takes numpy array and shuffles channels.
Could be done in cv2:
def channel_shuffle(img: np.ndarray, channels_shuffled: np.ndarray) -> np.ndarray:
from_to = []
for i, j in enumerate(channels_shuffled):
from_to.extend([i, j])
cv2.mixChannels([img], [img], from_to)
return imgin numpy
def channel_shuffle(img: np.ndarray, channels_shuffled: np.ndarray) -> np.ndarray:
return img[..., channels_shuffled]The request it have similar operation in simsimd that can:
- runs inplace (cv2 version runs inplace)
- can work with any shape, say
(height, width, num_channels)or(depth, height, width, num, channels), or(num_volumes, depth, height, width, num_channels))(numpy allows this, cv2 does not, but it could be achieved with reshape) - The most important: Run faster, as right now, benchmark shows that
torchvisionperforms this operation on tensors faster than OpenCV on numpy arrays.
Can you contribute to the implementation?
- I can contribute
Is your feature request specific to a certain interface?
Python bindings
Contact Details
No response
Is there an existing issue for this?
- I have searched the existing issues
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request