hityzy1122 / opencv_transforms_torchvision

opencv reimplement for transforms in torchvision
MIT License
193 stars 29 forks source link

How to implement for a video frame ? #16

Open kartik1395 opened 3 years ago

kartik1395 commented 3 years ago

Hi, once I set the transform, how can it be applied to a video frame ?

    transform = cvtransforms.Compose([

     cvtransforms.TenCrop((224)),

     cvtransforms.Resize(size=(-1, 256)])

What is the next step to apply it to the frame ?

hityzy1122 commented 3 years ago

Hi, once I set the transform, how can it be applied to a video frame ?

    transform = cvtransforms.Compose([

     cvtransforms.TenCrop((224)),

     cvtransforms.Resize(size=(-1, 256)])

What is the next step to apply it to the frame ?

You can firstly load a single video frame with cv2 as a numpy array with the shape (H,W, 3) ,and then apply the transform to the array as the examples of official tutorials(https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html).