07-17-2018 09:10 AM
Hi,
Yes, When I am dividing the sum from intensity. That portion i am confused about. should I have to use total intensity or area under the curve?
Thanks
07-17-2018 09:54 AM - edited 07-17-2018 09:57 AM
As I said, first, you need to fix the race conditions (=get rid of ALL local variables! *). Where does the "intensity matrix" control get it's data and how does its data differ from the values in the "input array"?
What are the formulas?
* A "literal" rewrite of your code without race condition could e.g look as follows, but first you should verify the math. For example the centroid coordinates first need to be obtained in a similar fashion. For simplicity, I left out the scaling operations applied to the sum. later. (The code in the picture is definitely NOT right, but just illustrates how the code should be written in general. Think dataflow! For example, in your code, the local variable on top will get read way before the bottom code has a chance to update the indicator and this will get values from the previous run. Same for all other locals. You'll get an unpredictable mix of current and stale values.).
Compare with your garbage code for that same part (simplfied by removing the pointless sequence structures and local variables and skipping the scaling operations):
07-18-2018 12:34 PM
Hello,
Thanks. I am approaching form matrix side but good to have an idea from array side.
Just one last question if I want to find individual X and Y values for the below equation. Sigma_X^2 and sigma_Y^2.
Could you give me an idea from array side approach?
Thanks,
07-18-2018 01:42 PM
@sspp07 wrote:
Thanks. I am approaching form matrix side but good to have an idea from array side.
Sorry, I have no idea what that means. Where is the matrix data coming from and how does it relate to the values and size of the "input array" control? (In your example code, it's an empty matrix!)
@sspp07 wrote:
Just one last question if I want to find individual X and Y values for the below equation. Sigma_X^2 and sigma_Y^2.
X and Y are the independent variables, and thus inputs, not results. Nothing to "find". In your case, x and y are the 2D array indices. These integrals can all be replaced by sums. Seems trivial to implement given the code skeleton I gave you earlier.
07-23-2018 10:55 AM
I have to solve this formula. For individual X & Y Direction.
07-24-2018 07:40 AM
The formula is already solved. You just need to implement it. We already showed you all the tools.
07-24-2018 08:29 AM - edited 07-24-2018 08:44 AM
See if this is what you want. Axis units are in pixels, so scale as needed.
(note that for performance certain duplicate operations could be eliminated using extra loops. Not shown. The compiler might already do some of it anyway)