- resize the images to a particular size like (256, 512 etc)
- pad the images with zeros
How can I use Two-Dimensional True Compression on arbitrarly sized images?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sivert Bakken
am 19 Jun. 2020
Beantwortet: Divya Gaddipati
am 25 Jun. 2020
I want to use wcompress(...)
On images of varying size that is not a power of two.
What is the best way to do this?
0 Kommentare
Akzeptierte Antwort
Divya Gaddipati
am 25 Jun. 2020
Since wcompress works only on images of sizes with power of 2, you could either
You can use padding if you do not want any loss of information in the images, as resizing might change the original information in the images.
im = imread('path/to/image');
% Resize
new_im = imresize(im, [256, 256]);
% Padding
[m, n] = size(im,1:2);
% m,n should be less than 256, else use a number greater than 256
new_m = (256-m)/2;
new_n = (256-n)/2;
new_im = padarray(im, [new_m, new_n]);
For more information on imresize and padarray, you can refer to the following links:
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Filtering and Enhancement 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!