twistedfall / opencv-rust

Rust bindings for OpenCV 3 & 4
MIT License
1.92k stars 149 forks source link

Do you plan to implement OpenCV 3 support? #10

Closed thearchitect closed 5 years ago

kali commented 8 years ago

Yeah, certainly. Most of it is actually done, and is already working quite well on osx. The reason I have not released it yet is, I can't get it to work on the current travis setup because they still use 12.04, and I don't want to release something that does not at least build on two different computers :)

I am waiting for 3.0.1 to maybe fix some of the issues, or travis to bump their linux version.

Switching to 3.0 is actually very good for the bindings, as the way opencv uses c++ features has been made much more consistent across the library. Some of the peculiarities I have struggled with in 2.0 are no longer there, or are no longer the only way to get things done. And the doc is entirely switched to doxygen, so we also get a better documentation.

Feel free to try the cv3 branch of the project and tell me how it works for you and your preferred platform.

phdoerfler commented 8 years ago

May I suggest using Vagrant on your Mac to test it on of different systems?

brew cask install virtualbox
brew cask install vagrant
phdoerfler commented 8 years ago

@kali can you provide a list of things needed to be done to have OpenCV 3 support? Maybe there is stuff where others can lend a hand.

kali commented 8 years ago

Well, thing is, the pkg-config script from the official opencv distribution is in a very sorry state. The --libs options forgets things, does not include 3rdparty libs install by opencv, etc.

Last time I tried, I got discouraged when I realized I would probably have to craft the -l / -L myself from build.rs. To be honsest, after a few attempts, I was not even able to find by hand a working combination on Ubuntu: https://travis-ci.org/kali/opencv-rust/jobs/108554127

So yeah. Fixing pkg-config, or finding what I do wrong with it would help, and it may be the last major hurdle to get opencv 3 bindings usable or testable.

phdoerfler commented 8 years ago

Is this the error in question?:

note: /usr/bin/ld: /tmp/opencv/opencv-3.1.0/install/lib/libopencv_imgcodecs.a(grfmt_exr.cpp.o): undefined reference to symbol '_ZN4half5_eLutE'
//usr/lib/x86_64-linux-gnu/libHalf.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

I am afraid that I never had to venture quite that deep into the nitty gritty details of how to link to OpenCV 3 so I can't really help you there.

However if it would help to have this on a different linux distribution other than the Ubuntu from Travis I could certainly help by setting up a couple machines to do testing on there.

polarathene commented 8 years ago

I've not used OpenCV before but would handling your tests via a docker image work? [Here] is one that you could pull to test opencv-rust?

sologo commented 8 years ago

