Morton scanning ?

3 views (last 30 days)
vishnu
vishnu on 29 Feb 2012
hi ,
i have to implement the morton scanning .. the idea is
image is to be separated as block and it is to be applied with morton Z scanning . 1& 2& 3 pixel is to be added and 4 th pixel to be divided by above sum .. this repeats further.. i have completed separating as blocks .. but i do not have any idea of that processing . any one help or give suggestions please
  1 Comment
vishnu
vishnu on 1 Mar 2012
i found this function as for morton scanning ..but i don no how to use it for morton scanning .. criteria is i have an image ..divided by 4*4 blocks .. 1 ,2,3 pixels are added and fourth pixel is divided by above sum .. i don no how to use this function ..
function A = mapping(n)
% To create a Morton Scan order matrix
if n == 2
A = [1 2; 3 4];
else
B = mapping(n/2);
A = [B B+(n/2)^2; B+(n/2)^2*2 B+(n/2)^2*3];
end

Sign in to comment.

Answers (1)

vishnu
vishnu on 1 Mar 2012
i found out this as for 4*4 matrix from matlab central
clc;
clear all;
close all ;
n=2;
ind=morton(n);
a=reshape(1:4^n,2^n,2^n);
disp(a)
here is the matlab function
function ind=morton(n); % MORTON(N) return the morton permutation order for array of size 2^N % e.g. % n=2; % matrix size is 2^n % ind=morton(n); % d=fix(rand(2^n,2^n)*10); % disp(d) % disp(d(ind))
linind4=(1:4^n)-1; %start index count for array at zero
ind4str=dec2base(linind4,4); %convert indices to base-4
b1=dec2bin(str2num(ind4str(:,1))); %split each base-4 into two base-2numbers
b2=dec2bin(str2num(ind4str(:,2)));
rb=[b1(:,1) b2(:,1)]; %the rows are given by the first bits of b1 and
b2
cb=[b1(:,2) b2(:,2)]; %the columns are given by the second bits of b1 and b2
r=bin2dec(rb)+1; %convert the row from bit to decimal
c=bin2dec(cb)+1; %convert column
ind=[2^n*(c-1)+r]'; %make a linear row index into array for easyaddressing
%morton.m ends
----------------------------------------------------
i require to do this for whole image with out looping infinitly ..
can you please any one give the way by bolck processing
  1 Comment
vishnu
vishnu on 1 Mar 2012
how to do it for whole image for this 4*4 block coding ? can any one help please ..

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!