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 nes_cpu_adc_im(void) { uint8_t immediate = cpu_get_op(); log_im("ADC", (uint8_t)(immediate)); uint16_t result = cpu.a + immediate + cpu_get_C(); if (~(cpu.a ^ immediate) & (cpu.a ^ lo(result)) & 0x80) cpu_set_V(); if (hi(result)) cpu_set_C(); else cpu_clr_C(); cpu.a = lo(result); cpu_check_Z(cpu.a); cpu_check_N(cpu.a); cpu.pc += 2; }
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)); }
vector<Scores> eval_model(int argc, char**argv,const Model_Builder&model_builder) { // train the model shared_ptr<Model> model = train_model(model_builder); // save the model. if(g_params.option_is_set("WRITE_MODEL")) { FileStorage save_model(params::out_dir() + "/model.yml",FileStorage::WRITE); save_model << "model"; bool model_wrote = model->write(save_model); if(!model_wrote) log_file << "warning: failed to write model!" << endl; save_model.release(); } // show the model log_im("final_model",model->show("final model")); // // testing phase // // test on video if(g_params.has_key("TEST_VIDEO")) test_model_oni_video(*model); // compute training error //auto result = eval_on_dirs(model, //vector<string>{params::synthetic_directory()}); // test on images if(g_params.has_key("TEST_IMAGES")) test_model_images(model); // test on directories //auto result = eval_on_dirs(model,testDirs = default_test_dirs();); //return reuslt; return vector<Scores>(); }