Closed noxowl closed 1 year ago
Yep, I'm aware of this and working to fix it, thanks!
Hello, is there any temporary workaround (except recompiling 4.7 version)?
For now, the best option is to use OpenCV 4.7, but the fix will be released shortly!
@xvolks The workaround I'm using is to comment out the Debug
trait implementation for RotatedRect
as there is another derived implementation of that trait.
diff --git a/src/manual/core/rect.rs b/src/manual/core/rect.rs
index ae8b7ac2..14bc5fc1 100644
--- a/src/manual/core/rect.rs
+++ b/src/manual/core/rect.rs
@@ -274,6 +274,7 @@ where
}
}
+/*
impl fmt::Debug for RotatedRect {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("RotatedRect")
@@ -283,6 +284,7 @@ impl fmt::Debug for RotatedRect {
.finish()
}
}
+*/
#[test]
fn test_partial() {
After applying @proski workaround, and for some reason I now have the error : error[E0277]: KeyPoint
doesn't implement Debug
On : pub kp_model: Vector<KeyPoint>,
This was not an issue before.
@xvolks @proski @noxowl Can you please try the alpha
branch, the compatibility with OpenCV 4.8 should be fixed there
@twistedfall It seems that the Debug issue is fixed, but my project stil does not compile with following errors:
error[E0277]: `KeyPoint` doesn't implement `Debug`
error[E0277]: the trait bound `Vector<KeyPoint>: VectorExternCopyNonBool<KeyPoint>` is not satisfied
Thanks for the report, I think I know how to fix it
@twistedfall Mine seems to be fine. Here is full log: https://gist.github.com/noxowl/579f25cc39d650e33fbc5271453bc261 (cargo.toml -> opencv = { git = "https://github.com/twistedfall/opencv-rust.git", branch = "alpha" }) (/usr/local/opt/opencv -> ../Cellar/opencv/4.8.0_1)
I have good results with the alpha branch and following systems:
The OpenCV 4.8 support is released in v0.83, additionally the default Debug
implementations should be available for all classes (that should fix the @xvolks issue)
Thank you @twistedfall, most of the compile errors are gone.
I still have:
the trait bound
Vectoris not satisfied
at this line
let kp_model_slice = self.model.kp_model.as_slice();
With :
123 | let kp_model_slice = self.model.kp_model.as_slice();
| ^^^^^^^^ the trait `VectorExternCopyNonBool<KeyPoint>` is not implemented for `Vector<KeyPoint>`
Edit: to stop using as_slice and as a workaround I replaced :
let kp_model_slice = self.model.kp_model.as_slice();
let kp_slice = kp.as_slice();
for m in good_matches {
let point: KeyPoint = kp_model_slice[m.query_idx as usize];
src_points.push(point.pt());
let point: KeyPoint = kp_slice[m.train_idx as usize];
dst_points.push(point.pt());
}
by
let kpm = &self.model.kp_model;
for m in good_matches {
let Ok(point1) = kpm.get(m.query_idx as usize) else { continue; };
let Ok(point2) = kp.get(m.train_idx as usize) else { continue; };
src_points.push(point1.pt());
dst_points.push(point2.pt());
}
Yeah, that's the correct way to deal with this issue. Recently KeyPoint
stopped being a simple struct because it has descendants so its vector lost the as_slice()
method.
On the side note technically the replacement code is not equivalent. Previously it would panic on the out of bounds index and in the new code it will continue looping.
I really appreciate your contribution.
Currently, building OpenCV 4.8 with the latest version results in a error.
error[E0119]:` conflicting implementations of trait `Debug` for type `RotatedRect
Since Homebrew only provides the latest version of OpenCV, I have to downgrade by compiling OpenCV 4.7 myself.
MacOS Ventura 13.4.1(22F82)
brew install opencv
4.8.0
rustc --version
):rustc 1.70.0 (90c541806 2023-05-31)
full log: https://gist.github.com/noxowl/a24c52dd108a5b2afa02e7716b0f24ed