I just tried branch cv3 on ubuntu 14. Rust v1.10 and Clang v3.5. But i got some trouble on it. I hope this information can make some help for this project. Here is the information . (There is something wrong with the encode. But it is actually what i have got on the terminal.) (At first i used GCC as the complier . But there is the same error before changed to Clang v3.5 except the encode error . ) ====================== Seperator ======================== ho@ho:~/rust-opencv3-gen/opencv-rust$ RUST_BACKTRACE=1 cargo build Compiling opencv v0.2.0 (file:///home/hosinokakera/rust-opencv3-gen/opencv-rust) error: failed to run custom build command for opencv v0.2.0 (file:///home/hosinokakera/rust-opencv3-gen/opencv-rust) Process didn't exit successfully: /home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/build-script-build (exit code: 101) --- stdout cargo:rustc-link-search=native=/usr/local/lib cargo:rustc-link-lib=opencv_calib3d cargo:rustc-link-lib=opencv_core cargo:rustc-link-lib=opencv_features2d cargo:rustc-link-lib=opencv_flann cargo:rustc-link-lib=opencv_highgui cargo:rustc-link-lib=opencv_imgcodecs cargo:rustc-link-lib=opencv_imgproc cargo:rustc-link-lib=opencv_ml cargo:rustc-link-lib=opencv_objdetect cargo:rustc-link-lib=opencv_photo cargo:rustc-link-lib=opencv_shape cargo:rustc-link-lib=opencv_stitching cargo:rustc-link-lib=opencv_superres cargo:rustc-link-lib=opencv_video cargo:rustc-link-lib=opencv_videoio cargo:rustc-link-lib=opencv_videostab cargo:rustc-link-search=native=/usr/local/share/OpenCV/3rdparty/lib OpenCV lives in "/usr/local/include/opencv2" Generating code in "/home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out" Generating module 'calib3d' from headers: /usr/local/include/opencv2/calib3d.hpp /usr/local/include/opencv2/calib3d/calib3d.hpp /usr/local/include/opencv2/calib3d/calib3d_c.h Generating module 'core' from headers: /usr/local/include/opencv2/core.hpp /usr/local/include/opencv2/core/affine.hpp /usr/local/include/opencv2/core/base.hpp /usr/local/include/opencv2/core/bufferpool.hpp /usr/local/include/opencv2/core/core.hpp /usr/local/include/opencv2/core/core_c.h /usr/local/include/opencv2/core/cvdef.h /usr/local/include/opencv2/core/devmem2d.hpp /usr/local/include/opencv2/core/directx.hpp /usr/local/include/opencv2/core/fast_math.hpp /usr/local/include/opencv2/core/gpumat.hpp /usr/local/include/opencv2/core/hal/hal.hpp /usr/local/include/opencv2/core/hal/interface.h /usr/local/include/opencv2/core/hal/intrin.hpp /usr/local/include/opencv2/core/internal.hpp /usr/local/include/opencv2/core/mat.hpp /usr/local/include/opencv2/core/matx.hpp /usr/local/include/opencv2/core/neon_utils.hpp /usr/local/include/opencv2/core/opengl_interop.hpp /usr/local/include/opencv2/core/opengl_interop_deprecated.hpp /usr/local/include/opencv2/core/optim.hpp /usr/local/include/opencv2/core/ptr.inl.hpp /usr/local/include/opencv2/core/saturate.hpp /usr/local/include/opencv2/core/sse_utils.hpp /usr/local/include/opencv2/core/traits.hpp /usr/local/include/opencv2/core/types.hpp /usr/local/include/opencv2/core/types_c.h /usr/local/include/opencv2/core/utility.hpp /usr/local/include/opencv2/core/va_intel.hpp /usr/local/include/opencv2/core/version.hpp /usr/local/include/opencv2/core/wimage.hpp Generating module 'features2d' from headers: /usr/local/include/opencv2/features2d.hpp /usr/local/include/opencv2/features2d/features2d.hpp Generating module 'highgui' from headers: /usr/local/include/opencv2/highgui.hpp /usr/local/include/opencv2/highgui/highgui.hpp /usr/local/include/opencv2/highgui/highgui_c.h Generating module 'imgcodecs' from headers: /usr/local/include/opencv2/imgcodecs.hpp /usr/local/include/opencv2/imgcodecs/imgcodecs.hpp /usr/local/include/opencv2/imgcodecs/imgcodecs_c.h Generating module 'imgproc' from headers: /usr/local/include/opencv2/imgproc.hpp /usr/local/include/opencv2/imgproc/imgproc.hpp /usr/local/include/opencv2/imgproc/imgproc_c.h /usr/local/include/opencv2/imgproc/types_c.h Generating module 'ml' from headers: /usr/local/include/opencv2/ml.hpp /usr/local/include/opencv2/ml/ml.hpp Generating module 'objdetect' from headers: /usr/local/include/opencv2/objdetect.hpp /usr/local/include/opencv2/objdetect/detection_based_tracker.hpp /usr/local/include/opencv2/objdetect/objdetect.hpp /usr/local/include/opencv2/objdetect/objdetect_c.h Generating module 'photo' from headers: /usr/local/include/opencv2/photo.hpp /usr/local/include/opencv2/photo/photo.hpp /usr/local/include/opencv2/photo/photo_c.h Generating module 'shape' from headers: /usr/local/include/opencv2/shape.hpp /usr/local/include/opencv2/shape/emdL1.hpp /usr/local/include/opencv2/shape/hist_cost.hpp /usr/local/include/opencv2/shape/shape.hpp /usr/local/include/opencv2/shape/shape_distance.hpp /usr/local/include/opencv2/shape/shape_transformer.hpp Generating module 'stitching' from headers: /usr/local/include/opencv2/stitching.hpp /usr/local/include/opencv2/stitching/stitcher.hpp /usr/local/include/opencv2/stitching/warpers.hpp Generating module 'superres' from headers: /usr/local/include/opencv2/superres.hpp Generating module 'video' from headers: /usr/local/include/opencv2/video.hpp /usr/local/include/opencv2/video/background_segm.hpp /usr/local/include/opencv2/video/tracking.hpp /usr/local/include/opencv2/video/tracking_c.h /usr/local/include/opencv2/video/video.hpp Generating module 'videoio' from headers: /usr/local/include/opencv2/videoio.hpp /usr/local/include/opencv2/videoio/videoio.hpp /usr/local/include/opencv2/videoio/videoio_c.h Generating module 'videostab' from headers: /usr/local/include/opencv2/videostab.hpp /usr/local/include/opencv2/videostab/deblurring.hpp /usr/local/include/opencv2/videostab/fast_marching.hpp /usr/local/include/opencv2/videostab/fast_marching_inl.hpp /usr/local/include/opencv2/videostab/frame_source.hpp /usr/local/include/opencv2/videostab/global_motion.hpp /usr/local/include/opencv2/videostab/inpainting.hpp /usr/local/include/opencv2/videostab/log.hpp /usr/local/include/opencv2/videostab/motion_core.hpp /usr/local/include/opencv2/videostab/motion_stabilizing.hpp /usr/local/include/opencv2/videostab/optical_flow.hpp /usr/local/include/opencv2/videostab/outlier_rejection.hpp /usr/local/include/opencv2/videostab/ring_buffer.hpp /usr/local/include/opencv2/videostab/stabilizer.hpp /usr/local/include/opencv2/videostab/videostab.hpp /usr/local/include/opencv2/videostab/wobble_suppression.hpp TARGET = Some("x86_64-unknown-linux-gnu") OPT_LEVEL = Some("0") PROFILE = Some("debug") TARGET = Some("x86_64-unknown-linux-gnu") debug=true opt-level=0 HOST = Some("x86_64-unknown-linux-gnu") TARGET = Some("x86_64-unknown-linux-gnu") TARGET = Some("x86_64-unknown-linux-gnu") HOST = Some("x86_64-unknown-linux-gnu") CXX_x86_64-unknown-linux-gnu = None CXX_x86_64_unknown_linux_gnu = None HOST_CXX = None CXX = None HOST = Some("x86_64-unknown-linux-gnu") TARGET = Some("x86_64-unknown-linux-gnu") HOST = Some("x86_64-unknown-linux-gnu") CXXFLAGS_x86_64-unknown-linux-gnu = None CXXFLAGS_x86_64_unknown_linux_gnu = None HOST_CXXFLAGS = None CXXFLAGS = None running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-I" "/usr/local/include/opencv" "-I" "/usr/local/include" "-I" "." "-I" "/home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out" "-std=c++0x" "-Wno-c++11-extensions" "-o" "/home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out/calib3d.o" "-c" "/home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out/calib3d.cpp" ExitStatus(ExitStatus(0)) TARGET = Some("x86_64-unknown-linux-gnu") OPT_LEVEL = Some("0") PROFILE = Some("debug") TARGET = Some("x86_64-unknown-linux-gnu") debug=true opt-level=0 HOST = Some("x86_64-unknown-linux-gnu") TARGET = Some("x86_64-unknown-linux-gnu") TARGET = Some("x86_64-unknown-linux-gnu") HOST = Some("x86_64-unknown-linux-gnu") CXX_x86_64-unknown-linux-gnu = None CXX_x86_64_unknown_linux_gnu = None HOST_CXX = None CXX = None HOST = Some("x86_64-unknown-linux-gnu") TARGET = Some("x86_64-unknown-linux-gnu") HOST = Some("x86_64-unknown-linux-gnu") CXXFLAGS_x86_64-unknown-linux-gnu = None CXXFLAGS_x86_64_unknown_linux_gnu = None HOST_CXXFLAGS = None CXXFLAGS = None running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-I" "/usr/local/include/opencv" "-I" "/usr/local/include" "-I" "." "-I" "/home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out" "-std=c++0x" "-Wno-c++11-extensions" "-o" "/home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out/core.o" "-c" "/home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out/core.cpp" ExitStatus(ExitStatus(256))

command did not execute successfully, got: exit code: 1

--- stderr In file included from /usr/local/include/opencv2/core/opengl_interop.hpp:49:0, from /home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out/core.cpp:36: /usr/local/include/opencv2/core/opengl_interop_deprecated.hpp:116:61: error: no member function ���delete_obj��� declared in ���cv::Ptrcv::GlBuffer::Impl��� template <> CV_EXPORTS void PtrGlBuffer::Impl::delete_obj(); ^ /usr/local/include/opencv2/core/opengl_interop_deprecated.hpp:163:62: error: no member function ���delete_obj��� declared in ���cv::Ptrcv::GlTexture::Impl��� template <> CV_EXPORTS void PtrGlTexture::Impl::delete_obj(); ^ In file included from /home/hosinokakera/rust-opencv3-gen/opencv-rust/target/debug/build/opencv-6d5895f3f368618d/out/core.cpp:36:0: /usr/local/include/opencv2/core/opengl_interop.hpp:277:68: error: no member function ���delete_obj��� declared in ���cv::Ptrcv::ogl::Buffer::Impl��� template <> CV_EXPORTS void Ptrcv::ogl::Buffer::Impl::delete_obj(); ^ /usr/local/include/opencv2/core/opengl_interop.hpp:278:71: error: no member function ���delete_obj��� declared in ���cv::Ptrcv::ogl::Texture2D::Impl��� template <> CV_EXPORTS void Ptrcv::ogl::Texture2D::Impl::delete_obj(); ^ cc1plus: warning: unrecognized command line option "-Wno-c++11-extensions" [enabled by default] thread '

' panicked at 'explicit panic', /home/hosinokakera/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.32/src/lib.rs:848 stack backtrace: 1: 0x7f3ea9ce99ef - std::sys::backtrace::tracing::imp::write::h3800f45f421043b8 2: 0x7f3ea9cf0ddb - std::panicking::defaulthook::$u7b$$u7b$closure$u7d$$u7d$::h0ef6c8db532f55dc 3: 0x7f3ea9cf0a63 - std::panicking::default_hook::hf3839060ccbb8764 4: 0x7f3ea9cdd20d - std::panicking::rust_panic_with_hook::h5dd7da6bb3d06020 5: 0x7f3ea9cbfd57 - std::panicking::begin_panic::h4c14e704ed94392f at ../src/libstd/panicking.rs:328 6: 0x7f3ea9cd01cc - gcc::fail::h5ecbb3456ddb1cb0 at /home/hosinokakera/rust-opencv3-gen/opencv-rust/:3 7: 0x7f3ea9ccb788 - gcc::run::h4124f2926caf9123 at /home/hosinokakera/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.32/src/lib.rs:842 8: 0x7f3ea9cc1133 - gcc::Config::compile_object::h7d7ba4cc57f9edad at /home/hosinokakera/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.32/src/lib.rs:380 9: 0x7f3ea9cbe494 - gcc::Config::compile::ha7334c665d0bc8aa at /home/hosinokakera/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.32/src/lib.rs:335 10: 0x7f3ea9c78133 - build_script_build::main::he5071e1b00fcfe0e at /home/hosinokakera/rust-opencv3-gen/opencv-rust/build.rs:136 11: 0x7f3ea9cf06a8 - std::panicking::try::call::hbbf4746cba890ca7 12: 0x7f3ea9cfadbb - __rust_try 13: 0x7f3ea9cfad5e - rust_maybe_catch_panic 14: 0x7f3ea9cf014e - std::rt::lang_start::hbcefdc316c2fbd45 15: 0x7f3ea9c8f999 - main 16: 0x7f3ea9069f44 - libc_start_main 17: 0x7f3ea9c75a38 - 18: 0x0 -

ho@ho:~/rust-opencv3-gen/opencv-rust$ ====================== End ========================

fuine commented 7 years ago

@kali has the situation changed? Is there any way in which I could help you releasing opencv3 support? I'm quite interested in it.

kali commented 7 years ago

@fuine I have given up. I don't think it is worth trying to provide systematically a clean, rusty, and safe interface for opencv. The C++ interface is too feature rich, and each different module of opencv uses its own different subset of features in its interface.

On top of that, I no longer have any use for the bindings, the project I had in mind at the time is gone.

To be honest, if I needed to use opencv in a rust project today, I would just bind exactly what I need in an ad-hoc fashion. Note that the cpp crate offers an enhanced workflow for the tedious work of writting C functions that both languages will understand.

mengu commented 6 years ago

@kali so we can call this a dead project?

kali commented 6 years ago

Well, that, or dormant, yeah. I have no more time to devote to it, and honestly grew sick of it.

On Thu, Jan 4, 2018, at 17:11, Mengu Kagan wrote:

@kali[1] so we can call this a dead project?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub[2], or mute the thread[3].>

Links:

  1. https://github.com/kali
  2. https://github.com/kali/opencv-rust/issues/10#issuecomment-355323661
  3. https://github.com/notifications/unsubscribe-auth/AADRmR39rlQZw719u8ZkYx76RgTbeB8Nks5tHPghgaJpZM4GeRL_
dralley commented 6 years ago

@kali , would you consider adding @fuine as an owner on the crate so that they could continue development on their own?

edit: confused fuine with mengu

kali commented 6 years ago

I will definitely consider sharing the project ownership, or even giving it away to anybody showing interest and motivation through actual code and PRs :)

twistedfall commented 5 years ago

I've implemented opencv-3.4.5 support and it's been merged to master, also crate version 0.3.0 has been published, please test.