// -*- C++ -*- // Copyright 2006-2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz // or its licensors, as applicable. // Copyright 1995-2005 by Thomas M. Breuel // // You may not use this file except under the terms of the accompanying license. // // Licensed under the Apache License, Version 2.0 (the "License"); you // may not use this file except in compliance with the License. You may // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Project: // File: // Purpose: // Responsible: tmb // Reviewer: // Primary Repository: // Web Sites: #include "colib.h" #include "imgio.h" #include "segmentation.h" using namespace ocropus; using namespace colib; int main(int argc,char **argv) { if(argc==1&&isatty(0)) { fprintf(stderr,"WARNING: this is not exactly the same algorithm as described in the paper\n"); fprintf(stderr,"arguments: < pnm-image > segmented-pnm-image\n\n"); exit(1); } try { bytearray image; intarray segmentation; // read image if(argc>1) read_pnm_gray(stdio(argv[1],"r"), image); else read_pnm_gray(stdin, image); autodel seg(make_CurvedCutSegmenter()); seg->charseg(segmentation, image); write_ppm_packed(stdout,segmentation); // intarray segmentation(image.dim(0),image.dim(1)); // segmentation = 0; // //incorporate the cuts into the image by setting them to zero in segmentation // //and using that to compute the "new" (cut) connected components // //the artifically created cut has width 3 // for(int i=0;i