GithubHelp home page GithubHelp logo

opencv-rust's People

Contributors

41leahcim avatar aaqidmasoodi avatar ajyoon avatar carbotaniuman avatar cattleprodigy avatar dependabot-preview[bot] avatar dependabot[bot] avatar dralley avatar flisky avatar foxzool avatar fzyzcjy avatar gfgafn avatar gyk avatar hexjazzpycom avatar higumachan avatar icedrocket avatar jerry73204 avatar kali avatar kino-ma avatar nobodyxu avatar nsabovic avatar oli-obk avatar ostrosco avatar phdoerfler avatar philsuess avatar ppakalns avatar sebasgarcep avatar sjbeskur avatar twistedfall avatar wada314 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opencv-rust's Issues

Improvement wishlist

Here are some things I would like to see as a user of opencv-rust:

  • Pull out the doxygen documentation into rustdoc. This would be the single largest usability improvement.
  • Put constants into a module called e.g. consts and then pub use consts::* in the parent module. This will keep rustdoc clean and easier to navigate.
  • Get rid of the sys:: intermediate module. Since the main source of documentation is OpenCV itself, most of the things users will care about are inside the sys:: hierarchy anyway, making it pointless. (I assume that the point of it was to mimic the xxx-rust-sys bindings; to separate the "raw" bindings from "high-level" API.)
  • Get rid of user-exposed, autogenerated VectorOfwhatever. Instead, add a single trait Vector<T> and implement it for whatever vector types are required.
  • Put nonspecific types like Mat and Size and Vector under opencv.
  • Do something that would mollify autocompletion engines such as racer. (This might also be a Racer deficiency, not opencv-rust).
  • Don't return Result from functions that cannot raise (is it even in OpenCV docs?)

As a developer:

  • Don't use include! when building. It would be much more convenient to have an actual module hierarchy that makes sense. It shouldn't even be too hard to do, just group the file contents by the output module name / filename.
  • Unindent templated code using Python's textwrap.dedent.
  • Refactor the horror that gen_rust.py is, somehow, please...

Consider removing unnecessary result return

I noticed bunch of trivial methods have result return types that are barely due to ffi or barely end in error. For example, the Mat::size, Mat::rows and Mat::cols. I think it can simply panic if it's due to implementation error.

In my opinion, we can look at tch::Tensor's approach. It's a crate that ports libtorch to rust. It generates a series of methods named f_METHOD(), indicating a fallible method, along with METHOD() that wraps around the former. For example, add() always return the value of f_add() and panics if f_add() fails.

EDIT:
Plus that we can add a fallible f_clone() and implement Clone trait for Mat. I would give us some convenience in the case that I can derive Clone on struct with a Mat field.

Cargo.toml updates?

Hi there @twistedfall -- I'm glad to see that you've adopted this crate as I'm interested in using it (and hopefully contributing back any fixes that I can come up with).

There was some agreement here about switching the license to MIT.

This is just a quick ping about updating the Cargo.toml sometime with the new license (and owner and repo, etc.).

cascadedetect.cpp runtime panic on macOS

The latest OpenCV 3 in Homebrew is 3.4.5, so I have that installed. Part of the install process involved setting the following environment variables, so I have done that.

export PKG_CONFIG_PATH="/usr/local/opt/opencv@3/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/opencv@3/lib"
export CPPFLAGS="-I/usr/local/opt/opencv@3/include"
export PATH="/usr/local/opt/opencv@3/bin:$PATH"

Trying to run the video_facedetect example, I get this output:

$ cargo run --example video_facedetect
   Compiling opencv v0.15.2 (/Users/benjamin.bergman/tasks/ododowa/opencv-rust)
warning: trait objects without an explicit `dyn` are deprecated
    --> src/hub/core.rs:2691:50
     |
2691 | pub fn parallel_for_(range: &core::Range, body: &core::ParallelLoopBody, nstripes: f64) -> Result<()> {
     |                                                  ^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn core::ParallelLoopBody`
     |
     = note: #[warn(bare_trait_objects)] on by default

    Finished dev [unoptimized + debuginfo] target(s) in 45.89s
     Running `target/debug/examples/video_facedetect`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -215, message: "OpenCV(3.4.5) /tmp/opencv@3-20190505-97953-1nkl1lm/opencv-3.4.5/modules/objdetect/src/cascadedetect.cpp:1698: error: (-215:Assertion failed) !empty() in function \'detectMultiScale\'\n" }', src/libcore/result.rs:999:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
cargo run --example video_facedetect  93.72s user 7.61s system 209% cpu 48.483 total

This was run on macOS 10.14.5.

I have tried with Rust 1.37.0-nightly (807429e1b 2019-06-11) and 1.35.0 (3c235d560 2019-05-20)

draw_contours failed and assert / debian / opencv 3.2

calling imgproc::draw_contours failed and assert

OpenCV Error: Assertion failed (0 <= i && i < (int)v.size()) in getMat_, file /build/opencv-ytxPbe/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp, line 1253
[KO] draw contours: /build/opencv-ytxPbe/opencv-3.2.0+dfsg/modules/core/src/matrix.cpp:1253: error: (-215) 0 <= i && i < (int)v.size() in function getMat_
 (code: -215)

here, I guess, the revelant part of code for reproducing .

    let filename = String::from("some_nice_image.jpg");

    let in_image = match imgcodecs::imread(&filename, imgcodecs::IMREAD_COLOR) {
        Ok(ok) => ok ,
        Err(error) => {
            panic!("Fatal ERROR reading the image : {}. Is this file exist? Have you the right to read it? Is it empty? . Error : {:?}", filename, error)
        },
    };

    let mut gray_image = in_image.clone().unwrap();
    imgproc::cvt_color(&in_image, &mut gray_image, imgproc::COLOR_BGR2GRAY, 1).unwrap();
    //TODO error check on convert
    let _result = opencv::highgui::imshow (window_name, &gray_image);
    let _result = match _result {
        Ok(ok) => ok ,
        Err(error) => {
            panic!("Problem showing gray image {:?}", error)
        },
    };
    let _key = opencv::highgui::wait_key(0);

    let mut thresh_image = gray_image.clone().unwrap();
    imgproc::threshold(&gray_image, &mut thresh_image, 60.0, 255.0, imgproc::THRESH_BINARY).unwrap();
    //TODO error check on threshold
    let _result = opencv::highgui::imshow (window_name, &thresh_image);
    let _result = match _result {
        Ok(ok) => ok ,
        Err(error) => {
            panic!("Problem showing binary thresh image {:?}", error)
        },
    };
    let _key = opencv::highgui::wait_key(0);

    let zero_offset = core::Point::new(0, 0);
    let mut vec = types::VectorOfMat::new(); //findContours accepts VECTOR of Mat|UMat|Vector
    match imgproc::find_contours(&mut thresh_image, &mut vec, 3, 2, zero_offset) {
        Ok(_ok) => {
            println!("[OK] find contours");
        },
        Err(error) => {
            println!("[KO] find contours: {}", error);
        }
    };

    println!("CONTOURS INFO: empty? : {} , lenght {}", vec.is_empty(), vec.len()); // FIXME ISSUE :? :#? debug trait not implemented

    let idx:i32 = 0;
    let thickness:i32 = 4;
    const WHITE_COLOR: f64 = 255 as f64;
    let color = core::Scalar::new(WHITE_COLOR, WHITE_COLOR, WHITE_COLOR, WHITE_COLOR);
    let zero_offset = core::Point::new(0, 0);
    let maxresult:i32 = 0;
    let hierachy = types::VectorOfMat::new();
    //~ let empty_mat = core::Mat::default().unwrap();
    //~ hierachy.push(empty_mat);

    let mut ctr_image = in_image.clone().unwrap();

    println!("HIERACHY INFO: empty? : {} , lenght {}", hierachy.is_empty(), hierachy.len()); // FIXME ISSUE :? :#? debug trait not implemented

    match imgproc::draw_contours(&mut ctr_image, &vec, idx, 
                           color, thickness, core::LINE_AA, &hierachy, maxresult, zero_offset){
        Ok(_ok) => {
            println!("[OK] draw contours");
        },
        Err(error) => {
            println!("[KO] draw contours: {}", error);
        }
    };
    let _result = highgui::imshow (window_name, &ctr_image);

SysInfo

[dependencies]
opencv = {version = "0.26.5", default-features = false, features = ["opencv-32"]}
$ opencv_version 
3.2.0

$ cat /etc/debian_version 
10.2

Fails to compile and doesn't generate a useful error message

My platform is Fedora 30 with OpenCV 3.4.4, gcc 9.1.1 and I'm using the latest git revision b44eaa1. This is what happens when I try to build the library:

[dalley@localhost opencv-rust]$ cargo build
   Compiling opencv v0.11.0 (/home/dalley/Devel/opencv-rust)
error: failed to run custom build command for `opencv v0.11.0 (/home/dalley/Devel/opencv-rust)`
process didn't exit successfully: `/home/dalley/Devel/opencv-rust/target/debug/build/opencv-4f0dc15973bad0e9/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/usr/lib64
cargo:rustc-link-lib=opencv_shape
cargo:rustc-link-lib=opencv_stitching
cargo:rustc-link-lib=opencv_superres
cargo:rustc-link-lib=opencv_videostab
cargo:rustc-link-lib=opencv_aruco
cargo:rustc-link-lib=opencv_bgsegm
cargo:rustc-link-lib=opencv_bioinspired
cargo:rustc-link-lib=opencv_ccalib
cargo:rustc-link-lib=opencv_cvv
cargo:rustc-link-lib=opencv_dnn_objdetect
cargo:rustc-link-lib=opencv_dpm
cargo:rustc-link-lib=opencv_face
cargo:rustc-link-lib=opencv_photo
cargo:rustc-link-lib=opencv_freetype
cargo:rustc-link-lib=opencv_fuzzy
cargo:rustc-link-lib=opencv_hdf
cargo:rustc-link-lib=opencv_hfs
cargo:rustc-link-lib=opencv_img_hash
cargo:rustc-link-lib=opencv_line_descriptor
cargo:rustc-link-lib=opencv_optflow
cargo:rustc-link-lib=opencv_reg
cargo:rustc-link-lib=opencv_rgbd
cargo:rustc-link-lib=opencv_saliency
cargo:rustc-link-lib=opencv_stereo
cargo:rustc-link-lib=opencv_structured_light
cargo:rustc-link-lib=opencv_viz
cargo:rustc-link-lib=opencv_phase_unwrapping
cargo:rustc-link-lib=opencv_surface_matching
cargo:rustc-link-lib=opencv_tracking
cargo:rustc-link-lib=opencv_datasets
cargo:rustc-link-lib=opencv_text
cargo:rustc-link-lib=opencv_dnn
cargo:rustc-link-lib=opencv_video
cargo:rustc-link-lib=opencv_plot
cargo:rustc-link-lib=opencv_ml
cargo:rustc-link-lib=opencv_ximgproc
cargo:rustc-link-lib=opencv_xobjdetect
cargo:rustc-link-lib=opencv_objdetect
cargo:rustc-link-lib=opencv_calib3d
cargo:rustc-link-lib=opencv_features2d
cargo:rustc-link-lib=opencv_highgui
cargo:rustc-link-lib=opencv_videoio
cargo:rustc-link-lib=opencv_imgcodecs
cargo:rustc-link-lib=opencv_flann
cargo:rustc-link-lib=opencv_xphoto
cargo:rustc-link-lib=opencv_imgproc
cargo:rustc-link-lib=opencv_core
cargo:rustc-link-search=native=/usr/share/OpenCV/3rdparty/lib
cargo:rustc-link-search=native=/usr/lib64
cargo:rerun-if-changed=hdr_parser.py
cargo:rerun-if-changed=gen_rust.py
OpenCV lives in /usr/include/opencv2
Generating code in /home/dalley/Devel/opencv-rust/target/debug/build/opencv-76036d7842db50fa/out
Generating module 'core_detect' from headers:
	/usr/include/opencv2/core_detect.hpp
Error at /usr/include/opencv2/core_detect.hpp:27
Generating module 'cvv' from headers:
	/usr/include/opencv2/cvv.hpp
	/usr/include/opencv2/cvv/call_meta_data.hpp
	/usr/include/opencv2/cvv/cvv.hpp
	/usr/include/opencv2/cvv/debug_mode.hpp
	/usr/include/opencv2/cvv/dmatch.hpp
	/usr/include/opencv2/cvv/filter.hpp
	/usr/include/opencv2/cvv/final_show.hpp
	/usr/include/opencv2/cvv/show_image.hpp
Generating module 'face' from headers:
	/usr/include/opencv2/face.hpp
	/usr/include/opencv2/face/bif.hpp
	/usr/include/opencv2/face/face_alignment.hpp
	/usr/include/opencv2/face/facemark.hpp
	/usr/include/opencv2/face/facemarkAAM.hpp
	/usr/include/opencv2/face/facemarkLBF.hpp
	/usr/include/opencv2/face/facemark_train.hpp
	/usr/include/opencv2/face/facerec.hpp
	/usr/include/opencv2/face/mace.hpp
	/usr/include/opencv2/face/predict_collector.hpp
Generating module 'dnn' from headers:
	/usr/include/opencv2/dnn.hpp
	/usr/include/opencv2/dnn/all_layers.hpp
	/usr/include/opencv2/dnn/dict.hpp
	/usr/include/opencv2/dnn/dnn.hpp
	/usr/include/opencv2/dnn/layer.hpp
	/usr/include/opencv2/dnn/shape_utils.hpp
Generating module 'features2d' from headers:
	/usr/include/opencv2/features2d.hpp
	/usr/include/opencv2/features2d/features2d.hpp
	/usr/include/opencv2/features2d/hal/interface.h
Generating module 'imgproc' from headers:
	/usr/include/opencv2/imgproc.hpp
	/usr/include/opencv2/imgproc/hal/interface.h
	/usr/include/opencv2/imgproc/imgproc.hpp
Generating module 'dpm' from headers:
	/usr/include/opencv2/dpm.hpp
Generating module 'freetype' from headers:
	/usr/include/opencv2/freetype.hpp
Generating module 'line_descriptor' from headers:
	/usr/include/opencv2/line_descriptor.hpp
	/usr/include/opencv2/line_descriptor/descriptor.hpp
Generating module 'fuzzy' from headers:
	/usr/include/opencv2/fuzzy.hpp
	/usr/include/opencv2/fuzzy/fuzzy_F0_math.hpp
	/usr/include/opencv2/fuzzy/fuzzy_F1_math.hpp
	/usr/include/opencv2/fuzzy/fuzzy_image.hpp
	/usr/include/opencv2/fuzzy/types.hpp
Generating module 'hdf' from headers:
	/usr/include/opencv2/hdf.hpp
	/usr/include/opencv2/hdf/hdf5.hpp
Generating module 'shape' from headers:
	/usr/include/opencv2/shape.hpp
	/usr/include/opencv2/shape/emdL1.hpp
	/usr/include/opencv2/shape/hist_cost.hpp
	/usr/include/opencv2/shape/shape.hpp
	/usr/include/opencv2/shape/shape_distance.hpp
	/usr/include/opencv2/shape/shape_transformer.hpp
Generating module 'highgui' from headers:
	/usr/include/opencv2/highgui.hpp
	/usr/include/opencv2/highgui/highgui.hpp
Generating module 'stitching' from headers:
	/usr/include/opencv2/stitching.hpp
	/usr/include/opencv2/stitching/warpers.hpp
Generating module 'img_hash' from headers:
	/usr/include/opencv2/img_hash.hpp
	/usr/include/opencv2/img_hash/average_hash.hpp
	/usr/include/opencv2/img_hash/block_mean_hash.hpp
	/usr/include/opencv2/img_hash/color_moment_hash.hpp
	/usr/include/opencv2/img_hash/img_hash_base.hpp
	/usr/include/opencv2/img_hash/marr_hildreth_hash.hpp
	/usr/include/opencv2/img_hash/phash.hpp
	/usr/include/opencv2/img_hash/radial_variance_hash.hpp
Generating module 'ml' from headers:
	/usr/include/opencv2/ml.hpp
	/usr/include/opencv2/ml/ml.hpp
Generating module 'structured_light' from headers:
	/usr/include/opencv2/structured_light.hpp
	/usr/include/opencv2/structured_light/graycodepattern.hpp
	/usr/include/opencv2/structured_light/sinusoidalpattern.hpp
	/usr/include/opencv2/structured_light/structured_light.hpp
Generating module 'imgcodecs' from headers:
	/usr/include/opencv2/imgcodecs.hpp
	/usr/include/opencv2/imgcodecs/imgcodecs.hpp
Generating module 'phase_unwrapping' from headers:
	/usr/include/opencv2/phase_unwrapping.hpp
	/usr/include/opencv2/phase_unwrapping/histogramphaseunwrapping.hpp
	/usr/include/opencv2/phase_unwrapping/phase_unwrapping.hpp
Generating module 'superres' from headers:
	/usr/include/opencv2/superres.hpp
Generating module 'objdetect' from headers:
	/usr/include/opencv2/objdetect.hpp
	/usr/include/opencv2/objdetect/detection_based_tracker.hpp
	/usr/include/opencv2/objdetect/objdetect.hpp
Generating module 'photo' from headers:
	/usr/include/opencv2/photo.hpp
	/usr/include/opencv2/photo/photo.hpp
Generating module 'plot' from headers:
	/usr/include/opencv2/plot.hpp
Generating module 'text' from headers:
	/usr/include/opencv2/text.hpp
	/usr/include/opencv2/text/erfilter.hpp
	/usr/include/opencv2/text/ocr.hpp
	/usr/include/opencv2/text/textDetector.hpp
Generating module 'saliency' from headers:
	/usr/include/opencv2/saliency.hpp
	/usr/include/opencv2/saliency/saliencyBaseClasses.hpp
	/usr/include/opencv2/saliency/saliencySpecializedClasses.hpp
Generating module 'videoio' from headers:
	/usr/include/opencv2/videoio.hpp
	/usr/include/opencv2/videoio/registry.hpp
	/usr/include/opencv2/videoio/videoio.hpp
Generating module 'video' from headers:
	/usr/include/opencv2/video.hpp
	/usr/include/opencv2/video/background_segm.hpp
	/usr/include/opencv2/video/tracking.hpp
	/usr/include/opencv2/video/video.hpp
Generating module 'core' from headers:
	/usr/include/opencv2/core.hpp
	/usr/include/opencv2/core/affine.hpp
	/usr/include/opencv2/core/base.hpp
	/usr/include/opencv2/core/bindings_utils.hpp
	/usr/include/opencv2/core/bufferpool.hpp
	/usr/include/opencv2/core/check.hpp
	/usr/include/opencv2/core/core.hpp
	/usr/include/opencv2/core/cv_cpu_helper.h
	/usr/include/opencv2/core/cvdef.h
	/usr/include/opencv2/core/directx.hpp
	/usr/include/opencv2/core/hal/interface.h
	/usr/include/opencv2/core/mat.hpp
	/usr/include/opencv2/core/matx.hpp
	/usr/include/opencv2/core/neon_utils.hpp
	/usr/include/opencv2/core/optim.hpp
	/usr/include/opencv2/core/ovx.hpp
	/usr/include/opencv2/core/saturate.hpp
	/usr/include/opencv2/core/softfloat.hpp
	/usr/include/opencv2/core/sse_utils.hpp
	/usr/include/opencv2/core/traits.hpp
	/usr/include/opencv2/core/types.hpp
	/usr/include/opencv2/core/utility.hpp
	/usr/include/opencv2/core/utils/filesystem.hpp
	/usr/include/opencv2/core/utils/logger.defines.hpp
	/usr/include/opencv2/core/utils/logger.hpp
	/usr/include/opencv2/core/va_intel.hpp
	/usr/include/opencv2/core/version.hpp
	/usr/include/opencv2/core/vsx_utils.hpp
	/usr/include/opencv2/core/wimage.hpp
Generating module 'bioinspired' from headers:
	/usr/include/opencv2/bioinspired.hpp
	/usr/include/opencv2/bioinspired/bioinspired.hpp
	/usr/include/opencv2/bioinspired/retina.hpp
	/usr/include/opencv2/bioinspired/retinafasttonemapping.hpp
	/usr/include/opencv2/bioinspired/transientareassegmentationmodule.hpp
Generating module 'ccalib' from headers:
	/usr/include/opencv2/ccalib.hpp
	/usr/include/opencv2/ccalib/multicalib.hpp
	/usr/include/opencv2/ccalib/omnidir.hpp
	/usr/include/opencv2/ccalib/randpattern.hpp
Generating module 'videostab' from headers:
	/usr/include/opencv2/videostab.hpp
	/usr/include/opencv2/videostab/deblurring.hpp
	/usr/include/opencv2/videostab/fast_marching.hpp
	/usr/include/opencv2/videostab/fast_marching_inl.hpp
	/usr/include/opencv2/videostab/frame_source.hpp
	/usr/include/opencv2/videostab/global_motion.hpp
	/usr/include/opencv2/videostab/inpainting.hpp
	/usr/include/opencv2/videostab/log.hpp
	/usr/include/opencv2/videostab/motion_core.hpp
	/usr/include/opencv2/videostab/motion_stabilizing.hpp
	/usr/include/opencv2/videostab/optical_flow.hpp
	/usr/include/opencv2/videostab/outlier_rejection.hpp
	/usr/include/opencv2/videostab/ring_buffer.hpp
	/usr/include/opencv2/videostab/stabilizer.hpp
	/usr/include/opencv2/videostab/wobble_suppression.hpp
Generating module 'calib3d' from headers:
	/usr/include/opencv2/calib3d.hpp
	/usr/include/opencv2/calib3d/calib3d.hpp
Generating module 'viz' from headers:
	/usr/include/opencv2/viz.hpp
	/usr/include/opencv2/viz/types.hpp
	/usr/include/opencv2/viz/viz3d.hpp
	/usr/include/opencv2/viz/vizcore.hpp
	/usr/include/opencv2/viz/widget_accessor.hpp
	/usr/include/opencv2/viz/widgets.hpp

--- stderr
thread '<unnamed>' panicked at 'explicit panic', build.rs:199:13
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

It fails on a bare panic and doesn't provide any useful information about what went wrong.

edit: So, I downloaded the OpenCV 3.4.6 tarball, compiled that with the options that are in the .travis config, and then tried again. It did work this time. However I'd still kind of like to know if there's a problem with Fedora's opencv-devel package or if this can be fixed to work with that.

edit2: It looks like core_objdetect.hpp is part of opencv_contrib

setMouseCallback from HighGui is missing

Dear all,

I just noticed that the setMouseCallback function is not available in the Rust bindings, probably because of its function pointer argument. Since I would consider this a rather important function to have I thought I'd report it here and ask if you think it is possible to add this to the bindings?

Thanks,
Michael

Convert Python scripts to Python 3

This isn't an issue in and of itself, but linux distributions are going to start dropping Python 2 over the course of the next 18 months which will make this more difficult to compile. I'd be willing to work on this myself but only if I know the PRs wouldn't be rejected, as some people have strong feelings about it.

Expose `aruco` module

My the looks of the library, aruco isn't available, and is explicitly ignored in build.rs. Is there a reason for this?

What would be required to expose the aruco OpenCV module?

I'm definitely happy to help test this!

Link error while building on Windows

Hello there, I'm encountering an error while trying to build opencv = {version = "0.24.5", default-features = false, features = ["opencv-41", "buildtime-bindgen"]} on Windows with the suggested environment variables.

Here's that error:

error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.14fbwp9wfczr4lrm.rcgu.o" "D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.1oeylic2ccszagg0.rcgu.o" "D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.3a6y7s2wqp1nkhlo.rcgu.o" "D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.3dbsph93yihankc8.rcgu.o" "D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.50nc50dulfdg8e2e.rcgu.o" "D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.5botmstpj0b4hxk4.rcgu.o" "D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.966r1upqsysg8sm.rcgu.o" "/OUT:D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.exe" "D:\\Git\\toonfish\\target\\debug\\deps\\toonfish.4dsp84ed06uti2eb.rcgu.o" "/OPT:REF,NOICF" 
"/DEBUG" "/NATVIS:C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:D:\\Git\\toonfish\\target\\debug\\deps" "/LIBPATH:D:\\Git\\toonfish\\target\\debug\\build\\opencv-51cfe1331c65ee8c\\out" "/LIBPATH:D:\\OpenCV\\build\\x64\\vc14\\lib" "/LIBPATH:D:\\Git\\toonfish\\target\\debug\\build\\opencv-51cfe1331c65ee8c\\out" "/LIBPATH:C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\Git\\toonfish\\target\\debug\\deps\\libscrap-6fb5b0a62edbeed3.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libwinapi-bf08ae65de4518c6.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libcfg_if-af76bf5447c4b33d.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libopencv-0227b599a1a7f4a5.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libslab-ba76652ae6434093.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\liblazy_static-78f0258cdacfac46.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libnum-072536065608753c.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libnum_rational-302080e511cb6aad.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libnum_iter-776e5ab758163e5e.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libnum_complex-7e44487630133f86.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libnum_bigint-f7a4e9f30baad745.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libnum_integer-83c8439276e95286.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libnum_traits-880db1d3befbd7f4.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\liblibc-17ef0b4ff3f7910d.rlib" "D:\\Git\\toonfish\\target\\debug\\deps\\libcpp-e1df142f37e70443.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-e23fccb0a8b0ef4d.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-084692af5936cf7a.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-d384eae24131de71.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-6f4dd817315b8a2e.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libbacktrace-6705ac3c1c6fa52a.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-a713aa7f7e6f8b9c.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-722e47fd51e21662.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-d5ead5144bca211f.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-44b0c7d4e4124c1b.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-349ac95fc5d39ffb.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-734958cc1e87db6a.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-148ef0fa79c16b3f.rlib" "C:\\Users\\aemino\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-6fbdc4cdd29b327d.rlib" "dxgi.lib" "d3d11.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note: libopencv-0227b599a1a7f4a5.rlib(stitching.o) : error LNK2019: unresolved external symbol "struct cv::Ptr<class cv::Stitcher> __cdecl cv::createStitcher(bool)" (?createStitcher@cv@@YA?AU?$Ptr@VStitcher@cv@@@1@_N@Z) referenced in function cv_createStitcher_bool
          libopencv-0227b599a1a7f4a5.rlib(stitching.o) : error LNK2019: unresolved external symbol "struct cv::Ptr<class cv::Stitcher> __cdecl cv::createStitcherScans(bool)" (?createStitcherScans@cv@@YA?AU?$Ptr@VStitcher@cv@@@1@_N@Z) referenced in function cv_createStitcherScans_bool
          libopencv-0227b599a1a7f4a5.rlib(dnn.o) : error LNK2019: unresolved external symbol "public: __cdecl cv::dnn::dnn4_v20190621::BackendNode::BackendNode(int)" (??0BackendNode@dnn4_v2019062621@dnn@cv@@QEAA@H@Z) referenced in function cv_dnn_BackendNode_BackendNode_int
          D:\Git\toonfish\target\debug\deps\toonfish.exe : fatal error LNK1120: 3 unresolved externals

I noticed that @Weasy666 was also having this error despite not using the dnn or stitching modules. Using --release mode does only seems to get rid of the unresolved dnn external, not the two stitching ones for whatever reason.

Let me know if any other information would be useful.

Unable to send core::Mat in mpsc::Sender

I'm trying to send core::Mat in mpsc::Sender but I always get the error below. How can I workaround this issue?

error[E0277]: the trait bound *mut libc::c_void: std::marker::Send is not satisfied in opencv::core::Mat

let thread_camera_reader: thread::JoinHandle<Result<String,String>> = thread::spawn(move || {
                                                                              ^^^^^^^^^^^^^ *mut libc::c_void cannot be sent between threads safely

   = help: within opencv::core::Mat, the trait std::marker::Send is not implemented for *mut libc::c_void
   = note: required because it appears within the type opencv::core::Mat
   = note: required because of the requirements on the impl of std::marker::Send for std::sync::mpsc::Sender<opencv::core::Mat>
   = note: required because it appears within the type [closure@src/camera_reader/mod.rs:19:93: 69:10 index:i32, sender:std::sync::mpsc::Sender<opencv::core::Mat>]
   = note: required by std::thread::spawn```

ToInputArray on `no_array`?

There seems to be no way to use no_array as input to ToInputArray or ToOutputArray? At least, I would presume this should be possible?

How can I use in_range?

I'm trying to use opencv::core::in_range, like such...

let mut mask = Mat::default().unwrap();
opencv::core::in_range(&img, &lower_bound, &upper_bound, &mut mask).unwrap();

However, I would like lower_bound and upper_bound to be color values. Looking at the OpenCV documentation, it looks like I should pass in Scalars for these bounds. However, Scalar doesn't conform to ToInputArray, so I'm not sure how I can accomplish this.

Building inside official rust docker image

I'm trying to build a project inside a docker image and it is failing to compile. I'm having a lot of this errors:

UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 491: ordinal not in range(128)
Call stack:
  File "gen_rust.py", line 3428, in <module>
    main()
  File "gen_rust.py", line 3412, in main
    generator.gen(srcfiles, module, opencv_version, cpp_dir, rust_dir)
  File "gen_rust.py", line 2971, in gen
    logging.info("\n--- Incoming ---\n%s", pformat(decl, 4))
Message: '\n--- Incoming ---\n%s'
Arguments: ("[   'cv.softdouble.operator %',\n    'softdouble',\n    ['/C'],\n    [['const softdouble&', '', '', []]],\n    None,\n    '@brief Remainder operator\\n'\n    '\\n'\n    'A quote from original SoftFloat manual:\\n'\n    '\\n'\n    '> The IEEE Standard remainder operation computes the value\\n'\n    '> a - n * b, where n is the integer closest to a / b.\\n'\n    '> If a / b is exactly halfway between two integers, n is the even '\n    'integer\\n'\n    '> closest to a / b. The IEEE Standard\u2019s remainder operation is always '\n    'exact and so requires no rounding.\\n'\n    '> Depending on the relative magnitudes of the operands, the remainder '\n    'functions\\n'\n    '> can take considerably longer to execute than the other SoftFloat '\n    'functions.\\n'\n    '> This is an inherent characteristic of the remainder operation itself '\n    'and is not a flaw\\n'\n    '> in the SoftFloat implementation.']",)

Any idea what this could be?

Got a python error

--- stderr
/usr/lib/python3.5/re.py:203: FutureWarning: split() requires a non-empty pattern match.
  return _compile(pattern, flags).split(string, maxsplit)
Traceback (most recent call last):
  File "gen_rust.py", line 1657, in <module>
    generator.gen(srcfiles, module, dstdir)
  File "gen_rust.py", line 1206, in gen
    self.add_decl(decl)
  File "gen_rust.py", line 1176, in add_decl
    FuncInfo(self, decl, namespaces=self.namespaces)
  File "gen_rust.py", line 467, in __init__
    raise NameError("class not found: " + self.classname)
NameError: class not found: cv
thread '<main>' panicked at 'explicit panic', /home/knovour/.cargo/registry/src/github.com-0a35038f75765ae4/opencv-0.2.0/build.rs:86

Should I need to downgrade the python version?

All of the video capture examples are broken on my machine (Fedora 30)

When attempting to run any of the examples that use video capture, my webcam light turns on, a small and totally empty black window pops up that cannot be closed by any means, including gnome force quit. I had to find the process number and "kill -9" it.

When it does this, it yields the following error message:

[dalley@localhost opencv-test]$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/opencv-test`
[ INFO:0] VIDEOIO: Enabled backends(7, sorted by priority): GSTREAMER(1000); V4L2(990); OPENNI(980); CV_IMAGES(970); CV_MJPEG(960); FIREWIRE(950); UNICAP(940)
OpenCV | GStreamer warning: GStreamer: unable to start pipeline
 (/builddir/build/BUILD/opencv-3.4.4/modules/videoio/src/cap_gstreamer.cpp:872)

(opencv-test:21489): GStreamer-CRITICAL **: 23:15:44.400: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed
OpenCV | GStreamer warning: GStreamer: unable to query pipeline state (/builddir/build/BUILD/opencv-3.4.4/modules/videoio/src/cap_gstreamer.cpp:420)
VIDEOIO ERROR: V4L: device /dev/video1: Unable to query number of channels
CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate production trees: Can't create any node of the requested type!

Question about getting the byte array

After calling imgcodecs::imencode I usually call the to_vec function from the resulting VectorOfuchar object.
Is there a better/faster way to get the array of bytes ([u8]) instead of transforming it into a vec?

Fails to compile when OpenCV was built --with-tbb

I tried to build this on os x but it can't find TBB:

$ cargo build

---- 8< ---- snip long long long list of repetitive output ---- >8 ----

running: "ar" "crus" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/libocvrs.a" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/core.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/imgproc.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/highgui.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/features2d.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/photo.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/video.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/objdetect.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/calib3d.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfDMatch.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfKeyPoint.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfMat.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfObjectDetection.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfPoint.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfPoint2f.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfRect.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfString.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVec4f.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVec6f.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVectorOfDMatch.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVectorOfKeyPoint.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVectorOfPoint.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVectorOfPoint2f.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVectorOfchar.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVectorOfint.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfVectorOfuchar.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfchar.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfdouble.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOffloat.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfint.type.o" "/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out/VectorOfuchar.type.o"
ExitStatus(Code(0))
cargo:rustc-link-lib=static=ocvrs
cargo:rustc-link-search=native=/Users/phi/Documents/workspace/opencv-rust/target/debug/build/opencv-3f6c0a5fece25784/out
TARGET = Some("x86_64-apple-darwin")
cargo:rustc-link-lib=c++

--- stderr
ld: library not found for -llibtbb.dylib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
thread '<main>' panicked at 'assertion failed: e.success()', build.rs:117

I have tbb installed via homebrew in:

/usr/local/Cellar/tbb/4.4-20150728 (107 files, 1.7M) *
  Built from source

Any ideas why the build won't work?

Allow override pkg_name in build.rs

I'm using Arch Linux and happened to develop several projects on OpenCV 3 and 4.
For sake of package conflict, I install OpenCV 4.1 from official repository, and OpenCV {3.4, 2.x} from AUR (An unofficial package repo used by most Arch lovers).

OpenCV 4 is installed at standard locations and it works fine for me. However, OpenCV 3 is placed under /opt. The build.rs failed to find opencv.pc even with proper PKG_CONFIG_PATH is set. The cause is that the file is renamed to opencv3.pc, and I find no way to override the pkg_name in build.rs.

I see the work around to make a symlink from opencv.pc to opencv3.pc. I would prefer a configurable way rather than messing up with symlinks. Suppose we introduce OPENCV_RS_PKG_NAME env variable in build.rs?

Build fails with opencv 2.4.13

Using Arch Linux and compiled opencv2 from aur

4 | let img = opencv::highgui::imread("house.jpg",1);
| ^^^

error: linking with cc failed: exit code: 1
= note: /usr/bin/ld: cannot find -locvrs
collect2: error: ld returned 1 exit status

opencv::highgui::imdecode is missing

I am handling images in memory and would like to decode a buffer into an opencv::core::Mat struct, however this is not possible as opencv::highgui::imdecode is missing.

The function in question can be found here.

The current workaround would be to write buffer to an image file and then load via opencv::highgui::imread, this is painful just to type :)

Plans for allowing access to pixels?

Is it planned to have Mat::at or Mat::data be part of the generated rust bindings? This would allow direct access to the individual elements of a matrix.

Right now (if I did not miss anything) there seems to be no way of accessing pixel values of a Mat.

Add constructor parameters to Mat::new()

The C++ API provides (amongst others) the following methods:

C++: Mat::Mat()
C++: Mat::Mat(int rows, int cols, int type)
C++: Mat::Mat(Size size, int type)
C++: Mat::Mat(int rows, int cols, int type, const Scalar& s)
C++: Mat::Mat(Size size, int type, const Scalar& s)
C++: Mat::Mat(const Mat& m)

Right now Mat creation seems only possible through opencv::core::Mat::new() taking 0 parameters.

It'd be great to have at least C++: Mat::Mat(int rows, int cols, int type) to avoid having to call mat.resize afterwards.

opencv::contrib

I'm trying to include the contrib module of opencv 2.4.13.2.

So I added this snippet to the build.rs:
("contrib", vec!["contrib/contrib.hpp" ]),

Then I run into a problem that a method is already defined:
contrib.cpp:1289:31: error: redefinition of 'cv_contrib_cv_SpinImageModel_getMesh
contrib.cpp:1265:31: note: previous definition is here

So I added this line of code to the Python script (gen_rust.py):
"cv_contrib_cv_SpinImageModel_getMesh": "getMesh",

However I still get the same error.

How can I solve this?

Multiplying Mat by float

Firstly, thanks for the library, it has (mostly) been great to use. I apologise if I am missing something simple, but I am trying to convert some c++ code that containsm *= 7.0;, where m is a Mat, and 7 is a float or double.

How do you perform something similar in rust?

Weird behavior in Rust with OpenCV

I wrote some code like this.

extern crate opencv;

use self::opencv::highgui;
use self::opencv::core::Mat;

fn main() {
    load("image/test.jpg");
}

fn load(path: &str) {
    let src: Mat = highgui::imread(path, 1).unwrap();

    if src.empty().unwrap() {
        println!("Img load error");
    }
    else {
        println!("Img load success");
    }
}

When I run cargo run it shows Img load error.

However, when I added a println! at first line in load function like

fn load(path: &str) {
    println!("whatever");
    let src: Mat = highgui::imread(path, 1).unwrap();

    if src.empty().unwrap() {
        println!("Img load error");
    }
    else {
        println!("Img load success");
    }
}

It shows Img load success.

But when I change it to other code like let a: i32 = 1;, it shows Img load error again.

I have no idea what's going on.

System info:

  • OS: Manjaro Linux
  • Kernel: 4.3.0
  • Rust: 1.4.0

I had asked the same question here.

Switch to a better license?

Hi! Any chance you could switch to some other license? MIT would give you what I assume you want[0], but has the benefit of being a reasonably respected license, whereas the WTFPL makes most lawyers nervous (see https://news.ycombinator.com/item?id=5733050#up_5733477 for some analysis if you're curious).

Thanks!

0: I'm assuming what you want is "go nuts, I don't care, don't sue me, thanks."

Default to vcpkg instead of pkg-config for easy Windows building

After a couple days of fighting link errors when trying to use a version of opencv installed via vcpkg I hacked the build script to use the vcpkg crate to get the opencv paths including header path and was immediately succesful except for having to edit gen_rust.py to add loop to the reserved keywords.

Properly implemented, this would allow easy MSVC builds via:

vcpkg install opencv4[necessary features here]
cargo build

Question about ranges

So I'm trying to convert the python code snippet from this answer to rust, but I'm having troubles with the ranges function.

alpha_channel = img[:, :, 3]
_, mask = cv.threshold(alpha_channel, 254, 255, cv.THRESH_BINARY)  # binarize mask
color = img[:, :, :3]
new_img = cv.bitwise_not(cv.bitwise_not(color, mask=mask))

I believe the equivalent for getting the slices from the array, like python is doing would be the ranges function from mat.

So I'm trying something like this

            let mut range_alpha = VectorOfRange::new();
            range_alpha.push(core::Range::all()?);
            range_alpha.push(core::Range::all()?);
            range_alpha.push(core::Range::new(3, 3)?);
            let alpha = core::Mat::ranges(&image, &range_alpha)?;

The problem is: it seems the image don't have the third dimension in the array because I'm getting this error:

OpenCV(3.4.5) /tmp/opencv@3-20190923-60723-3pu0wl/opencv-3.4.5/modules/core/src/matrix.cpp:537: error: (-215:Assertion failed) (int)ranges.size() == d in function 'Mat'

I am reading the image as IMREAD_UNCHANGED and I'm sure it has the the alpha channel set.

Build fail on ARM

Hi,

the build on ARM with opencv2.4 and Rust 0.14 produce this error:

failed to run custom build command for `opencv v0.2.3`
process didn't exit successfully: `/home/pi/mirror/target/debug/build/opencv-41a4551118b8eb5b/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/usr/local/lib
cargo:rustc-link-lib=opencv_shape
cargo:rustc-link-lib=opencv_stitching
cargo:rustc-link-lib=opencv_objdetect
cargo:rustc-link-lib=opencv_superres
cargo:rustc-link-lib=opencv_videostab
cargo:rustc-link-lib=opencv_calib3d
cargo:rustc-link-lib=opencv_features2d
cargo:rustc-link-lib=opencv_highgui
cargo:rustc-link-lib=opencv_videoio
cargo:rustc-link-lib=opencv_imgcodecs
cargo:rustc-link-lib=opencv_video
cargo:rustc-link-lib=opencv_photo
cargo:rustc-link-lib=opencv_ml
cargo:rustc-link-lib=opencv_imgproc
cargo:rustc-link-lib=opencv_flann
cargo:rustc-link-lib=opencv_core
OpenCV lives in "/usr/local/include/opencv2"
Generating code in "/home/pi/mirror/target/debug/build/opencv-41a4551118b8eb5b/out"
Generating module 'core' from headers:
	/usr/local/include/opencv2/core/types_c.h
	/usr/local/include/opencv2/core/core.hpp

--- stderr
Traceback (most recent call last):
  File "gen_rust.py", line 1689, in <module>
    generator.gen(srcfiles, module, dstdir)
  File "gen_rust.py", line 1240, in gen
    self.add_decl(decl)
  File "gen_rust.py", line 1210, in add_decl
    FuncInfo(self, decl, namespaces=self.namespaces)
  File "gen_rust.py", line 476, in __init__
    raise NameError("class not found: " + self.classname)
NameError: class not found: operator cv
thread 'main' panicked at 'explicit panic', /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.2.3/build.rs:86
stack backtrace:
   1: 0x54b7e5e3 - std::sys::imp::backtrace::tracing::imp::write::hc8e8bfe92a700648
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2: 0x54b8555b - std::panicking::default_hook::{{closure}}::h495995576e43d115
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/panicking.rs:247
   3: 0x54b8384f - std::panicking::default_hook::h5063eab0febd8f2b
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/panicking.rs:263
   4: 0x54b83f73 - std::panicking::rust_panic_with_hook::h68a3cd81b9c4603b
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/panicking.rs:451
   5: 0x54b029db - std::panicking::begin_panic::h95f8d5b142fc1dc6
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/panicking.rs:413
   6: 0x54b10ff3 - build_script_build::main::hc93c71ba98cf82a1
                at /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/opencv-0.2.3/build.rs:86
   7: 0x54b894ef - __rust_maybe_catch_panic
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libpanic_unwind/lib.rs:97
   8: 0x54b8463f - std::rt::lang_start::h47c287c39e42af0f
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/panicking.rs:332
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/panic.rs:351
                at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/rt.rs:57
   9: 0x54b134bf - main
  10: 0x76deb293 - __libc_start_main

Do you have any idea of what is wrong?

Thanks

getRotationMatrix2D symbol lookup error for opencv 4.1.2

I'm currently running into a runtime symbol lookup error for undefined symbol: _ZN2cv20getRotationMatrix2D_ENS_6Point_IfEEdd.

It seems to me that something might be broken with the function opencv::imgproc::get_rotation_matrix_2d.

I had some trouble making the rust bindings work so I might have multiple opencv versions >= 4.1.0 installed.
But since I'm using feature "opencv-41" and the signature of that particular function didn't change after 4.1.0, this wouldn't explain the problem, right?

Any help would be really appreciated.

Build Instructions

I've been unable to build this project on my pc using the latest 2.x opencv . Could you list building requirements in the Readme, please?

Build fail on Ubuntu 18.04 x86_64

With gcc 7

cargo:warning=At global scope:
cargo:warning=cc1plus: warning: unrecognized command line option ‘-Wno-class-memaccess’
exit code: 0
running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/usr/local/include/opencv" "-I" "/usr/local/include" "-I" "." "-I" "/home/norru/Projects/3rdParty/opencv-rust/target/debug/build/opencv-2494b6b918094f8f/out" "-Wall" "-Wextra" "-std=c++0x" "-Wno-deprecated-declarations" "-Wno-class-memaccess" "-fno-strict-aliasing" "-o" "/home/norru/Projects/3rdParty/opencv-rust/target/debug/build/opencv-2494b6b918094f8f/out/PtrOfFunction.type.o" "-c" "/home/norru/Projects/3rdParty/opencv-rust/target/debug/build/opencv-2494b6b918094f8f/out/PtrOfFunction.type.cpp"


error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/usr/local/include/opencv" "-I" "/usr/local/include" "-I" "." "-I" "/home/norru/Projects/3rdParty/opencv-rust/target/debug/build/opencv-2494b6b918094f8f/out" "-Wall" "-Wextra" "-std=c++0x" "-Wno-deprecated-declarations" "-Wno-class-memaccess" "-fno-strict-aliasing" "-o" "/home/norru/Projects/3rdParty/opencv-rust/target/debug/build/opencv-2494b6b918094f8f/out/dnn.o" "-c" "/home/norru/Projects/3rdParty/opencv-rust/target/debug/build/opencv-2494b6b918094f8f/out/dnn.cpp" with args "c++" did not execute successfully (status code exit code: 1).

try! in examples not failing on error

I am still relatively new to rust and as such this might be a mistake on my end but I found that this:

let mut cam = match highgui::VideoCapture::device(1) {
    Ok(cam) => {
        println!("Got it!");
        cam
    },
    Err(_) => {
        println!("Oh no! Trying another one…");
        try!(highgui::VideoCapture::device(0))
    }
};

results in this:

$ target/debug/capture
Warning, camera failed to properly initialize!
Cleaned up camera.
Got it!

My understanding is, that highgui::VideoCapture::device(1) should fail (aka execute the Err(_) branch) if it can't properly initialize the camera. However it "succeeds" even though it can't access the camera 1 and thus runs the code in the Ok(_) branch rather than the one in the Err(_) branch.

The reason for my change is that on my system there is only one camera connected not two and all examples are hard coded to use the second camera.

The original code as in video_capture.rs:

let mut cam = try!(highgui::VideoCapture::device(1));

Help with trying to generate opencv version 4.0.1 bindings

High @twistedfall, I’m interested in using your methods of parsing c++ header files and generating rust code for opencv versions 2.X and 3.4.5, for the 4.0.1 release. I’ve been able to use your gen_rust.py script to generate most of the bindings for the basic libraries, but I am coming up against the issue of the cv::sys crate as I haven’t been able to figure out how the script should generate these bindings and from which open cv header files. It’s very possible that I’m missing something bigger and more fundamental (perhaps the api in 3.4.5 is completely incompatible with the 4.0.1 api?) so please correct me if that is the case. Part of the problem is that I only know rust and some C but very little c++, so I’m doubtful I’ll be able to figure this out without your guidance. Thank you in advance for any help you can provide.

Link error on Ubuntu 18.04 x86_64

My project fails on Ubuntu 18.04, but works on Arch Linux. It seems it fails on undefined reference cv::typeToString(int). The libopencv-* is up to 3.4.1 on Ubuntu. Unfortunately, cv::typeToString(int) appears after 3.4.3. I could build my own OpenCV as workaround. That's a bit inconvenience.

The situation may happen as OpenCV rolls out new versions. I would suggest more verbose feature opencv-3.4.1, etc. I see it implies refactoring work, but makes sense.

Here is the Cargo.toml config.

[dependencies]
opencv = {version = "~0.26", default-features = false, features = ["opencv-34", "contrib"]}

The cargo build --release log.

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.0.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.1.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.10.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.11.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.12.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.13.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.14.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.15.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.2.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.3.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.4.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.5.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.6.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.7.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.8.rcgu.o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.sensor_fuse.cxb4wpmz-cgu.9.rcgu.o" "-o" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/sensor_fuse-8becdab565d4bf06.48ngb55xj63f2cj2.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps" "-L" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/build/backtrace-sys-0c599a93aa5e2ec5/out" "-L" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/build/intel-mkl-src-81bf0e6958f7a8ed/out" "-L" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/build/opencv-295eba84862408d2/out" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/build/opencv-295eba84862408d2/out" "-L" "/home/aeon/.cargo/git/checkouts/rust-rdkafka-d5d41801cb65ae75/0c8ab14/rdkafka-sys/librdkafka/src" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libpretty_env_logger-fddf6f9ce02df647.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libchrono-3678b0444d6dc09d.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtime-21a717d012171f32.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libenv_logger-32b2109851806eeb.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libregex-394dac9db0d1a1fd.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libthread_local-6ccd210474b044b7.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libregex_syntax-3aaf9eef3b6d9145.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libaho_corasick-fb4ea716940e3b63.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libhumantime-49aa1a3ec65e7cad.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libquick_error-b75d00e579033f1f.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtermcolor-627d0b674a8e7e99.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtoml-6a71481906c96d2d.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libclap-46218657d245b0dd.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libyaml_rust-89b455e86520b371.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libvec_map-d7c451ba84034fcb.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtextwrap-7371aec9a7991185.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libunicode_width-85bf94869f49794a.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libstrsim-51b58a85c15f4612.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libbitflags-bab1880ce150b936.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libatty-367fdb31671ef0b4.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libansi_term-74cf122b8ea78844.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librdkafka-9ed18ecd8a7ad19e.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librdkafka_sys-6ec5c5381cb73bc9.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/liblibz_sys-d9621bd3176d10db.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libserde_json-263ea3c85657922f.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libryu-0799e292eef906b3.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libitoa-6a210275de79f69c.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libprost-7690d58fb3c4c90b.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfutures-4dc2167e14ffef7a.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfutures_executor-115188042a3beb00.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libwayside_rust_common-d0ce335443fc711b.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtokio-a9a6cc509c0abecc.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtokio_net-9434ded6a6090e64.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libmio_uds-544ec06304840765.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libparking_lot-3d353faa1d44c778.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libparking_lot_core-543294cefe262d76.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libsmallvec-77539dd130b6b19c.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/liblock_api-380cd0aba9dfc12e.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libmio-5c003d0f51fb77d5.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnet2-a9486e8a0b822d94.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtokio_fs-d7a2ef814da19e0f.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtokio_codec-d4453c86f6b51ed1.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtokio_io-e9765ee349ee1319.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libpin_project-8115be36f4b19213.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libbytes-2aa89d2410da7f34.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libiovec-961b4d00a471094d.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libbyteorder-5f24d2e030791579.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtokio_timer-462b66e45ff79940.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtokio_executor-6b624149120ca045.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libcrossbeam_channel-051c7f01a35200ea.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtracing-2f887fffe1092914.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtracing_core-f19c515af293c729.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libcrossbeam_queue-6c40557ff8e5eec0.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnum_cpus-edd6c0c2dc87fbda.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libcrossbeam_deque-5d3769207058b1f1.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libcrossbeam_epoch-1c32f95a924b1215.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libscopeguard-5b23cdc493a082c5.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libmemoffset-8a5a10cf6bdf960d.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libarrayvec-08b777a2a06de4f6.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnodrop-251866cbb2d3a397.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtokio_sync-65e665f033e8a341.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfnv-2b210a221bcdda8b.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfutures_util-cc384a2119e46ece.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libmemchr-4b9efba8bbeb614b.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfutures_channel-502c146a55c2dd20.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfutures_io-fa75c55968669699.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfutures_sink-8a93772ec23f165a.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libpin_utils-fca5b1a96f5ab8f1.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libcrossbeam_utils-b99a7da0a112b2c4.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfutures_core-1108c67bfcff3f99.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libopencv-edf4c0e52f0fb75f.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libslab-9259c9c11c5135cd.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/liblazy_static-6bb0a6a10fe6ce0a.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libspin-8dce5d4ab42ec0bb.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnum-bda4985186a1c28e.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnum_iter-6c936d0149bc4ffe.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libcpp-6c3a1262c75fd0d9.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/liblog-e6750c4275436627.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libserde-cd138e7fcf1811e8.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnalgebra-a0da5a632f804b45.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libalga-5c6e677d5081765a.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand-bb9398ee1bfa46e7.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_xorshift-e053966c3750826c.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_pcg-68cd9718b26a0781.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_hc-d7562e7563c3667e.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_chacha-fbf5a6a1d6ae48d6.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_isaac-85c58989af937e66.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_core-a06650b8d831b24f.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_os-c8d91eb500ab58b3.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_jitter-47e36cbfedef314f.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librand_core-5bd00e0630147a11.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnum_rational-e3d5f713297ce899.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnum_bigint-f669a5dce5888f01.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnum_integer-86c5022b56228adb.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnum_complex-142db8ba543dbe4b.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libmatrixmultiply-8afbf1e3c21bccaa.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librawpointer-f4b9088ab6c04a33.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libgeneric_array-b48c8be69e285e2c.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libtypenum-89b2295ecaa46b0b.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libapprox-601e91783b35df95.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libnum_traits-b90388dfa0642ea4.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libfailure-48e99f6dc4944d63.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libbacktrace-2fbf7f33a090729a.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libbacktrace_sys-19052482a8201aac.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/liblibc-a96ed4f438903f11.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libcfg_if-c033bbb683e5b601.rlib" "/home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/librustc_demangle-0add49438cfeeb71.rlib" "-Wl,--start-group" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-9fe6e5ab8761a09f.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4160b298b1511baa.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-f39914d03b9648c8.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-2b552edea05fcfdb.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-65ffb7a10f9ccc45.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-173c3454a42b324d.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1ff1784dd499e805.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-6e64baefb5bb5a40.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-a51c2bb6d30a0a87.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-a19928c525e27c1c.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-095bdba6e94cee87.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-f0a732af4791588e.rlib" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-97b68efa568398cb.rlib" "-Wl,--end-group" "/home/aeon/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-9d67c5100af5ce1a.rlib" "-Wl,-Bdynamic" "-lz" "-lopencv_dnn" "-lopencv_ml" "-lopencv_objdetect" "-lopencv_shape" "-lopencv_stitching" "-lopencv_superres" "-lopencv_videostab" "-lopencv_calib3d" "-lopencv_features2d" "-lopencv_highgui" "-lopencv_videoio" "-lopencv_imgcodecs" "-lopencv_video" "-lopencv_photo" "-lopencv_imgproc" "-lopencv_flann" "-lopencv_viz" "-lopencv_core" "-lstdc++" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /home/aeon/repos/wayside-portal/sensor_fuse/target/release/deps/libopencv-edf4c0e52f0fb75f.rlib(core.o): In function `cv_typeToString_int':
          core.cpp:(.text.cv_typeToString_int+0x20): undefined reference to `cv::typeToString(int)'
          collect2: error: ld returned 1 exit status


error: aborting due to previous error

error: could not compile `sensor_fuse`.

Big linking error on windows

I am getting a massive linking error ending with

fatal error LNK1120: 106 unresolved externals
$ echo $OPENCV_LINK_LIBS
opencv_world348     # Also tried with opencv_world348d

$ echo $OPENCV_INCLUDE_PATHS
D:\FDrive\Documents\CStuff\Libraries\opencv3\build\include

$ echo $OPENCV_LINK_PATHS
D:\FDrive\Documents\CStuff\Libraries\opencv3\build\x64\vc14\lib    # Also tried with vc15

I'm getting the same error with both powershell and MSYS2

Here is the full error message: https://pastebin.com/LxNk14DK

I have also tried with opencv 4.1.x, and get similar errors.

Any ideas?

(Btw on my arch linux machine I am also getting similar linking errors, still investigating that)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.