13 views

Uploaded by Nor Alhuda

- How to Make Standalone Executable File From Matlab Program
- About MATLAB and Simulink
- Ibm
- Matlab Manual
- electrical computer application lesson 5
- 12695_Introduction to Matlab
- EMT Simulation Integrating With Other Toos
- M208 Handbook
- Demo
- matlab
- Exploring Molecular Dynamics With Forces From N-body Potential Using Mathlab
- Communication Satellite Payload Redundancy Reconfiguration.pdf
- Introduction to Matlab
- F - Physically Based Modeling, Principles and Practice - Constrained Dynamics
- ASE 301 - HW1
- Big O Notations
- smq
- Matlab Day 3
- CFTool Tutorial
- Assignment 1

You are on page 1of 5

qtdecomp divides a square image into four equal-sized square blocks, and then tests each block

to see if it meets some criterion of homogeneity. If a block meets the criterion, it is not divided any further. If it does not meet the criterion, it is subdivided again into four blocks, and the test criterion is applied to those blocks. This process is repeated iteratively until each block meets the criterion. The result can have blocks of several different sizes.

S = qtdecomp(I) performs a quadtree decomposition on the intensity image I and returns the quadtree structure in the sparse matrix S. If S(k,m) is nonzero, then (k,m) is the upper left corner of a block in the decomposition, and the size of the block is given by S(k,m). By default, qtdecomp splits a block unless all elements in the block are equal. S = qtdecomp(I, threshold) splits a block if the maximum value of the block elements minus the minimum value of the block elements is greater than threshold. threshold is specified as a value between 0 and 1, even if I is of class uint8 or uint16. If I is uint8, the threshold value you supply is multiplied by 255 to determine the actual threshold to use; if I is uint16, the threshold value you supply is multiplied by 65535. S = qtdecomp(I, threshold, mindim) will not produce blocks smaller than mindim, even if

the resulting blocks do not meet the threshold condition.

S = qtdecomp(I, threshold, [mindim maxdim]) will not produce blocks smaller than mindim or larger than maxdim. Blocks larger than maxdim are split even if they meet the threshold condition. maxdim/mindim must be a power of 2. S = qtdecomp(I, fun) uses the function fun to determine whether to split a block. qtdecomp calls fun with all the current blocks of size m-by-m stacked into an m-by-m-by-k array, where k is the number of m-by-m blocks. fun returns a logical k-element vector, whose values are 1 if the corresponding block should be split, and 0 otherwise. (For example, if k(3) is 0, the third m-bym block should not be split.) fun must be a function_handle. Parameterizing Functions, in the

MATLAB Mathematics documentation, explains how to provide additional parameters to the function fun.

Class Support

For the syntaxes that do not include a function, the input image can be of class logical, uint8, uint16, int16, single, or double. For the syntaxes that include a function, the input image can be of any class supported by the function. The output matrix is always of class sparse.

Tips

qtdecomp is appropriate primarily for square images whose dimensions are a power of 2, such

as 128-by-128 or 512-by-512. These images can be divided until the blocks are as small as 1by-1. If you use qtdecomp with an image whose dimensions are not a power of 2, at some point the blocks cannot be divided further. For example, if an image is 96-by-96, it can be divided into blocks of size 48-by-48, then 24-by-24, 12-by-12, 6-by-6, and finally 3-by-3. No further division beyond 3-by-3 is possible. To process this image, you must set mindim to 3 (or to 3 times a power of 2); if you are using the syntax that includes a function, the function must return 0 at the point when the block cannot be divided further.

Examples

I = uint8([1 1 1 1 2 3 6 6;... 1 1 2 1 4 5 6 8;... 1 1 1 1 7 7 7 7;... 1 1 1 1 6 6 5 5;... 20 22 20 22 1 2 3 4;... 20 22 22 20 5 4 7 8;... 20 22 20 20 9 12 40 12;... 20 22 20 20 13 14 15 16]);

S = qtdecomp(I,.05); disp(full(S));

View the block representation of quadtree decomposition.

