User Tools

Site Tools


visual3d:documentation:pipeline:signal_commands:cross_correlation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
visual3d:documentation:pipeline:signal_commands:cross_correlation [2024/07/12 14:06] – created sgrangervisual3d:documentation:pipeline:signal_commands:cross_correlation [2024/11/15 19:00] (current) – [RESULT] wikisysop
Line 1: Line 1:
-====== Cross_Correlation ======+====== Cross Correlation ======
  
-\\+The Cross_Correlation command can be used to determine if there is a relationship between two signals when one is shifted relative to the other. This command can also be used to calculate the self-similarity of a signal with a time-delayed version of itself. In this case the command calculates the signal's autocorrelation.
  
- +More about calculating cross-correlations can be found on [[https://en.wikipedia.org/wiki/Cross-correlation|Wikipedia]] and on [[http://paulbourke.net/miscellaneous/correlate/|Paul Bourke's website]].
-The Cross_Correlation command can be used to determine if there is a relationship between two signals when one is shifted relative to the other. +
- +
-More about calculating cross correlations can be found [[http://en.wikipedia.org/wiki/Cross-correlation|here]] and [[http://paulbourke.net/miscellaneous/correlate/|here]].+
  
 ===== Cross_Correlation ===== ===== Cross_Correlation =====
  
-The **Cross_Correlation** command may be used to calculate the cross correlation between two signals.+The **Cross_Correlation** command calculates the cross-correlation between two signals.
  
-**Cross_Correlation**+<code> 
 +Cross_Correlation
 ! /SIGNAL_OWNER1= ! /SIGNAL_OWNER1=
 /SIGNAL_TYPE1= /SIGNAL_TYPE1=
Line 28: Line 26:
 ! /MAX_DELAY=10 ! /MAX_DELAY=10
 ! /DATA_WRAP=FALSE ! /DATA_WRAP=FALSE
-**;** +; 
-{{Cross_Correlation_Dialog.png}}+</code> 
 + 
 +{{:Cross_Correlation_Dialog.png}}
  
 ===== Parameters ===== ===== Parameters =====
  
-==== MAX_DELAY ====+Understand the parameters of the Cross_Correlation command.
  
-The **MAX_DELAY** indicates the number of frames the signal will be shifted to determine the correlation.+==== SIGNAL1 ====
  
-The number of frames in the resulting signal = 2*MAX_DELAY +1+The /SIGNAL_OWNER1, /SIGNAL_TYPE1, /SIGNAL_FOLDER1, and /SIGNAL_NAME1 parameters allow the user to specify which signal (by [[visual3d:documentation:pipeline:file_commands:file_names|file]], [[visual3d:documentation:visual3d_signal_types:data_tree|data type]], [[visual3d:documentation:visual3d_signal_types:data_tree|folder]], and name) should be used as the first signal for the cross-correlation calculation.
  
-MAX_DELAY may also be considered as the "Window" of Frames to be compared across the signal.+==== SIGNAL2 ====
  
-A delay of 10 will result in 21 values (-10 to 10). A result at -10 will indicate that Signal ONE was shifted -10 frames relative to Signal TWO. A result at 10 will indicate that Signal ONE was shifted +10 frames relative to Signal TWO.+Similarly, the /SIGNAL_OWNER2, /SIGNAL_TYPE2, /SIGNAL_FOLDER2, and /SIGNAL_NAME2 parameters allow the user to specify the second signal for the cross-correlation calculation.
  
-A MAX_DELAY that is small will likely be inadequate to display the correlation of two signals. Selecting MAX_DELAY to have have the length of the two signals will cover all possible correlations.+==== RESULT ====
  
-To further review the shift between the two signalsan example script and power point can be downloaded [[https://www.has-motion.com/download/examples/Cross_Correlation/2015_05_06.zip|here]].+The /RESULT_OWNER, /RESULT_FOLDER, and /RESULT_NAME parameters allow the user to specify where the result of the cross-correlation calculation should be saved. 
 +  * The result's data type the DERIVED folder. 
 +  * The result's folder defaults to being the PROCESSED folder.
  
-==== DATA_WRAP ====+==== MAX_DELAY ====
  
-Data Wrapping indicates that the siganl is consider to loop.+The /MAX_DELAY parameter indicates the number of frames the signal will be shifted to determine the correlation. This parameter can be considered as the "window" of frames to be compared across the signal.
  
-With no Data Wrap and a MAX_DELAY of half the length of the signalthe first and last frames of the resulting signal will only be comparing half the signal.+The size of the resulting signal is determined as twice the value of the /MAX_DELAY plus one, e.g., a delay of 10 will result in 21 values (-10 to 10). A result at -10 will indicate that Signal ONE was shifted -10 frames relative to Signal TWO. A result at 10 will indicate that Signal ONE was shifted +10 frames relative to Signal TWO.
  
-With Data Wrap, all frames of the resulting signal will be correlation resulting from comparing all frames of the two signals.+Setting the /MAX_DELAY parameter to a value that is too small will likely be inadequate to capture the correlation of two signals. Setting the /MAX_DELAY parameter to be the length of the two signals will cover all possible correlations. To further review the shift between the two signals, an example script and power point can be downloaded [[https://www.has-motion.com/download/examples/Cross_Correlation/2015_05_06.zip|here]]. 
 + 
 +==== DATA_WRAP ====
  
-\\+The /DATA_WRAP parameter is a binary flag indicating whether the signal should be considered to loop.
  
 +With no Data Wrap and a MAX_DELAY of half the length of the signal, the first and last frames of the resulting signal will only be comparing half the signal. With Data Wrap, all frames of the resulting signal will be a correlation resulting from comparing all frames of the two signals.
  
-===== Example: Using the Cross Correlation Result =====+===== Example: Find the Frame Offset with Highest Correlation =====
  
-If you want just the frame offset with the highest correlation, you could use the sample script below:+If you want just the frame offset with the highest correlation, you could use the sample script below to calculate the cross-correlation between the two signals, sort these cross-correlation values, and extract the shift responsible for the largest cross-correlation.
  
 <code> <code>
visual3d/documentation/pipeline/signal_commands/cross_correlation.1720793211.txt.gz · Last modified: 2024/07/12 14:06 by sgranger