I am trying to create a sequence of gray code pattern that relates with the frequency.
The above image shows for one row pixel the gray code patterns and a wrapped phase which was obtained from sinusoidal pattern. Here, the number of gray code patterns were obtained based on number of cycles. For frequency = 150, we need 150 pixels for each cycle and thus, we have totally 6 cycles. So the gray code pattern should follow the same atleast for the final sequence 3 as shown in figure below.
As you can see in my case, my pixel range for G3 is around 250 and i need it for 150. How to change do this?
f = 100; no_cycles_1 = floor(px/f1);
gray_level = ceil(sqrt(no_cycles_freq));
n = ceil(log2(1024));
pattern = zeros(2^n,1) ; pattern(2) = 1; T = 2;
for k = 2:n
T2 = T+T;
pattern(T+1:T2) = T + flipud(pattern(1:T));
T = T2;
end
mat = transpose(flip(transpose(de2bi(pattern))));
gray_pattern = zeros(py,px,gray_level);
figure,
for i = 1:gray_level
patternSeq = transpose(repmat(mat(:, i), 1, 1024));
gray_pattern(:,:,i) = patternSeq;
subplot(gray_level+1,1,i); plot(gray_pattern(512,:,i));
title(['G', num2str(i)]);
end
question from:
https://stackoverflow.com/questions/65842543/how-to-create-a-gray-code-pattern-that-relates-to-frequency 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…