How to prevent conv2d from changing image size

13 vues (au cours des 30 derniers jours)
Nour Aburaed
Nour Aburaed le 22 Avr 2019
Commenté : Nour Aburaed le 22 Avr 2019
I have an image of size 330x363 uint8. I am convoluting it with 11x11 filter using conv2. The resulting image gets padded with zeros from top (6 pixels), bottom (4 pixels), left (6 pixels), right (4 pixels). Is there a way to prevent this padding from happening? Is it a good practice to crop the resulting image after the convolution?

Réponse acceptée

Walter Roberson
Walter Roberson le 22 Avr 2019
Modifié(e) : Walter Roberson le 22 Avr 2019
conv2(A, B, 'same') or conv2(A, B, 'valid')
  1 commentaire
Nour Aburaed
Nour Aburaed le 22 Avr 2019
I've already tried 'same' before but it did not work, as it also introduced zero padding of size 1. But 'valid' worked just fine! Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by