Skip to content

Commit

Permalink
fixed the bug. still seg fault persists.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aravind-Suresh committed Jul 14, 2015
1 parent 9c79923 commit 02e7468
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 8 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LDFLAGS = -ljpeg -mavx -lm -lpthread -lX11 `pkg-config --libs opencv` -DDLIB_HAV
# $^ stores the dependency
all: bin/oic

bin/oic: obj/dlib.o obj/faceDetection.o obj/pupilDetection.o obj/kalmanFilters.o obj/util.o obj/oic.o
bin/oic: obj/dlib.o obj/faceDetection.o obj/pupilDetection.o obj/kalmanFilters.o obj/util.o obj/kmeansUtils.o obj/oic.o
$(CXX) -o $@ $^ $(LDFLAGS)

obj/dlib.o: src/dlib/all/source.cpp
Expand All @@ -37,6 +37,9 @@ obj/kalmanFilters.o: src/kalmanFilters.cpp
obj/util.o: src/util.cpp
$(CXX) -c $(CXXFLAGS) -o $@ $<

obj/kmeansUtils.o: src/kmeansUtils.cpp
$(CXX) -c $(CXXFLAGS) -o $@ $<

#obj/viewUtils.o: src/viewUtils.cpp
# $(CXX) -c $(CXXFLAGS) -o $@ $<

Expand Down
2 changes: 1 addition & 1 deletion include/kmeansUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
#define KMEANS_UTILs_H

void kmeans_array_generate(cv::Mat src, std::vector<std::vector<double> > vec, int mode);
void kmeans_clusters_view(cv::Mat& src, std::vector<std::vector<double> > vec_labels);
void kmeans_clusters_view(cv::Mat& src, std::vector<int> vec_labels);

#endif
Binary file removed obj/dlib.o
Binary file not shown.
Binary file removed obj/faceDetection.o
Binary file not shown.
Binary file removed obj/kalmanFilters.o
Binary file not shown.
Binary file removed obj/oic.o
Binary file not shown.
Binary file removed obj/pupilDetection.o
Binary file not shown.
Binary file removed obj/util.o
Binary file not shown.
20 changes: 20 additions & 0 deletions out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
mkdir -p obj bin
g++ -c -g -I./include -I./src/dlib/all/source.cpp -ljpeg -mavx -lm -lpthread -lX11 -DDLIB_HAVE_BLAS -DNDEBUG -DDLIB_JPEG_SUPPORT -DDLIB_HAVE_AVX -O3 `pkg-config --cflags opencv` -o obj/faceDetection.o src/faceDetection.cpp
g++ -c -g -I./include -I./src/dlib/all/source.cpp -ljpeg -mavx -lm -lpthread -lX11 -DDLIB_HAVE_BLAS -DNDEBUG -DDLIB_JPEG_SUPPORT -DDLIB_HAVE_AVX -O3 `pkg-config --cflags opencv` -o obj/pupilDetection.o src/pupilDetection.cpp
g++ -c -g -I./include -I./src/dlib/all/source.cpp -ljpeg -mavx -lm -lpthread -lX11 -DDLIB_HAVE_BLAS -DNDEBUG -DDLIB_JPEG_SUPPORT -DDLIB_HAVE_AVX -O3 `pkg-config --cflags opencv` -o obj/kalmanFilters.o src/kalmanFilters.cpp
g++ -c -g -I./include -I./src/dlib/all/source.cpp -ljpeg -mavx -lm -lpthread -lX11 -DDLIB_HAVE_BLAS -DNDEBUG -DDLIB_JPEG_SUPPORT -DDLIB_HAVE_AVX -O3 `pkg-config --cflags opencv` -o obj/dlib.o src/dlib/all/source.cpp
cc1plus: warning: ./src/dlib/all/source.cpp: not a directory [enabled by default]
cc1plus: warning: ./src/dlib/all/source.cpp: not a directory [enabled by default]
cc1plus: warning: ./src/dlib/all/source.cpp: not a directory [enabled by default]
cc1plus: warning: ./src/dlib/all/source.cpp: not a directory [enabled by default]
g++ -c -g -I./include -I./src/dlib/all/source.cpp -ljpeg -mavx -lm -lpthread -lX11 -DDLIB_HAVE_BLAS -DNDEBUG -DDLIB_JPEG_SUPPORT -DDLIB_HAVE_AVX -O3 `pkg-config --cflags opencv` -o obj/util.o src/util.cpp
cc1plus: warning: ./src/dlib/all/source.cpp: not a directory [enabled by default]
g++ -c -g -I./include -I./src/dlib/all/source.cpp -ljpeg -mavx -lm -lpthread -lX11 -DDLIB_HAVE_BLAS -DNDEBUG -DDLIB_JPEG_SUPPORT -DDLIB_HAVE_AVX -O3 `pkg-config --cflags opencv` -o obj/kmeansUtils.o src/kmeansUtils.cpp
cc1plus: warning: ./src/dlib/all/source.cpp: not a directory [enabled by default]
g++ -c -g -I./include -I./src/dlib/all/source.cpp -ljpeg -mavx -lm -lpthread -lX11 -DDLIB_HAVE_BLAS -DNDEBUG -DDLIB_JPEG_SUPPORT -DDLIB_HAVE_AVX -O3 `pkg-config --cflags opencv` -o obj/oic.o src/oic.cpp
cc1plus: warning: ./src/dlib/all/source.cpp: not a directory [enabled by default]
make: *** [obj/dlib.o] Interrupt
make: *** [obj/util.o] Interrupt
make: *** wait: No child processes. Stop.
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes. Stop.
11 changes: 7 additions & 4 deletions src/kmeansUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void kmeans_array_generate(cv::Mat src, std::vector<std::vector<double> > vec, i
}
}

