当前位置: 首页>>代码示例>>C++>>正文


C++ LED::getText方法代码示例

本文整理汇总了C++中LED::getText方法的典型用法代码示例。如果您正苦于以下问题:C++ LED::getText方法的具体用法?C++ LED::getText怎么用?C++ LED::getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LED的用法示例。


在下文中一共展示了LED::getText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: trackFilteredObject

/******************************************************************************
 * @author Julian Brackins
 *
 * @par Description:
 * After the images have been filtered properly, this function
 * handles determining if an image contains a blob that fits in the HSV range
 * of the colour being tracked.
 *
 * @param[in] light - an led light being tracked
 * @param[in] threshold - thresholded image matrix
 * @param[in] HSV - Matrix containing HSV values
 * @param[in] cameraFeed - Matrix containing camera feed
 * 
 * @returns Set of coordinates in the Coord class structure, giving you (x,y)
 *
 *****************************************************************************/
Coord trackFilteredObject(LED lights,Mat threshold,Mat HSV, Mat &cameraFeed)
{
  //Maybe change all this so that It doesn't refer to everything as lights...
  LED blob;

  Coord coordinates;

  Mat tempMatrix;
  threshold.copyTo(tempMatrix);

  //findContours params
  vector<vector<Point>> contours;
  vector<Vec4i> hierarchy;

  //find the contours of the image using openCV
  findContours( tempMatrix, contours, hierarchy,CV_RETR_CCOMP,CV_CHAIN_APPROX_SIMPLE );

  //use moments method to find our filtered object
  double refArea = 0;
  bool objectFound = false;

  //Zero out the coordinates
  coordinates.setX(0);
  coordinates.setY(0);

  if (hierarchy.size() > 0) 
  {
    int numObjects = hierarchy.size();
    //The filter becomes too noisy if the numObjects is too great...
    if(numObjects < MAX_OBJS)
    {
      for (int i = 0; i >= 0; i = hierarchy[i][0]) 
      {
        Moments moment = moments((cv::Mat)contours[i]);
        double area = moment.m00;

        //if the area is less than 20 px by 20px then it is probably just noise
        //if the area is the same as the 3/2 of the image size, probably just a bad filter
        //we only want the object with the largest area so we safe a reference area each
        //iteration and compare it to the area in the next iteration.
        if(area>MIN_OBJ_AREA)
        {
          blob.setX(moment.m10/area);
          blob.setY(moment.m01/area);
          blob.setColour(lights.getColour());
          blob.setText(lights.getText());

          //Push onto vector if allowing multiples of one colour
          //blobvec.push_back(blob);
          objectFound = true;
        }
        else 
          objectFound = false;
      }
      
      //let user know you found an object
      if(objectFound ==true)
      {
        //draw object location on screen
        //use vector version of drawObject if allowing multiples
        coordinates = drawObject(blob,cameraFeed);
        coordinates.setTracking(true);
      }
      else
      {
        coordinates.setTracking(false);
      }
    }
    else putText(cameraFeed,"Adjust Filter, too much noise.",Point(0,50),1,2,Scalar(0,0,255),2);
  }
  return coordinates;
}
开发者ID:SDSMT-CSC464-F15,项目名称:landingpad,代码行数:88,代码来源:cv_tracker.cpp


注:本文中的LED::getText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。