MATLAB: How to use Two-Dimensional True Compression on arbitrarly sized images Image Processing Toolboxtrue compressionWavelet Toolboxwavlet I want to use wcompress(…) https://se.mathworks.com/help/wavelet/examples/two-dimensional-true-compression.html On images of varying size that is not a power of two. What is the best way to do this? Best Answer Since wcompress works only on images of sizes with power of 2, you could eitherresize the images to a particular size like (256, 512 etc)pad the images with zerosYou 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');% Resizenew_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 256new_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:https://www.mathworks.com/help/images/ref/imresize.htmlhttps://www.mathworks.com/help/images/ref/padarray.html Related SolutionsMATLAB: How can increase a binary image in size by padding See padarray(): https://www.mathworks.com/help/images/ref/padarray.html For exampleim = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/475268/img.png');pad_size = 20;im_new = padarray(im, [pad_size pad_size]);imshow(im_new) MATLAB: What should i do to make both images of same size im = imread('kssk.jpg');newIm = rgb2gray(imresize(im, [256, 256])); Related QuestionConcatenation of images in one MatrixVectorization of for loopResize image without change aspect ratio of that imageOne size image for CNN
Best Answer