I = imread('liftingbody.png'); S = qtdecomp(I,.27); blocks = repmat(uint8(0),size(S)); for dim = [512 256 128 64 32 16 8 4 2 1]; numblocks = length(find(S==dim)); if (numblocks > 0) values = repmat(uint8(1),[dim dim numblocks]); values(2:dim,2:dim,:) = 0; blocks = qtsetblk(blocks,S,dim,values); end end blocks(end,1:end) = 1; blocks(1:end,end) = 1; imshow(I), figure, imshow(blocks,[])

The following figure shows the original image and a representation of the quadtree decomposition of the image.

See Also

function_handle | qtgetblk | qtsetblk

How To

Anonymous Functions Parameterizing Functions Was this topic helpful?

Recommended Products

MATLAB Signal Processing Toolbox Optimization Toolbox Statistics Toolbox Control System Toolbox

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

1984-2011- The MathWorks, Inc. Policy - Site Help - Patents Preventing Piracy - RSS Trademarks Privacy

function [ind,bx,by,Nb,lx,ly] = quadtree(x,y,s,n0) % QUADTREE Recursive division of a 2-dimensional set. % [IND,BX,BY,NB,LX,LY] = QUADTREE(X,Y,S,N0) % Performs recursive tree-like division of a set % of points with coordinates X,Y. % S is binary mask showing which points of a set % are to be counted. N0 is maximum permissible % number of "counted" points in the elementary % block. % Returns vector IND of the same size as X, Y % showing which region each point of a set belongs % to; binary matrices BX, BY where each row shows % "binary address" of each region. % Also returns "Adjacency matrix" NB which is 1 if % i and j regions are neighbours and 0 otherwise; % and matrices of limits for each region, LX and LY % so that PLOT(LX(:,[1 2 2 1 1])',LY(:,[1 1 2 2 1])') % plots the boundaries of all regions. % % % Copyright (c) 1995 by Kirill K. Pankratov kirill@plume.mit.edu 01/30/95

