Skip to content

Commit 194740a

Browse files
committed
Merge pull request #3 from mjmarin/devel
Devel merged into master
2 parents d025181 + 268af90 commit 194740a

33 files changed

+2110
-270
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,11 @@ Thumbs.db
4141
##########
4242
*.aux
4343
*.bbl
44-
*.blg
44+
*.blg
45+
*.html
46+
*.map
47+
*.md5
48+
*.png
49+
*.gch
50+
*.css
51+
*~

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
66

77
PROJECT(pabod)
8-
set(PROJECT_VERSION "0.2.7")
8+
set(PROJECT_VERSION "0.2.10")
99
string(REGEX MATCHALL "[0-9]" PROJECT_VERSION_PARTS "${PROJECT_VERSION}")
1010
list(GET PROJECT_VERSION_PARTS 0 PROJECT_VERSION_MAJOR)
1111
list(GET PROJECT_VERSION_PARTS 1 PROJECT_VERSION_MINOR)
1212
list(GET PROJECT_VERSION_PARTS 2 PROJECT_VERSION_PATCH)
13+
list(GET PROJECT_VERSION_PARTS 3 PROJECT_VERSION_PATCH2)
1314
set(PROJECT_SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
1415

1516

@@ -29,7 +30,7 @@ MESSAGE(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
2930

3031
if(WIN32)
3132
# Postfix of DLLs:
32-
SET(PROJECT_DLLVERSION "${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}")
33+
SET(PROJECT_DLLVERSION "${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}${PROJECT_VERSION_PATCH2}")
3334
SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}")
3435
SET(RUNTIME_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for dlls and binaries")
3536
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for binaries")
@@ -127,7 +128,7 @@ endif()
127128
# ADDING PROJECT VERSION
128129
file(APPEND ${CUSTOM_H} "\n#define PABOD_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}\n")
129130
file(APPEND ${CUSTOM_H} "\n#define PABOD_MINOR_VERSION ${PROJECT_VERSION_MINOR}\n")
130-
file(APPEND ${CUSTOM_H} "\n#define PABOD_PATCH_VERSION ${PROJECT_VERSION_PATCH}\n")
131+
file(APPEND ${CUSTOM_H} "\n#define PABOD_PATCH_VERSION ${PROJECT_VERSION_PATCH}${PROJECT_VERSION_PATCH2}\n")
131132

132133
# DEALING WITH MATIO VERSIONS
133134
IF(WIN32)
@@ -155,7 +156,7 @@ ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/c
155156
# ----------------------------------------------------------------------------
156157
# create configuration file from .in file (If you use windows take care with paths)
157158
# ----------------------------------------------------------------------------
158-
159+
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE ${CMAKE_CURRENT_SOURCE_DIR}/include)
159160
CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.cmake.in" "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake")
160161
INSTALL(FILES "${PROJECT_BINARY_DIR}/Find${PROJECT_NAME}.cmake" DESTINATION lib/cmake/ )
161162

COPYING.libpabod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2011 Daniel Rodriguez Molina and Manuel J. Marin-Jimenez
1+
Copyright (C) 2011, 2012, 2013 Daniel Rodriguez Molina and Manuel J. Marin-Jimenez
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
==============================================================================
2+
libpabod: Library for PArt-Based Object Detection in C++
3+
==============================================================================
4+
Daniel Rodriguez Molina and Manuel J. Marin-Jimenez
5+
6+
This software implements the object detection system described in Felzenszwalb et al. [1].
7+
--------------------------------------------------------------------------------
8+
9+
Source-Code: https://github.com/mjmarin/libpabod
10+
11+
--------------------------------------------------------------------------------
12+
Contents of the package:
13+
--------------------------------------------------------------------------------
14+
- bin - the executable file will be created here
15+
- data:
16+
- models - contains all the object model files
17+
- testimages - a set of images to test the software
18+
- doc - folder where the documentation will be generated
19+
- include - contains all the software header files
20+
- libs - folder where the library will be generated
21+
- obj - folder where the object files will be generated during the compilation
22+
- src - contains all the software source files
23+
- tests - contains some programs to test the library
24+
- makefile - used to compile the library, the documentation and the test program
25+
26+
--------------------------------------------------------------------------------
27+
Requirements:
28+
--------------------------------------------------------------------------------
29+
This software has been tested on Ubuntu 10.10 (Maverick Meerkat) with the following libraries:
30+
- libmatio-dev - v1.3.4-2 (required)
31+
- libcv-dev - v2.1.0-2 (required)
32+
- libhighgui-dev - v2.1.0-2 (required)
33+
- doxygen - v1.7.1-1 (optional; used to generate the documentation)
34+
- graphviz - v2.26.3-4 (optional; used to generate figures for the documentation)
35+
36+
--------------------------------------------------------------------------------
37+
Quick start:
38+
--------------------------------------------------------------------------------
39+
40+
A) Classic installation (obsolete --> CMake is highly recommended):
41+
1. Unpack in <libpabod_directory>
42+
2. cd <libpabod_directory>
43+
3.1. Generating the library
44+
> make
45+
3.2. Creating the test programs
46+
> make alltests
47+
3.3. Generating the documentation
48+
> make docum
49+
3.4. Recompiling all
50+
> make cleanobj
51+
> make
52+
53+
Tip: use 'make all' to generate both the library and the test programs.
54+
55+
B) Installing with CMake:
56+
Please, follow the steps described in the file named INSTALL.
57+
58+
C) Testing the library:
59+
(assuming test program has been already generated)
60+
1. cd <libpabod_directory>
61+
2. ./bin/detectobj -m <model_path> -i <image_path> [-t <threshold>] [-o <detections_path>] [-d <0/1>]
62+
Example:
63+
> ./bin/detectobj -m data/models/person_v6.mat -i data/testimages/2008_007537.jpg -t -0.3 -o detections.txt
64+
65+
If the program has finished correctly, you will find a text file named 'detections.txt' with the following structure:
66+
<number_of_detected_objects>
67+
<x1_i> <y1_i> <x2_i> <y2_i> <score_i>
68+
where <x1_i> <y1_i> <x2_i> <y2_i> are the pairs of coordinates of the i-th bounding box and <score_i> is its corresponding detection score.
69+
70+
Tip: object detection can be performed directly on video frames (e.g. avi file) with the test program named 'detectvid'.
71+
72+
--------------------------------------------------------------------------------
73+
Citation:
74+
--------------------------------------------------------------------------------
75+
If you use this library for your publications, please cite it as:
76+
@misc{libpabod,
77+
author = {Rodriguez-Molina, Daniel and Marin-Jimenez, Manuel J.},
78+
title = {{LibPaBOD}: A Library for Part-Based Object Detection in {C++}},
79+
year = {2011},
80+
note = {Software available at \url{http://www.uco.es/~in1majim/}}
81+
}
82+
83+
--------------------------------------------------------------------------------
84+
Contact the authors:
85+
--------------------------------------------------------------------------------
86+
Daniel Rodriguez Molina (developer) - i72romod@uco.es / daniel.rodriguez.molina@gmail.com
87+
Manuel J. Marin-Jimenez (advisor) - mjmarin@uco.es
88+
89+
--------------------------------------------------------------------------------
90+
References:
91+
--------------------------------------------------------------------------------
92+
[1] P. Felzenszwalb, R. Girshick, D. McAllester, D. Ramanan. "Object Detection with Discriminatively Trained Part Based Models." IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 32, No. 9, September 2010.
93+
URL: http://people.cs.uchicago.edu/~pff/latent/
94+
95+
--------------------------------------------------------------------------------
96+
Version history:
97+
--------------------------------------------------------------------------------
98+
- v0.2.10: new option '-k' added to 'detectobj2' to show only K top detections
99+
- v0.2.9: moving CvMat to cv::Mat
100+
- v0.2.8: new class Detection
101+
- v0.2.7: memory leaks found by github/yokox solved. Thanks!
102+
- v0.2.6: new file 'export.h' for properly exporting functions to dll's.
103+
- v0.2.5: updated CMake files and other minor improvements for Windows compatibility.
104+
- v0.2.4: CMake and code updated to properly manage libmatio on Windows (thanks to Eric Sommerlade for his invaluable contributions). See new file 'INSTALL.windows'. libmatio 1.5.x is supported.
105+
- v0.2.2: detector component is now included in detections matrix. Other minor improvements.
106+
- v0.2.1: OpenMP is now optional via CMake. Selection of OpenMP overrides pthread's choice.
107+
- v0.2: new class Pabod. It encapsulates the class model and detection process. New demo file 'detectobj2.cpp' uses Pabod class. pthread is now optional via CMake. New 'quickstart.pdf' in directory 'doc'.
108+
- v0.1.7: fixed bugs (i.e. memory leaks) reported by <anonymous>.
109+
- v0.1.6: fixed documentation option for CMake (thanks to eichnerm). Use 'cmake .. -DINSTALL_DOC=ON" to generate the library documentation.
110+
- v0.1.5: CMake is supported (thanks to rmsalinas@uco.es). By default, the library is built in shared mode (non-static).
111+
- v0.1.4: added an alternative 'makeDetection' function. Updated makefile. Now 'make all' builds both the library and the test programs.
112+
- v0.1.3: added 'detectvid' program. It performs detection on video sequences (e.g. avi). Use 'make test3' to generate it. Use 'make alltests' to generate all test programs.
113+
- v0.1.2: small fixes in code.
114+
- v0.1.1: added 'detectobj' program. It can save detections to disk. Use 'make test2' to generate it.
115+
- v0.1: first release.
116+

README.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ URL: http://people.cs.uchicago.edu/~pff/latent/
8989

9090
Version history:
9191
================
92+
- v0.2.9: moving CvMat to cv::Mat
93+
- v0.2.8: new class Detection
9294
- v0.2.7: memory leaks found by github/yokox solved. Thanks!
9395
- v0.2.6: new file 'export.h' for properly exporting functions to dll's.
9496
- v0.2.5: updated CMake files and other minor improvements for Windows compatibility.

TODO

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
+ Some memory leaks still to be fixed:
2+
- Possible ones: Model, Cell
3+
+ Add a new method to load object models from XML file. This requires a M-script to create such XML model files.
4+
+ Convert CvMat * variables to cv::Mat class.

doc/quickstart.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ \section{Easy detection with LibPaBOD}
3535

3636
\noindent So easy!
3737

38+
\section{Using the OpenCV C++ interface}
39+
40+
\begin{verbatim}
41+
LDetections detections;
42+
43+
cv::Mat img = cv::imread("my_image.jpg", CV_LOAD_IMAGE_COLOR);
44+
45+
Pabod detector("data/models/person_v6.mat");
46+
47+
detector.detect(img, POSITIVE_INF, 0.5, detections);
48+
49+
detector.drawDetections(img, detections);
50+
51+
cv::imwrite("my_image_dets.jpg", img);
52+
\end{verbatim}
53+
3854
\begin{thebibliography}{}
3955
\bibitem{felzenszwalb2010}
4056
P. Felzenszwalb, R. Girshick, D. McAllester, D. Ramanan. ``Object Detection with Discriminatively Trained Part Based Models''. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 32, No. 9, September 2010.

include/cell.h

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
#ifndef _CELL_H_
22
#define _CELL_H_
33

4+
#include <vector>
45
#include <readTypes.h>
56
#include <handlerOpenCVStructs.h>
67

78

8-
/** \file
9-
* This file contains the definition of Model class. This class is used to
10-
* load a the model structure stored on a .mat file.
11-
*/
12-
139
/** \file
1410
* This file contains the definition of <tt>Cell</tt> class. This class is
1511
* an auxiliar part of class <tt>Model</tt>, and is used to load the
1612
* field <tt>rules</tt> of .mat model file
1713
*/
1814

19-
2015
/** \def INVALID_STR
2116
* This define is used to indicate a structure is invalid, which means their
2217
* fields are not considered.
@@ -54,6 +49,12 @@ typedef struct offset
5449
{
5550
float w;
5651
int blocklabel;
52+
53+
offset()
54+
{
55+
w = 0.0;
56+
blocklabel = 0;
57+
}
5758
} offset;
5859

5960

@@ -70,6 +71,12 @@ typedef struct anchor
7071
{
7172
int* array;
7273
int dim;
74+
75+
anchor()
76+
{
77+
dim = 0;
78+
array = NULL;
79+
}
7380
} anchor;
7481

7582

@@ -88,6 +95,16 @@ typedef struct def
8895
int blocklabel;
8996
bool flip;
9097
char symmetric;
98+
99+
//! Constructor
100+
def()
101+
{
102+
w[0]=w[1]=w[2]=w[3] = 0.0;
103+
blocklabel = 0;
104+
flip = false;
105+
symmetric = '\0';
106+
}
107+
91108
} def;
92109

93110

@@ -152,6 +169,10 @@ class Cell
152169
*/
153170
void destroyCell ();
154171

172+
void releaseScore(void);
173+
void releaseIxIy(void);
174+
175+
155176

156177
///////////////////////////////
157178
///// LOAD FILE FUNCTIONS /////
@@ -474,15 +495,17 @@ class Cell
474495
* \sa _score
475496
* \sa _scoreDim
476497
*/
477-
CvMat** getScore () const {return _score;}
498+
//CvMat** getScore () const {return _score;}
499+
const vectorMat & getScore () const {return _score;}
478500

479501

480502
/** Set the value of private variable <tt>_score</tt> to <tt>score</tt>.
481503
* \param score - new array of matrixes for the variable <tt>_score</tt>
482504
* \sa _score
483505
* \sa _scoreDim
484506
*/
485-
void setScore (CvMat **score);
507+
//void setScore (CvMat **score);
508+
void setScore (vectorMat & score);
486509

487510

488511
/** Returns the value of private variable <tt>_scoreDim</tt>
@@ -510,16 +533,23 @@ class Cell
510533
* \sa _Ix
511534
* \sa _IxDim
512535
*/
513-
CvMat** getIx () const {return _Ix;}
536+
//CvMat** getIx () const {return _Ix;}
537+
const vectorMat & getIx () const {return _Ix;}
514538

515539

516540
/** Set the value of private variable <tt>_Ix</tt> to <tt>Ix</tt>.
517541
* \param Ix - new array of matrixes for the variable <tt>_Ix</tt>
518542
* \sa _Ix
519543
* \sa _IxDim
520544
*/
521-
void setIx (CvMat **Ix);
545+
//void setIx (CvMat **Ix);
546+
void setIx (vectorMat &Ix);
522547

548+
void addIxItem(cv::Mat &Ix){_Ix.push_back(Ix);};
549+
void addIyItem(cv::Mat &Iy){_Iy.push_back(Iy);};
550+
551+
void addIxItem(CvMat * Ix){_Ix.push_back(Ix);};
552+
void addIyItem(CvMat * Iy){_Iy.push_back(Iy);};
523553

524554
/** Returns the value of private variable <tt>_IxDim</tt>
525555
* \return The int value <tt>_IxDim</tt>, which indicates <tt>_Ix</tt>
@@ -547,15 +577,17 @@ class Cell
547577
* \sa _Iy
548578
* \sa _IyDim
549579
*/
550-
CvMat** getIy () const {return _Iy;}
580+
//CvMat** getIy () const {return _Iy;}
581+
const vectorMat & getIy () const {return _Iy;}
551582

552583

553584
/** Set the value of private variable <tt>_Iy</tt> to <tt>Iy</tt>.
554585
* \param Iy - new array of matrixes for the variable <tt>_Iy</tt>
555586
* \sa _Iy
556587
* \sa _IyDim
557588
*/
558-
void setIy (CvMat **Iy);
589+
//void setIy (CvMat **Iy);
590+
void setIy (vectorMat & Iy);
559591

560592

561593
/** Returns the value of private variable <tt>_IyDim</tt>
@@ -686,7 +718,8 @@ class Cell
686718
/** Is a CvMat* array private variable.
687719
* \sa _scoreDim
688720
*/
689-
CvMat** _score;
721+
//CvMat** _score;
722+
vectorMat _score;
690723

691724

692725
/** Is an int private variable. Indicates the size of
@@ -699,7 +732,8 @@ class Cell
699732
/** Is a CvMat* array private variable.
700733
* \sa _IxDim
701734
*/
702-
CvMat** _Ix;
735+
//CvMat** _Ix;
736+
vectorMat _Ix;
703737

704738

705739
/** Is an int private variable. Indicates the size of
@@ -712,7 +746,8 @@ class Cell
712746
/** Is a CvMat* array private variable.
713747
* \sa _IyDim
714748
*/
715-
CvMat** _Iy;
749+
//CvMat** _Iy;
750+
vectorMat _Iy;
716751

717752

718753
/** Is an int private variable. Indicates the size of

0 commit comments

Comments
 (0)