# Calculate Minos correlation value programmatically?

**URL:** <https://forum.commonvisionblox.com/t/calculate-minos-correlation-value-programmatically/82>\
**Category:** Tools\
**Tags:** minos\
**Created:** [May 16, 2017, 9:05am UTC](https://forum.commonvisionblox.com/t/calculate-minos-correlation-value-programmatically/82 "2017-05-16T09:05:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ConB](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/conb/32/60_2.png) [@ConB](https://forum.commonvisionblox.com/u/ConB)\
**Post date:** [May 16, 2017, 9:05am UTC](https://forum.commonvisionblox.com/t/calculate-minos-correlation-value-programmatically/82/1 "2017-05-16T09:05:30Z")

</div>

I’m still experimenting with Minos. If I hover with the mouse over instances of a Minos training set in the Teach Bench, I can see the correlation value for that instance. From what I understand, this is also calculated when adding new instances to a training set and goes along with the Correlation Threshold in the Training Parameters.

How can I calculate this correlation value for an instance programmatically?

---

<div class="post-metadata">

**Author:** ![Frank](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/frank/32/42_2.png) [@Frank](https://forum.commonvisionblox.com/u/Frank)\
**Post date:** [May 16, 2017, 1:39pm UTC](https://forum.commonvisionblox.com/t/calculate-minos-correlation-value-programmatically/82/2 "2017-05-16T13:39:50Z")

</div>

The Correlation in conjunction with Minos is the result of a correlation of the instance image with the model image of a given Minos training set (MTS).  
To get the instance, use _MTSModelInstance()_ and then _GetImageFromInstance()_ to get the image of the instance. To get the image of the model first use _MTSModel()_ and then _GetImageFromModel()_ to get the model image. Last use the _OptCorrelation()_ with both the instance image (as parameter _IMG_) and the model image (as parameter _TPL_) to calculate the correlation.

---

<div class="post-metadata">

**Author:** ![ConB](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/conb/32/60_2.png) [@ConB](https://forum.commonvisionblox.com/u/ConB)\
**Post date:** [May 17, 2017, 12:11pm UTC](https://forum.commonvisionblox.com/t/calculate-minos-correlation-value-programmatically/82/3 "2017-05-17T12:11:59Z")

</div>

Ah yes, I’ve stumbled across the OptCorrelation() earlier, but I was was not sure what the data type TPL was referring to. Thanks!

Can I use this method to correlate arbitrary images (other than from an MTS)? Are there certain requirements for the images to be met to calculate a correlation?

---

<div class="post-metadata">

**Author:** ![Frank](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/frank/32/42_2.png) [@Frank](https://forum.commonvisionblox.com/u/Frank)\
**Post date:** [May 18, 2017, 3:03pm UTC](https://forum.commonvisionblox.com/t/calculate-minos-correlation-value-programmatically/82/4 "2017-05-18T15:03:37Z")

</div>

There are other means to correlate images (and locate correlation matches) in CVB, but you will need to have a Foundation license for these. For a detailed description check out the **Correlations Functions** section of the _Foundation.dll_ in the CVB Manual.

---

<div class="post-metadata">

**Author:** ![illusive](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/illusive/32/61_2.png) [@illusive](https://forum.commonvisionblox.com/u/illusive)\
**Post date:** [May 19, 2017, 11:26am UTC](https://forum.commonvisionblox.com/t/calculate-minos-correlation-value-programmatically/82/5 "2017-05-19T11:26:59Z")

</div>

`TPL` is a bit of a relic and I honestly don’t know why the signature wasn’t simply using `IMG` in the first place. I guess there must have been a reason for this, but this seems to be lost in the mist of time…

I’ll change `TPL` to `IMG` for the next release. For now it’ll need to suffice to say that `TPL` is just another (and by now superfluous) way of saying `IMG`…
