c++ - Understanding the OpenCV fitEllipse approach -


i trying figure out documented approach opencv fitellipse usage.

it can found here: http://docs.opencv.org/ref/master/de/dc7/fitellipse_8cpp-example.html

the problem applies threshold onto image, based on slider position, line relating slider value, original image is:

mat bimage = image >= sliderpos;

yet >= there makes no sense me, , using imshow on bimage/image shows them equal.

can please explain happening there? i'm sorry if obvious. i'm not great c++ programmer (yet).

as described in documentation binarization (0 or 255):

comparison: cmpop b, cmpop alpha, alpha cmpop a, cmpop 1 of >, >=, ==, !=, <=, <. result of comparison 8-bit single channel mask elements set 255 (if particular element or pair of elements satisfy condition) or 0.


try explain more technical part of functions called. following example gave first should know types of variables:

  • image , bimage cv::mat
  • sliderpos of type int.

the function operator >= can found in mat.hpp indirectly included other includes. function looking is:

matexpr cv::operator>= (const mat &a, double s) 

in matop.cpp calls:

matop_cmp::makeexpr(e, cv_cmp_ge, a, b); 

which calls (line 1408):

res = matexpr(&g_matop_cmp, cmpop, a, b, mat(), 1, 1); 

this internally applies generic operator on given parameters (matrices , b here). result (thus of part image >= sliderpos) of type matexpr. following function of mat bimage called:

mat& cv::mat::operator= (const matexpr & expr)   

which sets mat bimage resulting matexpr object's value.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -