Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README2

This file was deleted.

2 changes: 1 addition & 1 deletion opencv_gpb/Makefile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
29 changes: 29 additions & 0 deletions opencv_gpb/Makefile.osx
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions opencv_gpb/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"<<endl;
return 0;
}
system("clear");
cout<<"(before running it, roughly mark the areas on the ucm window)"<<endl;
cout<<"Press 'r' - resort the original ucm, and remark"<<endl;
Expand Down
2 changes: 1 addition & 1 deletion opencv_gpb/src/sPb/affinity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ float C_IC_SS(float ic)
val += (ic / 0.3130)*-1.3113;

const float post = 1.0 / (1.0 + exp(-val));
if (!finite(post)) {
if (!isfinite(post)) {
return 0;
}
if (post < 0) {
Expand Down
17 changes: 10 additions & 7 deletions opencv_gpb/src/seg/VisWatershed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ assert( 0 <= diff && diff <= 255 ); \

if( CV_MAT_TYPE(src->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" );

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions opencv_gpb/src/seg/watershed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}