diff --git a/README2 b/README2 deleted file mode 100644 index 0cb6ed7..0000000 --- a/README2 +++ /dev/null @@ -1 +0,0 @@ -www.1238090.com \ No newline at end of file diff --git a/opencv_gpb/Makefile b/opencv_gpb/Makefile index 584244d..7b54778 100644 --- a/opencv_gpb/Makefile +++ b/opencv_gpb/Makefile @@ -1,7 +1,7 @@ CC = g++ CFLAGS = `pkg-config --cflags opencv` -I./include/gPb -I./include/sPb -I./include/seg -LIBS = `pkg-config --libs opencv` -L/opt/local/lib -larpack -lparpack -L/opt/local/lib/gcc47 -lgfortran +LIBS = `pkg-config --libs opencv` -L/opt/local/lib -larpack -lparpack SRC = src/main.cpp \ src/gPb/globalPb.cpp \ diff --git a/opencv_gpb/Makefile.osx b/opencv_gpb/Makefile.osx new file mode 100644 index 0000000..467c85c --- /dev/null +++ b/opencv_gpb/Makefile.osx @@ -0,0 +1,29 @@ +#Makefile for OS X, compiles and runs OK using g++ == clang++ on 10.9, with homebrew versions of opencv and arpack + +CC = g++ + +CFLAGS = `pkg-config --cflags opencv` -I./include/gPb -I./include/sPb -I./include/seg + +LIBS = `pkg-config --libs opencv` -L/usr/local/lib -larpack + +SRC = src/main.cpp \ + src/gPb/globalPb.cpp \ + src/gPb/Filters.cpp \ + src/sPb/buildW.cpp \ + src/sPb/ic.cpp \ + src/sPb/affinity.cpp \ + src/sPb/smatrix.cpp \ + src/sPb/normCut.cpp \ + src/seg/watershed.cpp \ + src/seg/VisWatershed.cpp \ + src/seg/contour2ucm.cpp \ + src/seg/ucm_mean_pb.cpp \ + src/seg/uvt.cpp + +OBJ = gPb + +program: + $(CC) -o $(OBJ) $(SRC) $(CFLAGS) $(LIBS) + +clean: + rm $(OBJ) \ No newline at end of file diff --git a/opencv_gpb/src/main.cpp b/opencv_gpb/src/main.cpp index d845e1a..732fef8 100644 --- a/opencv_gpb/src/main.cpp +++ b/opencv_gpb/src/main.cpp @@ -51,6 +51,10 @@ void on_trackbar(int, void* ) int main(int argc, char** argv) { //info block + if (argc < 2) { + cout<<"Give the name of an image file to analyse using gPb"<type) != CV_8UC3 ) { printf("Only 8-bit, 3-channel input images are supported"); - exit; + exit(EXIT_FAILURE); } //CV_ERROR( CV_StsUnsupportedFormat, "Only 8-bit, 3-channel input images are supported" ); if( CV_MAT_TYPE(dst->type) != CV_32SC1 ) { printf("Only 32-bit, 1-channel output images are supported"); - exit; + exit(EXIT_FAILURE); } //CV_ERROR( CV_StsUnsupportedFormat, "Only 32-bit, 1-channel output images are supported" ); if( !CV_ARE_SIZES_EQ( src, dst )) { printf("The input and output images must have the same size"); - exit; + exit(EXIT_FAILURE); } //CV_ERROR( CV_StsUnmatchedSizes, "The input and output images must have the same size" ); @@ -188,7 +188,7 @@ assert( 0 <= diff && diff <= 255 ); \ // if there is no markers, exit immediately if( i == NQ ) - exit; + exit(EXIT_FAILURE); active_queue = i; img = src->data.ptr; @@ -224,17 +224,20 @@ assert( 0 <= diff && diff <= 255 ); \ t = m[-1]; if( t > 0 ) lab = t; t = m[1]; - if( t > 0 ) + if( t > 0 ) { if( lab == 0 ) lab = t; else if( t != lab ) lab = WSHED; + } t = m[-mstep]; - if( t > 0 ) + if( t > 0 ) { if( lab == 0 ) lab = t; else if( t != lab ) lab = WSHED; + } t = m[mstep]; - if( t > 0 ) + if( t > 0 ) { if( lab == 0 ) lab = t; else if( t != lab ) lab = WSHED; + } assert( lab != 0 ); m[0] = lab; diff --git a/opencv_gpb/src/seg/watershed.cpp b/opencv_gpb/src/seg/watershed.cpp index b966719..b96bec1 100644 --- a/opencv_gpb/src/seg/watershed.cpp +++ b/opencv_gpb/src/seg/watershed.cpp @@ -141,8 +141,8 @@ watershedFull(const cv::Mat & image, //viscous forced watershed: //cv::viswatershed(image3, regions, 3, 0.015); - // OpenCV convention: -1 for boundaries, zone index start a 0 - // Matlab convention: 0 for boundaries, zone index start a 1 + // OpenCV convention: -1 for boundaries, zone index start at 0 + // Matlab convention: 0 for boundaries, zone index start at 1 regions = regions + 1; } }