void log(string prefix,SphericalOccupancyMap&SOM)
    {
      Mat vis_r, vis_t, vis_z, vis_match,message,vis_raw_z;
      Mat zSlice = imclamp(SOM.get_OM(),t.z_min,t.z_max);
      
      // vis
      vis_raw_z = eq(SOM.get_OM());
      vis_r = eq(r);
      vis_t = eq(t.t);
      vis_z = eq(zSlice);
      Mat vis_t_full(vis_z.rows,vis_z.cols,DataType<Vec3b>::type,Scalar::all(255));
      {
	Mat src_roi = imroi(vis_t,Rect(Point(0,0),bb.size()));
	Mat dst_roi = imroi(vis_t_full,bb);
	src_roi.copyTo(dst_roi);
      }
      vis_match = im_merge(
	imroi(vis_r,Rect(Point(0,0),vis_z.size())),
	vis_z,
	vis_t_full);
      cv::rectangle(vis_match,bb.tl(),bb.br(),toScalar(BLUE));
      message = image_text(safe_printf("resp = %",extrema(r).max));
      vector<Mat> vs{vis_r,vis_t,vis_z,vis_match,vis_raw_z,message};
      log_im(prefix,tileCat(vs));
    }
bool
YamlNode::equalTo(char *v)
{
	if(isScalar()){
		if(toScalar()->toString() == v){
			return true;
		}
	}
	return false;
}
  void LibHandMetadata::log_metric_bb() const
  {
    // draw the metric bb
    Mat metric_viz = imageeq("",Z.clone(),false,false);
    Point bl(handBB.tl().x,handBB.br().y);
    Point tr(handBB.br().x,handBB.tl().y);
    cv::line(metric_viz,handBB.tl(),bl,toScalar(RED));
    cv::line(metric_viz,handBB.br(),bl,toScalar(GREEN));

    // compute edge lengths using law of cosines
    double z  = medianApx(Z,handBB,.5);
    double t1 = camera.distance_angular(handBB.tl(),bl);
    double d1 = camera.distance_geodesic(handBB.tl(),z,bl,z);
    double t2 = camera.distance_angular(handBB.br(),bl);
    double d2 = camera.distance_geodesic(handBB.br(),z,bl,z);

    Mat text = vertCat(image_text(safe_printf("% cm % rad",d1,t1),RED),
		       image_text(safe_printf("% cm % rad",d2,t2),GREEN));
    text = vertCat(text,image_text(safe_printf("% cm",z)));
    log_im("MetricBBSides",vertCat(metric_viz,text));
  }
Exemple #4
0
 Eigen::MatrixXd Scalar::getParameters()
 {
 	Eigen::Matrix<double, 1,1> M;
 	M << toScalar();
 	return M;
 }
Exemple #5
0
 Slice Matrix<int>::toSlice(bool ind1) const {
   return isscalar() ? Slice(toScalar(), ind1) : Slice(data(), ind1);
 }