Matrix padding with zeros
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello. I have a problem with my program. I make encryption by image. I based on 16-bit blocks. When I load picture (e.g. 16x16 / 128x128 / 256x256) and make my transformation on this everythink is ok. The problem occurs when the image has different dimensions (e.g. 50x50). In this case I have a size matrix: 50x50x3 (rgb). I have to extend each sub matrix to 64 (modulo 16, rounding up to a full multiple of 16) by add '255' so that finally the combination of three '255' gives white. Any ideas?
0 Kommentare
Antworten (1)
Geoff Hayes
am 29 Apr. 2020
Darek - perhaps create the 64x64x3 matrix with all elements set to 255 and then replace a subset of that matrix with the 50x50x3.
myImage = uint8(randi(255,50,50,3));
myPaddedImage = uint8(255*ones(64,64,3));
myPaddedImage(1:50,1:50,:) = myImage;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!