-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
417 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "python/pyboostcvconverter"] | ||
path = python/pyboostcvconverter | ||
url = https://github.com/kyu-sz/pyboostcvconverter.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
project(analysis) | ||
|
||
file(GLOB_RECURSE SOURCE_FILES *.cpp) | ||
add_library(_${PROJECT_NAME} SHARED ${SOURCE_FILES}) | ||
target_include_directories(_${PROJECT_NAME} PUBLIC | ||
${PYTHON_INCLUDE_DIR} | ||
${Boost_INCLUDE_DIR} | ||
${CMAKE_SOURCE_DIR}/python/pyboostcvconverter/include) | ||
target_link_libraries(_${PROJECT_NAME} | ||
${Boost_LIBRARIES} | ||
${PYTHON_LIBRARIES} | ||
${OpenCV_LIBS} | ||
simple_vehicle_counting | ||
pbcvt) | ||
set_target_properties(_${PROJECT_NAME} PROPERTIES PREFIX "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// Created by ken.yu on 17-4-6. | ||
// | ||
|
||
#include <boost/python.hpp> | ||
|
||
#include "package_analysis/VehicleCouting.h" | ||
#include "pyboostcvconverter/pyboostcvconverter.hpp" | ||
|
||
namespace bp = boost::python; | ||
|
||
class PyVehicleCouting : public VehicleCouting { | ||
public: | ||
void setInput(const bp::object &i) { | ||
VehicleCouting::setInput(pbcvt::fromNDArrayToMat(i.ptr())); | ||
} | ||
}; | ||
|
||
BOOST_PYTHON_MODULE (_analysis) { | ||
bp::class_<PyVehicleCouting>("VehicleCouting") | ||
.def("setInput", &PyVehicleCouting::setInput) | ||
.def("setTracks", &PyVehicleCouting::setTracks) | ||
.def("process", &PyVehicleCouting::process); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from _analysis import * | ||
|
||
# noinspection PyUnresolvedReferences | ||
import cvb | ||
# noinspection PyUnresolvedReferences | ||
import pyboostcvconverter as pbcvt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
project(bgs) | ||
|
||
file(GLOB_RECURSE SOURCE_FILES *.cpp) | ||
add_library(_${PROJECT_NAME} SHARED ${SOURCE_FILES}) | ||
target_include_directories(_${PROJECT_NAME} PUBLIC | ||
${PYTHON_INCLUDE_DIR} | ||
${Boost_INCLUDE_DIR} | ||
${CMAKE_SOURCE_DIR}/python/pyboostcvconverter/include) | ||
target_link_libraries(_${PROJECT_NAME} | ||
${Boost_LIBRARIES} | ||
${PYTHON_LIBRARIES} | ||
${OpenCV_LIBS} | ||
simple_vehicle_counting | ||
pbcvt) | ||
set_target_properties(_${PROJECT_NAME} PROPERTIES PREFIX "") | ||
|
||
add_subdirectory(pbas) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// Created by ken.yu on 17-4-6. | ||
// | ||
|
||
#include "_IBGS.hpp" | ||
|
||
namespace bp = boost::python; | ||
|
||
class PyIBGSWrap : public PyIBGS, public bp::wrapper<PyIBGS> { | ||
public: | ||
PyObject *process(PyObject *) { | ||
return this->get_override("process")(); | ||
} | ||
}; | ||
|
||
BOOST_PYTHON_MODULE (_bgs) { | ||
bp::class_<PyIBGSWrap, boost::noncopyable>("IBGS") | ||
.def("process", bp::pure_virtual(&PyIBGS::process)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// Created by ken.yu on 17-4-6. | ||
// | ||
|
||
#ifndef SIMPLE_VEHICLE_COUNTING_IBGS_HPP | ||
#define SIMPLE_VEHICLE_COUNTING_IBGS_HPP | ||
|
||
#include "package_bgs/IBGS.h" | ||
|
||
#include <boost/python.hpp> | ||
|
||
class PyIBGS { | ||
public: | ||
virtual PyObject *process(PyObject *) = 0; | ||
}; | ||
|
||
#endif //SIMPLE_VEHICLE_COUNTING_IBGS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from _bgs import * | ||
|
||
# noinspection PyUnresolvedReferences | ||
import pyboostcvconverter as pbcvt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
project(pbas) | ||
|
||
file(GLOB_RECURSE SOURCE_FILES *.cpp) | ||
add_library(_${PROJECT_NAME} SHARED ${SOURCE_FILES}) | ||
target_include_directories(_${PROJECT_NAME} PUBLIC | ||
${PYTHON_INCLUDE_DIR} | ||
${Boost_INCLUDE_DIR} | ||
${CMAKE_SOURCE_DIR}/python/pyboostcvconverter/include) | ||
target_link_libraries(_${PROJECT_NAME} | ||
${Boost_LIBRARIES} | ||
${PYTHON_LIBRARIES} | ||
${OpenCV_LIBS} | ||
simple_vehicle_counting | ||
pbcvt) | ||
set_target_properties(_${PROJECT_NAME} PROPERTIES PREFIX "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Created by ken.yu on 17-4-6. | ||
// | ||
|
||
#include <cstdio> | ||
|
||
#include "../_IBGS.hpp" | ||
|
||
#include "package_bgs/PBAS/PixelBasedAdaptiveSegmenter.h" | ||
#include "pyboostcvconverter/pyboostcvconverter.hpp" | ||
|
||
namespace bp = boost::python; | ||
|
||
class PyPixelBasedAdaptiveSegmenter : public PyIBGS, public PixelBasedAdaptiveSegmenter { | ||
public: | ||
PyObject *process(PyObject *py_img_input) { | ||
cv::Mat output; | ||
cv::Mat cv_img_input = pbcvt::fromNDArrayToMat(py_img_input); | ||
PixelBasedAdaptiveSegmenter::process(cv_img_input, output); | ||
if (output.empty()) | ||
return NULL; | ||
else | ||
return pbcvt::fromMatToNDArray(output); | ||
} | ||
}; | ||
|
||
BOOST_PYTHON_MODULE (_pbas) { | ||
bp::class_<PyPixelBasedAdaptiveSegmenter>("PixelBasedAdaptiveSegmenter") | ||
.def("process", &PyPixelBasedAdaptiveSegmenter::process); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from _pbas import * | ||
|
||
# noinspection PyUnresolvedReferences | ||
import pyboostcvconverter as pbcvt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
project(cvb) | ||
|
||
file(GLOB_RECURSE SOURCE_FILES *.cpp) | ||
add_library(_${PROJECT_NAME} SHARED ${SOURCE_FILES}) | ||
target_include_directories(_${PROJECT_NAME} PUBLIC | ||
${PYTHON_INCLUDE_DIR} | ||
${Boost_INCLUDE_DIR} | ||
${CMAKE_SOURCE_DIR}/python/pyboostcvconverter/include) | ||
target_link_libraries(_${PROJECT_NAME} | ||
${Boost_LIBRARIES} | ||
${PYTHON_LIBRARIES} | ||
${OpenCV_LIBS} | ||
simple_vehicle_counting | ||
pbcvt) | ||
set_target_properties(_${PROJECT_NAME} PROPERTIES PREFIX "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from _cvb import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// Created by ken.yu on 17-4-6.") | ||
// | ||
|
||
#include <boost/python.hpp> | ||
|
||
#include "package_tracking/cvblob/cvblob.h" | ||
|
||
namespace bp = boost::python; | ||
|
||
BOOST_PYTHON_MODULE (_cvb) { | ||
bp::class_<CvPoint2D64f>("CvPoint2D64f") | ||
.def_readwrite("x", &CvPoint2D64f::x) | ||
.def_readwrite("y", &CvPoint2D64f::y); | ||
|
||
bp::class_<cvb::CvTrack>("CvTrack") | ||
.def_readwrite("id", &cvb::CvTrack::id, | ||
"Track identification number.") | ||
.def_readwrite("label", &cvb::CvTrack::label, | ||
"Label assigned to the blob related to this track.") | ||
.def_readwrite("minx", &cvb::CvTrack::minx, | ||
"X min.") | ||
.def_readwrite("maxx", &cvb::CvTrack::maxx, | ||
"X max.") | ||
.def_readwrite("miny", &cvb::CvTrack::miny, | ||
"Y min.") | ||
.def_readwrite("maxy", &cvb::CvTrack::maxy, | ||
"y max.") | ||
.def_readwrite("centroid", &cvb::CvTrack::centroid, | ||
"Centroid.") | ||
.def_readwrite("lifetime", &cvb::CvTrack::lifetime, | ||
"Indicates how much frames the object has been in scene.") | ||
.def_readwrite("active", &cvb::CvTrack::active, | ||
"Indicates number of frames that has been active from last inactive period.") | ||
.def_readwrite("inactive", &cvb::CvTrack::inactive, | ||
"Indicates number of frames that has been missing."); | ||
bp::class_<cvb::CvTracks>("CvTracks"); | ||
} |
Oops, something went wrong.