int main(int argc, char * argv[]) { if (argc != 3) { printf("SubdivisionSurfaces <mesh_name> <image_name>\n"); return 0; } else { Visualization(argv[1], argv[2]); } //Mesh * mesh = ConstructMeshFromPlyFile(argv[1]); return 0; }
Texture::Visualization::Visualization(const Any& a) { *this = Visualization(); if (a.type() == Any::ARRAY) { if (a.nameEquals("bumpInAlpha")) { *this = bumpInAlpha(); } else if (a.nameEquals("defaults")) { *this = defaults(); } else if (a.nameEquals("linearRGB")) { *this = linearRGB(); } else if (a.nameEquals("depthBuffer")) { *this = depthBuffer(); } else if (a.nameEquals("packedUnitVector")) { *this = packedUnitVector(); } else if (a.nameEquals("radiance")) { *this = radiance(); } else if (a.nameEquals("reflectivity")) { *this = reflectivity(); } else if (a.nameEquals("sRGB")) { *this = sRGB(); } else if (a.nameEquals("unitVector")) { *this = unitVector(); } else { a.verify(false, "Unrecognized Visualization factory method"); } } else { a.verifyName("Texture::Visualization", "Visualization"); AnyTableReader r(a); String c; if (r.getIfPresent("channels", c)) { channels = toChannels(c); } r.getIfPresent("documentGamma", documentGamma); r.getIfPresent("invertIntensity", invertIntensity); r.getIfPresent("max", max); r.getIfPresent("min", min); r.getIfPresent("layer", layer); r.getIfPresent("mipLevel", mipLevel); r.verifyDone(); } }
void ENetSegmenter::Predict(const cv::Mat& in_image_mat, cv::Mat& out_segmented) { caffe::Blob<float>* input_layer = net_->input_blobs()[0]; input_layer->Reshape(1, num_channels_, input_geometry_.height, input_geometry_.width); /* Forward dimension change to all layers. */ net_->Reshape(); std::vector<cv::Mat> input_channels; WrapInputLayer(&input_channels); Preprocess(in_image_mat, &input_channels); net_->Forward(); /* Copy the output layer to a std::vector */ caffe::Blob<float>* output_layer = net_->output_blobs()[0]; int width = output_layer->width(); int height = output_layer->height(); int channels = output_layer->channels(); // compute argmax cv::Mat class_each_row(channels, width * height, CV_32FC1, const_cast<float *>(output_layer->cpu_data())); class_each_row = class_each_row.t(); // transpose to make each row with all probabilities cv::Point maxId; // point [x,y] values for index of max double maxValue; // the holy max value itself cv::Mat prediction_map(height, width, CV_8UC1); for (int i = 0; i < class_each_row.rows; i++) { minMaxLoc(class_each_row.row(i), 0, &maxValue, 0, &maxId); prediction_map.at<uchar>(i) = maxId.x; } out_segmented = Visualization(prediction_map, lookuptable_file_); cv::resize(out_segmented, out_segmented, cv::Size(in_image_mat.cols, in_image_mat.rows)); }