Prev: Can Kalman Filtering be used in non-time applications? Updating Models
Next: Large linear system
From: David Cubero on 6 Jul 2010 06:47 > Is there something that prevents the header (synchro and space) from > appearing as picture data? For example is the picture encoded in such a > way that it is impossible for as much as 47 words of spaces to appear in > a row? I do not understand you very well, the syncho and space should not appear in the picture, i need to detect the synchro of one picture ( then i could guess all the synchro points) thanks
From: Walter Roberson on 6 Jul 2010 08:08 David Cubero wrote: > >> Is there something that prevents the header (synchro and space) from >> appearing as picture data? For example is the picture encoded in such >> a way that it is impossible for as much as 47 words of spaces to >> appear in a row? > > > I do not understand you very well, the syncho and space should not > appear in the picture, i need to detect the synchro of one picture ( > then i could guess all the synchro points) There is a difference between "should not appear" and "_cannot appear", but I just realized that for your purposes it does not matter as long as the synchro and space do not appear often. if D is the demodulated signal consisting of noisy copies of {Y followed by data of length DL}, then YC = Y(:); YL = length(YC); FL = length(YC) + DL; L = floor(length(D) / FL); A = mean( reshape(D(1:L),FL,[]), 2); fiterr = nan(FL,1); for K = 1 : FL TA = circshift(A, K); fiterr(K) = sum((YC - TA(1:YL)).^2); end [minerr, bestshift] = min(fiterr); and the pattern is then well aligned starting at D(bestshift) subject to the same noise provisos as I described before. Incidental copies of the header Y in the data (picture) will not matter, as they will be averaged out with the other picture data. Provided, of course, that there are sufficient frames.
From: David Cubero on 6 Jul 2010 08:35 D is the demodulated signal and it consists in several pictures with their several synchro points. I do not understand quite well your code so i try to comment it > YC = Y(:); ( I take my pattern its only one row and 7 square pulses) > YL = length(YC); (i calculate the length) > FL = length(YC) + DL; ( i calculate the total legth of one picture, data + header) > L = floor(length(D) / FL); ( I calculate how many pictures i have in my data) > A = mean( reshape(D(1:L),FL,[]), 2); (?????) > fiterr = nan(FL,1);(not a number matrix????) > for K = 1 : FL > TA = circshift(A, K); (you move circularly all the matrix in order to find > fiterr(K) = sum((YC - TA(1:YL)).^2); ( which value is the minimum) > end > [minerr, bestshift] = min(fiterr); > > and the pattern is then well aligned starting at D(bestshift)
From: Walter Roberson on 6 Jul 2010 10:39 David Cubero wrote: > D is the demodulated signal and it consists in several pictures with > their several synchro points. > I do not understand quite well your code so i try to comment it > >> YC = Y(:); ( I take my pattern its only one row and 7 square pulses) Yes, and Y(:) converts it to a column vector as later you will be comparing it to a column vector >> YL = length(YC); (i calculate the length) >> FL = length(YC) + DL; ( i calculate the total legth of one picture, >> data + header) >> L = floor(length(D) / FL); ( I calculate how many pictures i have in >> my data) Very close, but the number of usable pictures could be 1 less. L is the number of complete periods, which might not happen to be the same. I see now in review that the above line has an error: I meant L to be the "usable" data length, not the number of cycles, so the correct line should be L = FL * floor(length(D) / FL); or equivalently, L = length(D) - mod(length(D),FL); >> A = mean( reshape(D(1:L),FL,[]), 2); (?????) The D(1:L) takes as many complete cycles out of D as possible. The reshape moves each picture-length worth of data into a separate column. The mean then averages over all of the rows. The positions that are repeats of each other except for noise will statistically average out to very near the constant value for that position, whereas the positions that are variable (picture data) will statistically average out to about 1/2*(minvalue + maxvalue) [if there are enough different frames]. >> fiterr = nan(FL,1);(not a number matrix????) This is pre-allocating the fiterr array. You could use zeros(FL,1) instead, but using nan adds an extra level of cross-checking as you develop the algorithm. >> for K = 1 : FL >> TA = circshift(A, K); (you move circularly all the matrix in order to find >> fiterr(K) = sum((YC - TA(1:YL)).^2); ( which value is the minimum) >> end Correct. The averaging that is done by the mean() will reduce the noise a lot and so positions corresponding to the header will be very nearly equal to the ideal header values, but the start of that header could be anywhere within the first frame's-worth of data, so you cycle through the averaged data looking for a good match on the header; you can use a circular shift for the matching precisely because the header is periodic. >> [minerr, bestshift] = min(fiterr); >> >> and the pattern is then well aligned starting at D(bestshift)
From: David Cubero on 6 Jul 2010 11:29 First of all I want to thank you very much for helping so much with the code! I will test it tomorrow in the laboratoryand I will tell you. I hope it can compute properly the points where the synchro starts. Thank you
First
|
Prev
|
Pages: 1 2 3 4 Prev: Can Kalman Filtering be used in non-time applications? Updating Models Next: Large linear system |