void GraphSegmentationImpl::processImage(InputArray src, OutputArray dst) { Mat img = src.getMat(); dst.create(img.rows, img.cols, CV_32SC1); Mat output = dst.getMat(); output.setTo(0); // Filter graph Mat img_filtered; filter(img, img_filtered); // Build graph Edge *edges; int nb_edges; buildGraph(&edges, nb_edges, img_filtered); // Segment graph PointSet *es; segmentGraph(edges, nb_edges, img_filtered, &es); // Remove small areas filterSmallAreas(edges, nb_edges, es); // Map to final output finalMapping(es, output); free(edges); delete es; }
//0.5 500 20 d:\Tamop2_4c\TechnicalReport\progik\map.ppm paralellm.ppm 0 1 csr 0 void EtGcSegment::segment(image<rgb>*dest, float c, int minSize, std::string sortingMethod){ EtTimer tmr; // sort edges by weight if( !sortingMethod.compare( "s" ) ){ tmr.start(); std::sort( edges, edges + this->numEdges); tmr.stop(); std::cout << imgW << " " << imgH << " std::sort " << tmr.getElapsedTime() << endl; } else if( !sortingMethod.compare( "csr" ) ){ tmr.start(); countingSort(); tmr.stop(); std::cout << imgW << " " << imgH << " CountingSort_round " << tmr.getElapsedTime() << endl; } else{ //if( !sortingMethod.compare( "csf" ) ) tmr.start(); countingSortFloor(); tmr.stop(); std::cout << imgW << " " << imgH << " CountingSort_floor " << tmr.getElapsedTime() << endl; } tmr.start(); segmentGraph( c ); tmr.stop(); std::cout << imgW << " " << imgH << " Disjoint " << tmr.getElapsedTime() << endl; if( doPostprocess ){ tmr.start(); postProcessOriginal( minSize ); tmr.stop(); std::cout << imgW << " " << imgH << " PostProcess " << tmr.getElapsedTime() << endl; } drawSegments( dest ); }