void kmeans_clusters_view(cv::Mat& src, std::vector<std::vector<double> > vec_labels) {
void kmeans_clusters_view(cv::Mat& src, std::vector<int> vec_labels) {
int rows = src.rows;
int cols = src.cols;

Expand All @@ -44,9 +44,12 @@ void kmeans_clusters_view(cv::Mat& src, std::vector<std::vector<double> > vec_la
for(int i=0;i<rows;i++) {
for(int j=0;j<cols;j++) {
int clr = vec_labels[idx]*100 + 50;
src.at<Vec3b>(i, j)[0] = clr;
src.at<Vec3b>(i, j)[1] = clr;
src.at<Vec3b>(i, j)[2] = clr;

src.at<cv::Vec3b>(i, j)[0] = clr;
src.at<cv::Vec3b>(i, j)[1] = clr;
src.at<cv::Vec3b>(i, j)[2] = clr;

idx++;
}
}
}
5 changes: 3 additions & 2 deletions src/oic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ int main(int argc, char** argv) {
std::vector<double> center_eye_proj(3);
std::vector<double> vec_cp_kalman_avg(3);

std::vector<std::vector<double> > vec_kmeans_data_l, vec_kmeans_labels_l, vec_kmeans_centers_l;
std::vector<std::vector<double> > vec_kmeans_data_l, vec_kmeans_centers_l;
std::vector<int> vec_kmeans_labels_l;

double Cf_left, Cf_right;

Expand Down Expand Up @@ -194,7 +195,7 @@ int main(int argc, char** argv) {
cv_image<bgr_pixel> cimg_kmeans_clr_l(roi1_clr);
kmeans_array_generate(roi1_clr, vec_kmeans_data_l, 0);
cv::kmeans(vec_kmeans_data_l, 3, vec_kmeans_labels_l, cv::TermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 10, 1.0),
3, cv::KMEANS_PP_CENTERS, vec_kmeans_centers_l);
3, cv::KMEANS_PP_CENTERS);//, vec_kmeans_centers_l);

kmeans_clusters_view(roi1_clr, vec_kmeans_labels_l);

Expand Down

0 comments on commit 02e7468

Please sign in to comment.