Allow passing None to minMaxLoc and minMaxIdx
MODIFY
binding-generator/src/func.rs
binding-generator/src/func.rs
@@ -434,7 +434,9 @@ impl<'tu, 'ge> Func<'tu, 'ge> {
return Field::new_ext(a, FieldTypeHint::FieldSetter, self.gen_env)
}
- if let Some(arg_override) = arg_overrides.and_then(|o| o.get(a.rust_leafname(FishStyle::No).as_ref())) {
+ let arg_override = arg_overrides
+ .and_then(|o| a.get_name().and_then(|arg_name| o.get(arg_name.as_str())));
+ if let Some(arg_override) = arg_override {
return Field::new_ext(a, FieldTypeHint::ArgOverride(*arg_override), self.gen_env);
}

MODIFY
binding-generator/src/settings.rs
binding-generator/src/settings.rs
@@ -950,12 +950,30 @@ pub static ARGUMENT_OVERRIDE: Lazy<HashMap<FuncId, HashMap<&str, ArgumentOverrid
"dims" => ArgumentOverride::LenForSlice("size", 1),
},
FuncId::new("cv::mixChannels", ["src", "dst", "fromTo", "npairs"]) => hashmap! {
- "from_to" => ArgumentOverride::Slice,
+ "fromTo" => ArgumentOverride::Slice,
"npairs" => ArgumentOverride::LenForSlice("from_to", 2),
},
FuncId::new("cv::createTrackbar", ["trackbarname", "winname", "value", "count", "onChange", "userdata"]) => hashmap! {
"value" => ArgumentOverride::Nullable,
},
+ FuncId::new("cv::minMaxLoc", ["src", "minVal", "maxVal", "minLoc", "maxLoc", "mask"]) => hashmap! {
+ "minVal" => ArgumentOverride::Nullable,
+ "maxVal" => ArgumentOverride::Nullable,
+ "minLoc" => ArgumentOverride::Nullable,
+ "maxLoc" => ArgumentOverride::Nullable,
+ },
+ FuncId::new("cv::minMaxLoc", ["a", "minVal", "maxVal", "minIdx", "maxIdx"]) => hashmap! {
+ "minVal" => ArgumentOverride::Nullable,
+ "maxVal" => ArgumentOverride::Nullable,
+ "minIdx" => ArgumentOverride::Nullable,
+ "maxIdx" => ArgumentOverride::Nullable,
+ },
+ FuncId::new("cv::minMaxIdx", ["src", "minVal", "maxVal", "minIdx", "maxIdx", "mask"]) => hashmap! {
+ "minVal" => ArgumentOverride::Nullable,
+ "maxVal" => ArgumentOverride::Nullable,
+ "minIdx" => ArgumentOverride::Nullable,
+ "maxIdx" => ArgumentOverride::Nullable,
+ },
});
pub static NO_SKIP_NAMESPACE_IN_LOCALNAME: Lazy<HashMap<&str, HashMap<&str, &str>>> = Lazy::new(|| hashmap! {

MODIFY
tests/core.rs
tests/core.rs
use opencv::{
- core::{
- self,
- CV_32S,
- CV_64F,
- CV_8U,
- CV_MAKETYPE,
- Moments,
- Point2f,
- RotatedRect,
- Scalar,
- Size2f,
- },
+ core::{self, CV_32S, CV_64F, CV_8U, CV_MAKETYPE, Moments, Point, Point2f, RotatedRect, Scalar, Size2f, Vec3b},
prelude::*,
Result,
types::VectorOfMat,
@@ -118,3 +107,14 @@ fn file_storage() -> Result<()> {
Ok(())
}
+
+#[test]
+fn min_max_loc() -> Result<()> {
+ let mut m = Mat::new_rows_cols_with_default(10, 10, Vec3b::typ(), Scalar::all(5.))?;
+ let (mut min_val, mut max_val) = (90., 90.);
+ *m.at_2d_mut(5, 5)? = Vec3b::from([10, 20, 30]);
+ core::min_max_loc(&m, Some(&mut min_val), Some(&mut max_val), None, None, &core::no_array()?)?;
+ assert_eq!(5., min_val);
+ assert_eq!(30., max_val);
+ Ok(())
+}

Allow passing None to minMaxLoc and minMaxIdx