diff --git a/PythonAPI/carla/source/libcarla/SensorData.cpp b/PythonAPI/carla/source/libcarla/SensorData.cpp index f3fad9c3d..e36835d66 100644 --- a/PythonAPI/carla/source/libcarla/SensorData.cpp +++ b/PythonAPI/carla/source/libcarla/SensorData.cpp @@ -210,7 +210,7 @@ static void ConvertImage(T &self, EColorConverter cc) { throw std::invalid_argument("invalid color converter!"); } } - +#ifndef _WIN32 // method to convert optical flow images to rgb static boost::python::numpy::ndarray ColorCodedFlow ( carla::sensor::data::OpticalFlowImage& image) { @@ -317,6 +317,7 @@ static boost::python::numpy::ndarray ColorCodedFlow ( bn::dtype type = bn::dtype::get_builtin(); return bn::from_data(&result[0], type, shape, stride, bp::object()).copy(); } +#endif template static std::string SaveImageToDisk(T &self, std::string path, EColorConverter cc) { @@ -396,7 +397,9 @@ void export_sensor_data() { .add_property("height", &csd::OpticalFlowImage::GetHeight) .add_property("fov", &csd::OpticalFlowImage::GetFOVAngle) .add_property("raw_data", &GetRawDataAsBuffer) + #ifndef _WIN32 .def("get_color_coded_flow", &ColorCodedFlow) + #endif .def("__len__", &csd::OpticalFlowImage::size) .def("__iter__", iterator()) .def("__getitem__", +[](const csd::OpticalFlowImage &self, size_t pos) -> csd::OpticalFlowPixel { diff --git a/PythonAPI/carla/source/libcarla/libcarla.cpp b/PythonAPI/carla/source/libcarla/libcarla.cpp index f9a05d6b8..3174af5fa 100644 --- a/PythonAPI/carla/source/libcarla/libcarla.cpp +++ b/PythonAPI/carla/source/libcarla/libcarla.cpp @@ -209,8 +209,9 @@ static auto MakeCallback(boost::python::object callback) { } }; } - +#ifndef _WIN32 #include +#endif #include "Geom.cpp" #include "Actor.cpp" @@ -238,7 +239,9 @@ BOOST_PYTHON_MODULE(libcarla) { #if PY_MAJOR_VERSION < 3 || PY_MINOR_VERSION < 7 PyEval_InitThreads(); #endif +#ifndef _WIN32 boost::python::numpy::initialize(); +#endif scope().attr("__path__") = "libcarla"; export_geom(); export_control();