java - JavaCV - Why IplImage.createFrom(image) doesn't exist anymore? -


i'm working javacv @ moment, try simple blob detection. i'm using maven , got javacv 0.11 (more specific org.bytedeco.javacv) repositories. compiles without errors , works fine, method create iplimage bufferedimage seems doesn't exist. eclipse says

the method createfrom(bufferedimage) undefined type opencv_core.iplimage 

i have no idea problem because works fine except 1 method far.

the reason...

javacv 0.11 has introduced concept of frameconverter.

the goal don't create unecessary coupling between application using javacv , api (ffmpeg, java 2d...).

instead, javacv uses frame class instances storing audio samples or video image data. frames can later shared between various apis frameconverters.

see more: javacv frame converters

the workaround...

it's possible copy , paste code of createfrom method own code or refactor using frameconverters.

below (not compiled) code of method taken source repository:

public static iplimage createfrom(bufferedimage image) {     return createfrom(image, 1.0); }  public static iplimage createfrom(bufferedimage image, double gamma) {     return createfrom(image, gamma, false); }  public static iplimage createfrom(bufferedimage image, double gamma, boolean flipchannels) {     if (image == null) {         return null;     }     samplemodel sm = image.getsamplemodel();     int depth = 0, numchannels = sm.getnumbands();     switch (image.gettype()) {         case bufferedimage.type_int_rgb:         case bufferedimage.type_int_argb:         case bufferedimage.type_int_argb_pre:         case bufferedimage.type_int_bgr:             depth = ipl_depth_8u;             numchannels = 4;             break;     }     if (depth == 0 || numchannels == 0) {         switch (sm.getdatatype()) {             case databuffer.type_byte:   depth = ipl_depth_8u;  break;             case databuffer.type_ushort: depth = ipl_depth_16u; break;             case databuffer.type_short:  depth = ipl_depth_16s; break;             case databuffer.type_int:    depth = ipl_depth_32s; break;             case databuffer.type_float:  depth = ipl_depth_32f; break;             case databuffer.type_double: depth = ipl_depth_64f; break;             default: assert false;         }     }     iplimage = create(image.getwidth(), image.getheight(), depth, numchannels);     i.copyfrom(image, gamma, flipchannels);     return i; } 

reference: opencv_core.java


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -