iOS Question Run Method error

joilts

Member
Licensed User
Longtime User
Hi to all,

I'm trying to access a inline code with many parameters but I´m getting a not found error. Can you help me to find what I'm doing wrong?

Log Error:
B4X:
Application_Start
Application_Active
Error occurred on line: 77 (imageTransformation)
Method not found: thresholdImage::, target: [_nome=<B4INativeObject: [_nome=<B4INativeObject: [_nome=<B4INativeObject: [_nome=<B4INativeObject: [_nome=<B4INativeObject: [_nome=<B4INativeObject: [_nome=<B4INativeObject: [_nome=<B4INativeObject: [_nome=<B4INativeObject: >, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]>, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]>, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]>, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]>, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]>, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]>, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]>, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]>, _main=<b4i_main: (null)>, _firstscreen=<b4i_firstscreen: (null)>
]
Stack Trace: (
  CoreFoundation       <redacted> + 150
  libobjc.A.dylib      objc_exception_throw + 38
  CoreFoundation       <redacted> + 0
  Image Transf         +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 426
  Image Transf         -[B4INativeObject RunMethod::] + 164
  CoreFoundation       <redacted> + 68
  CoreFoundation       <redacted> + 292
  Image Transf         +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1786
  Image Transf         -[B4IShell runMethod:] + 574
  Image Transf         -[B4IShell raiseEventImpl:method:args::] + 1998
Image Transf         -[B4IShellBI raiseEvent:event:params:] + 1340
Image Transf         +[B4IDebug delegate:::] + 52
Image Transf         -[b4i_imagetransformation _threshold::::::] + 762
Image Transf         -[b4i_firstscreen _btthr2_click] + 1086
CoreFoundation       <redacted> + 68
CoreFoundation       <redacted> + 292
Image Transf         +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1786
Image Transf         -[B4IShell runMethod:] + 574
Image Transf         -[B4IShell raiseEventImpl:method:args::] + 2212
Image Transf         -[B4IShellBI raiseEvent:event:params:] + 1340
Image Transf         __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74
libdispatch.dylib    <redacted> + 10
libdispatch.dylib    <redacted> + 22
libdispatch.dylib    <redacted> + 1524
CoreFoundation       <redacted> + 8
CoreFoundation       <redacted> + 1574
CoreFoundation       CFRunLoopRunSpecific + 520
CoreFoundation       CFRunLoopRunInMode + 108
GraphicsServices     GSEventRunModal + 160
UIKit                UIApplicationMain + 144
Image Transf         main + 108
libdyld.dylib        <redacted> + 2
)

B4i Code:

B4X:
Public Sub threshold(img As Bitmap, thr As Int, maxval As Int, vType As Int, ostsu As Int) As Bitmap
    Dim b As Bitmap
    b=nome.RunMethod("thresholdImage::",Array(img ,thr, maxval, vType, ostsu))
    Return b
End Sub

#If OBJC

#import <QuartzCore/QuartzCore.h>
#import <Accelerate/Accelerate.h>

// Gets an Threshold Image
//parameters: src image:
//src - input array (single-channel, 8-bit or 32-bit floating point). This is the source image, which should be a grayscale image.
//thresh - threshold value, and it is used to classify the pixel values.
//vmaxval - maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.
//         It represents the value to be given if pixel value is more than (sometimes less than) the threshold value.
//vtype - thresholding type.(see threshold for details).
//            imt.THRESH_BINARY = 0
//            imt.THRESH_BINARY_INVY = 1
//            imt.THRESH_TRUNCY = 2
//            imt.THRESH_TOZEROY = 3
//            imt.THRESH_TOZERO_INVY = 4
//    Membername    Value    Description
//    Binary        0        value = value > threshold ? max_value : 0
//    BinaryInv    1        value = value > threshold ? 0 : max_value
//    Trunc        2        value = value > threshold ? threshold : value
//    ToZero        3        value = value > threshold ? value : 0
//    ToZeroInv    4        value = value > threshold ? 0 : value

//votsu - If value is 1, calculate ostsu threshold and use it. thresh origanal value is ignored at this situation

-(UIImage*)thresholdImage: (UIImage*)image :(int)thresh :(int)vmaxval :(int)vtype :(int)votsu  {

    int threshold = thresh;
   //BIG CODE HERE
    image = [self imageWithBits:dataBitmap withSize:image.size];
   return image;
}
 
Top