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)); }
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)); }
Mat DynVolNN::show(const string&title) { return image_text("DynVolNN"); }
static void egd_drv_output(ErlDrvData handle, char *buffer, int n) { egd_data* d = (egd_data*)handle; int command = 0; unsigned char error_code[4]; /* Error Control */ /* get command */ command = decode(&buffer); n -= 2; switch(command) { case IM_CREATE: image_create(d, buffer, n); break; case IM_PIXEL: image_pixel(d, buffer, n); break; case IM_LINE: image_line(d, buffer, n); break; case IM_RECTANGLE: image_rectangle(d, buffer, n); break; case IM_FILLEDRECTANGLE: image_filled_rectangle(d, buffer, n); break; case IM_POLYGON: image_polygon(d, buffer, n); break; case IM_FILLEDPOLYGON: image_filled_polygon(d, buffer, n); break; case IM_COLOR: image_color(d, buffer, n); break; case IM_ARC: image_arc(d, buffer, n); break; case IM_FILLEDARC: image_filled_arc(d, buffer, n); break; case IM_FILLEDELLIPSE: image_filled_ellipse(d, buffer, n); break; case IM_TEXT: image_text(d, buffer, n); break; case IM_TEXTUP: image_text_up(d, buffer, n); break; case IM_FONT_SIZE: image_font_size(d, buffer, n); break; case IM_FILL: image_fill(d, buffer, n); break; /* Resampling och Rotate */ case IM_RESAMPLE: image_resample(d, buffer, n); break; case IM_ROTATE: image_rotate(d, buffer, n); break; /* Fetching images */ case IM_GIF: image_gif(d,buffer,n); break; case IM_JPEG: image_jpeg(d,buffer,n); break; case IM_PNG: image_png(d,buffer,n); break; default: driver_output(d->port, (char *)encode((char *)error_code, 1), 4); break; } }