% Default for maximal block size n0_dflt = 10; % Handle input .............................. if nargin < 2 error(' Not enough input arguments.') end if nargin<4, n0 = n0_dflt; end if nargin<3, s = []; end if isempty(s), s = ones(size(x)); end % If no need to divide ...................... if length(x(find(s))) <= n0 bx = []; by = []; Nb = []; lx = []; ly = []; ind = ones(size(x)); return end % Calculate limits ................ lim = [min(x) max(x) min(y) max(y)]; % Recursively construct quadtree ............ [ind,bx,by] = qtree0(x,y,s,lim,n0); bx = bx(:,1:size(bx,2)-1); by = by(:,1:size(by,2)-1); % Compose "adjacency matrix" ................ szb = size(bx); ob = ones(1,szb(1)); pow = 2.^(0:szb(2)-1); pow = flipud(pow');

% "Lower" and "upper" bounds for trees bxmax = ceil(bx)*pow; bxmin = floor(bx)*pow; bymax = ceil(by)*pow; bymin = floor(by)*pow; % lx ly lx ly "Physical" limits of each regions = [bxmin bxmax+1]; = [bymin bymax+1]; = lim(1)+lx*(lim(2)-lim(1))/pow(1)/2; = lim(3)+ly*(lim(4)-lim(3))/pow(1)/2;

B0 = bxmin(:,ob); B1 = bxmax(:,ob); Nb = (B0'-B1<=1) & (B1'-B0>=-1); B0 = bymin(:,ob); B1 = bymax(:,ob); Nb = Nb & (B0'-B1<=1) & (B1'-B0>=-1);

- How to Make Standalone Executable File From Matlab ProgramUploaded byJans Hendry
- About MATLAB and SimulinkUploaded bysundreem
- IbmUploaded byPavithra Badrinaaraayanan
- Matlab ManualUploaded byParul Thapar
- electrical computer application lesson 5Uploaded byWang Sol
- 12695_Introduction to MatlabUploaded bySunita Sapkota
- EMT Simulation Integrating With Other ToosUploaded byjdebnath
- M208 HandbookUploaded byAwf Awf
- DemoUploaded byHe Stoppable
- matlabUploaded bySafnas Kariapper
- Exploring Molecular Dynamics With Forces From N-body Potential Using MathlabUploaded byrafika
- Communication Satellite Payload Redundancy Reconfiguration.pdfUploaded bykirancalls
- Introduction to MatlabUploaded byAyoub Moustaouli
- F - Physically Based Modeling, Principles and Practice - Constrained DynamicsUploaded byFelipe Soares Maia
- ASE 301 - HW1Uploaded byisaac tsai
- Big O NotationsUploaded byravigobi
- smqUploaded byKhairul Amirul
- Matlab Day 3Uploaded byVicky Jaiswal
- CFTool TutorialUploaded byvignesh
- Assignment 1Uploaded byViralBipinchandraRathod
- CS 100-Computional Problem Solving- Murtaza TajUploaded byman420
- 03_basicConcepts.pdfUploaded byDiana Pacheco
- GUIINIT.MUploaded bybjmcculloch
- 1 1 the MATLAB Environment and User InterfaceUploaded byRochelle Doringo
- 229Uploaded byBhautik donga
- 2010-3-urbas-in.pdfUploaded bymaxamaxa
- ALGORITHM 652 HOMPACK_ a Suite of Codes for Globally Convergent Homotopy AlgorithmsUploaded byDong Wang
- Formula RioUploaded byJavier Cano
- Deteksi Plat Mobil dengan MatlabUploaded byDananjaya A
- Am i Hud Mendelson 80Uploaded byLawrence Ngari

- N A C P finalUploaded byrahul__dahekar@yahoo.co.in
- CSP2151 Assignment 162Uploaded byDuy Tran
- ELEMENTARY LINEAR ALGEBRA.pdfUploaded byGeologi
- Neural Nets and Deep LearningUploaded byManu Carbonell
- Math of PhotogrammetryUploaded byKen Lim
- Fir and i i r Filters Worksheet AnswersUploaded byNoedjoem Kaboer Aer
- Load and Resistance Factor Design By Theodore V. GalambosUploaded byrobersasmita
- Directly Proportional and Inversely ProportionalUploaded byJosé Antonio Luque Lama
- FLUENTTutorial03 WindUploaded byPaolo Mocellin
- Circuitglobe.com What-Is-eddy-current-loss (What Does f Stand for)Uploaded byjayzaa00tpg
- Lecture 11Uploaded byJunaid Alvi
- The Effects of Grinding Aids on Modelling of Air Classification of CementUploaded byAnonymous NxpnI6jC
- Jane L Toler v. Shirley S. Chater, Commissioner of Social Security, 54 F.3d 774, 4th Cir. (1995)Uploaded byScribd Government Docs
- Analysis of Channel Estimation Methods ForUploaded bybaburao_kodavati
- Study of Uniform Flow FormulaeUploaded byAyon Sengupta
- The New Simple Extended Corresponding-states Principle Vapor Pressure and Second Virial CoefficientUploaded byMario Ricardo Urdaneta Parra
- Formulae Sheets for Physics 2017 1Uploaded bymounam maiti
- ROOT LOCUS.pptxUploaded bySudhir Kumar
- Displacement-Based Seismic Analysis for Out-Of-plane Bending of Unreinforced Masonry WallsUploaded byNiko Lazopoulos
- [Elsevier] Rolling Contact Fatigue Analysis of Rails Inculding Numerical Simulations of the Rail Manufacturing Process and Repeated Wheel-rail Contact LoadsUploaded byMarcelino Pereira Do Nascimento
- untitleddocumentUploaded byapi-335278606
- Universal Scalable Matrix MultiplicationUploaded bySoumitry J Ray
- Comparitive analysis of smart antenna array, basis of beamforming schemes and algorithems : A ReviewUploaded byijcsis
- Logic-9.10-12Uploaded byJezen Esther Pati
- Emmy Noether - Wikipedia, The Free EncyclopediaUploaded byjoe smoe
- M_NUT_160206_PAPER ALLENUploaded byPartha Bhattacharjee
- ListeningUploaded byLesly C. Uribe
- Modeling of Activated Sludge With ASM1 Model, Case Study on Wastewater Treatment Plant of South of IsfahanUploaded byAnish Ghimire
- Verification Manual - StabLab.pdfUploaded byStefania Villacidro
- CorrosionUploaded byleronius