Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance openCV to support optiicalFlow - Video.calcOpticalFlowPyrLK (Lucas-Kanade)method #585

Open
DD-72 opened this issue Sep 6, 2024 · 7 comments

Comments

@DD-72
Copy link

DD-72 commented Sep 6, 2024

Is your feature request related to a problem? (optional)

No response

Description of the new feature/enhancement

Currently openCV provided in Weasis is not supporting all features provided by original openCV. It seems you guys trimmed some features of openCV and developed some third party libraries. We have a requirement in our application to use Video.calcOpticalFlowPyrLK (Lucas-Kanade)method but this is not available in Weaisis's openCV. It would be helpful if you include optical flow related features in openCV. Please let me know if you need any more details

Proposed technical implementation details (optional)

No response

Describe alternatives you've considered (optional)

No response

Additional context (optional)

No response

@nroduit
Copy link
Owner

nroduit commented Sep 6, 2024

In fact, we only integrate 3 modules:

  • core
  • imgproc
  • imgcodecs: witch contains specific implementations

Unfortunately, we don't want to add any other opencv modules to the basic version, for reasons of binary volume and system compatibility. You'll have to look into adding these in additional custom plugins.

For example, we have a video plugin with ffmeg (80 MB) that will be distributed as an additional plugin.

@DD-72
Copy link
Author

DD-72 commented Sep 9, 2024

@nroduit Thank you very much for responding. Could you please provide more insights on custom plugins. I tried following to add openCV but Weasis is failing to start up.

  1. Created new plugin by following steps provided in https://weasis.org/en/basics/customize/build-plugins/index.html#build-plug-ins-from-maven-archetype

  2. Tried with different Java openCV libraries like JavaCV, openpnp. Added JavaCV dependences in pom.xml of plugin created in above step.
    <dependency> <groupId>org.openpnp</groupId> <artifactId>opencv</artifactId> <version>3.4.2-0</version> </dependency>

  3. Its compiled successfully and able to import Video.calcOpticalFlowPyrLK but Weasis is failing to start.

  4. Error log - org/weasis/core/weasis-core/4.2.0-SNAPSHOT/weasis-core-4.2.0-SNAPSHOT.jar (org.osgi.framework.BundleException: Unable to resolve weasis-core [31](R 31.0): missing requirement [weasis-core [31](R 31.0)] osgi.wiring.package; (osgi.wiring.package=org.dcm4che3.img.stream) [caused by: Unable to resolve weasis-dicom-codec [3](R 3.0): missing requirement [weasis-dicom-codec [3](R 3.0)] osgi.wiring.package; (&(osgi.wiring.package=org.opencv.core)(version>=3.4.0)(!(version>=4.0.0)))] Unresolved requirements: [[weasis-core [31](R 31.0)] osgi.wiring.package; (**osgi.wiring.package=org.dcm4che3.img.stream**)])

  5. To fix above issue, updated Exported-Package and Import-Package section in pom.xml of weasis-core with packages got in above errors (org.dcm4che3.img.stream) but facing same kind issue with different packages.

@nroduit
Copy link
Owner

nroduit commented Sep 9, 2024

According to the errors, I imagine you've modified the core module and created impossible dependencies. The core module cannot have dicom-codec as a dependency (this will produce cyclic dependencies), see the OSGI module hierarchy.

@DD-72
Copy link
Author

DD-72 commented Sep 10, 2024

@nroduit We followed the same module hierarchy and Its all working fine without newly created plugin. We are facing issue only when adding newly created plugin dependency in weasis-core. Please find attached pom.xml for both weasis-core and custom-plugin. Attached complete error logs also.
custom_plugin_error_log.txt
weasis-core-pom.txt
custom_plugin_pom.txt

@nroduit
Copy link
Owner

nroduit commented Sep 18, 2024

You can't attach plugins that use DICOM functionality to weasis-core. This will create cyclic dependencies. You need to create a new launch context (see example) and add your plugins. Plugin documentation remains valid as long as properties files are replaced by json files.

@DD-72
Copy link
Author

DD-72 commented Sep 24, 2024

  1. Removed all DICOM dependencies from new plugin
  2. Added this new plugin in Weasis/weasis-launcher/conf/config.properties and Weasis/weasis-launcher/conf/base.json
  3. Added this new plugin as a dependency in weasis-core module But getting below error. Not sure why Dicom-Explorer, dicom-viewer2d are failing when new plugin was added in weasis-core.

ERROR: Bundle weasis-dicom-explorer [23] Error starting file:C:/Users/DD/.m2/repository/org/weasis/dicom/weasis-dicom-explorer/4.2.0-SNAPSHOT/weasis-dicom-explorer-4.2.0-SNAPSHOT.jar (org.osgi.framework.BundleException: Activator start error in bundle weasis-dicom-explorer [23].) java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator

ERROR: Bundle weasis-dicom-viewer2d [26] Error starting file:C:/Users/DD/.m2/repository/org/weasis/dicom/weasis-dicom-viewer2d/4.2.0-SNAPSHOT/weasis-dicom-viewer2d-4.2.0-SNAPSHOT.jar (org.osgi.framework.BundleException: Activator start error in bundle weasis-dicom-viewer2d [26].) java.lang.NoClassDefFoundError: org/weasis/core/ui/editor/image/ImageViewerPlugin

Caused by: java.lang.ClassNotFoundException: org.osgi.framework.BundleActivator not found by weasis-dicom-explorer [23]

Could you please check and let me know if I missed anything.

@DD-72
Copy link
Author

DD-72 commented Sep 24, 2024

Is number 23 in below exception anyway related to felix.auto.install.23 in config.properties?. This is related to Weasis openCV. Adding another openCV causing this issue?

ERROR: Bundle weasis-dicom-explorer **[23]** Error starting file:C:/Users/DD/.m2/repository/org/weasis/dicom/weasis-dicom-explorer/4.2.0-SNAPSHOT/weasis-dicom-explorer-4.2.0-SNAPSHOT.jar (org.osgi.framework.BundleException: Activator start error in bundle weasis-dicom-explorer **[23]**.) java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator

felix.auto.install**.23**= \ file:${maven.localRepository}/org/weasis/opencv/w**easis-opencv-core**-${native.library.spec}/${weasis.opencv.native.version}/weasis-opencv-core-${native.library.spec}-${weasis.opencv.native.version}.jar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants