B4J Question jOpenCV: How to use OCVCLAHE?

b4x-de

Active Member
Licensed User
Longtime User
I'm trying to use OCVCLAHE from jOpenCV, but I can't get it to work. This is what I tried first:

B4X:
    Dim cl As OCVCLAHE
    Dim sz2 As OCVSize
    sz2.Initialize2(Array As Double(7,7))
    cl.TilesGridSize = sz2
    cl.ClipLimit = 2
    cl.apply(matGray, matGray)

The error message when compiling is:

B4X:
Kompiliere generierten Java Code.    Error
B4J line: 471
Dim cl As OCVCLAHE
src\b4j\example\main.java:1076: error: constructor CLAHE in class CLAHE cannot be applied to given types;
_cl = new com.b4jcv.imgproc.CLAHE();
      ^
  required: long
  found:    no arguments
  reason: actual and formal argument lists differ in length

This is what I tried next:

B4X:
    Dim clahe As JavaObject
    clahe.InitializeNewInstance("com.b4jcv.imgproc.CLAHE", Null)
    clahe.SetField("TilesGridSize", sz2)
    clahe.SetField("ClipLimit", 2.0)
    clahe.RunMethod("apply", Array(matGray, matGray))

The next error message says:

B4X:
java.lang.IllegalAccessException: class anywheresoftware.b4j.object.JavaObject cannot access a member of class com.b4jcv.imgproc.CLAHE with modifiers "protected"

I'm out of ideas. Can someone please help me?

Thanks, Thomas
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…