weixin_39568172
2020-12-26 00:21 阅读 2

How to use imwrite?

I don't know how to use this Api in rust: pub fn imwrite( filename: &str, img: &dyn ToInputArray, params: &VectorOfi32 ) -> Result Especially the third parameter:params

该提问来源于开源项目:twistedfall/opencv-rust

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • weixin_39732491 weixin_39732491 2020-12-26 00:21

    Well, this is a pretty straight-forward function. It’s usage in Rust is very close to the one from C++. Did you check the docs? https://docs.rs/opencv/0.34.0/opencv/imgcodecs/fn.imwrite.html#parameters and https://docs.opencv.org/master/d4/da8/group__imgcodecs.html#gabbc7ef1aa2edfaa87772f1202d67e0ce

    Or maybe ask a more specific question :)

    点赞 评论 复制链接分享
  • weixin_39568172 weixin_39568172 2020-12-26 00:21

    For the third parameter, I want to know how to fill in the default value in rust. When writing in rust, you need a &VectorOfi32 type,I don 't know how to fill in the default value in rust. I try to find similar usage of this function in the example, but I don' t find similar examples

    点赞 评论 复制链接分享
  • weixin_39732491 weixin_39732491 2020-12-26 00:21

    You can just create an empty VectorOfi32:

    rust
    opencv::types::VectorOfi32::new()
    

    and pass a reference to it as the 3rd argument.

    点赞 评论 复制链接分享
  • weixin_39568172 weixin_39568172 2020-12-26 00:21

    Thank you. I haven't found this method in the first time before, so I haven't tried to do it. After your reminding, I have found vector trait under this type

    点赞 评论 复制链接分享

相关推荐