Code covered by the BSD License
-
A =padtomakepowof2(A,varargin...
% if required then add padvalue (defualt 0)
-
I=qtreedecode(S,values)
% Decode QuadTree Represenation of Image given as Sparse matrix 'S' and
-
I=qtreergbdecode(S,valRGB)
% Decode QuadTree date that is decomposed (encode) by qt3ddecom method
-
S=trimsparse(S)
% trim sparse matrix by removing extra rows/columns that have all elements zeros.
-
[S,keys]=delsparsekeybyxANDy(...
-
[S,valRGB]=qt3ddecom(I,vararg...
% This method uses three thresholds for red,green and blue blocks.
-
[b1r,b1c,b2r,b2c,b3r,b3c,b4r,...
% The method uses three thresholds for red,green and blue blocks.
-
[b1r,b1c,b2r,b2c,b3r,b3c,b4r,...
% given the size of rectangle (matrix end points), it split into four
-
avg=avgofmatblks(mat,i,j,w,h)
% finds average of different blocks of input matrix
-
drawquadblocks(S)
% draw square quad blocks of quadtree in eight basic colors.
-
fillrect_ulwh(ul,w,h,varargin...
% fill the rectangle region specified by upper left corner width
-
flag=ispowerof2(n)
-
rgbimgnew =padrgbtomakepowof2...
% if required then add padvalue (defualt 0)
-
var=converttoclass(var,type)
-
main.m
-
View all files
from
Quadtree decomposition (Encoding) and Decoding of RGB Image
by Dr. Murtaza Khan
Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3.
|
| A =padtomakepowof2(A,varargin)
|
% % if required then add padvalue (defualt 0)
% % to make size of A power of 2.
% % e.g. if initiall size of A is 2x3
% % the after padding, size of A would be
% % 4x4
function A =padtomakepowof2(A,varargin)
% % % Default Values
padvalue=0;
defaultValues = {padvalue};
% % % Assign Values
nonemptyIdx = ~cellfun('isempty',varargin);
defaultValues(nonemptyIdx) = varargin(nonemptyIdx);
[padvalue] = deal(defaultValues{:});
% % ------------------------------------
B=A;
[M,N]=size(B);
type_A=class(A);
A=converttoclass(A,'double');
padvalue=converttoclass(padvalue,'double');
npo2=2^nextpow2(max(size(A)));
% % ------------------------------------
% % Padding process
A(1:npo2,1:npo2)=padvalue; % A expanded to required size
A(1:M,1:N)=B(1:M,1:N); % 1:M,1:N locations filled with origincal values
% % OR
% % alternatively A can be padded using image processing tool
% % box method 'padarray' by following statement
% % A=padarray(A,[npo2-M,npo2-N],padvalue,'post');
% % ------------------------------------
A=converttoclass(A,type_A); % back to original type
% % % --------------------------------
% % % Author: Dr. Murtaza Khan
% % % Email : drkhanmurtaza@gmail.com
% % % --------------------------------
|
|
Contact us at files@mathworks.com