[mods please delete this message]


    Sep 20 2006 | 2:53 am
    Hi all, ummm, oops. Don't you love it when you spend 30 minutes typing up a huge forum post and then solving the problem 30 seconds after hitting "submit"? Disregard...
    Mike

    • Sep 20 2006 | 3:15 am
      Hi Mike, If you're using OpenCV, you'd better get used to this max vanishing with no trace thing. It's not Jitter that's doing it but OpenCV. When OpenCV doesn't get proper arguments to a function, it kills everything. This really sucks and the way I've handled it is by doing a looksee in the OpenCV source with the debugger to make sure that my args are correct. I haven't looked, but hopefully there are some configuration params that can be set when initially compiling opencv to prevent this heinous behavior. Otherwise, be very very careful. Here's an example:
      I was makeing an ecternal with a convolution kernel. If the kernel width was even, it would kill max, if it was odd I was fine. Seems like a minor and trivial thing, but it ain't minor when it kills max.
      wes
      On 9/19/06, Mike Sayre wrote: > > Hi all, > I've posted about this before, but have yet to find a solution. I've been trying to write some externals - some of them for MSP, and now I'm trying to work with some Jitter externals. I was using MingW, but after having a lot of problems with weird crashes, I've switched to Visual Studio. However, I am still having the same problems. > I took a Jitter object that I knew to compile correctly AND work in Max exactly as intended. I gutted it and changed some names around, but left the bones of the instantiation routine unaltered. It compiles + links with no problems. When I start Max, I can use the File->Install command without a crash. However, when I attempt to instantiate the object, Max just vanishes without any error messages and nothing in the syslog. I am sitting here with two monitors comparing the code from the working object and the non-working object, and I can't find anything different about them other than names. This is obviously getting extremely frustrating. Can anyone tell me what's wrong with this? > ><<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>> > /* > jit_haarCascade > Mike Sayre > mesayre@bsu.edu > > Created using the haar-like Features algorithms of OpenCV, modified for Jitter > > last modified: 18-9-2006 > */ > > #include "jit.common.h" > #include "max.jit.mop.h" > > typedef struct _max_jit_haarCascade > { > t_object ob; > void *obex; > } t_max_jit_haarCascade; > > t_jit_err jit_haarCascade_init(void); > > void *max_jit_haarCascade_new(t_symbol *s, long argc, t_atom *argv); > void max_jit_haarCascade_free(t_max_jit_haarCascade *x); > void *max_jit_haarCascade_class; > > void main(void) > { > void *p,*q; > > jit_haarCascade_init(); > setup(&max_jit_haarCascade_class, max_jit_haarCascade_new, (method)max_jit_haarCascade_free, (short)sizeof(t_max_jit_haarCascade), > 0L, A_GIMME, 0); > > p = max_jit_classex_setup(calcoffset(t_max_jit_haarCascade,obex)); > q = jit_class_findbyname(gensym("jit_haarCascade")); > max_jit_classex_mop_wrap(p,q,0); > max_jit_classex_standard_wrap(p,q,0); > addmess((method)max_jit_mop_assist, "assist", A_CANT,0); > } > > void max_jit_haarCascade_free(t_max_jit_haarCascade *x) > { > max_jit_mop_free(x); > jit_object_free(max_jit_obex_jitob_get(x)); > max_jit_obex_free(x); > } > > void *max_jit_haarCascade_new(t_symbol *s, long argc, t_atom *argv) > { > t_max_jit_haarCascade *x; > void *o; > > if (x=(t_max_jit_haarCascade *)max_jit_obex_new(max_jit_haarCascade_class,gensym("jit_haarCascade"))) { > if (o=jit_object_new(gensym("jit_haarCascade"))) { > max_jit_mop_setup_simple(x,o,argc,argv); > max_jit_attr_args(x,argc,argv); > } else { > error("error in [max_jit_haarCascade_new]"); > freeobject(x); > } > } > return (x); > } > > ><<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>> > > /* > jit.haarCascade > Mike Sayre > mesayre@bsu.edu > > Created using the haar-like Features algorithms of OpenCV, modified for Jitter > > last modified: 19-9-2006 > */ > > //Max includes > #include "jit.common.h" > > //OpenCV includes > #include "cv.h" > #include "highgui.h" > > //System includes > #include > #include > #include > #include > #include > #include > #include > #include > #include > > > //Create class > typedef struct _jit_haarCascade > { > t_object ob; > > CvMat in_cv_mat; > CvMat out_cv_mat; > CvMat *temp_cv_mat; > > } t_jit_haarCascade; > > void *_jit_haarCascade_class; > > //Constants (from facedetect.c) > /* > static CvMemStorage* storage = 0; > static CvHaarClassifierCascade* cascade = 0; > > char* cascadeName = "haarcascade_frontalface_alt.xml"; //temporary default > */ > > //jitter object/MOP methods > t_jit_err jit_haarCascade_init(void); > t_jit_haarCascade *jit_haarCascade_new(void); > void jit_haarCascade_free(t_jit_haarCascade *x); > //t_jit_err jit_haarCascade_matrix_calc(t_jit_haarCascade *x, void *inputs, void *outputs); > > //data processing methods > > //attribute methods > > //message methods > //t_jit_err jit_haarCascade_loadCascade(t_jit_haarCascade *x, t_symbol *s); //Load a Haar Cascade (dialog box) > > > t_jit_err jit_haarCascade_init(void) > { > long attrflags=0; > t_jit_object *attr,*mop,*o; > t_symbol *atsym; > t_atom a[2]; > > atsym = gensym("jit_attr_offset"); > > _jit_haarCascade_class = jit_class_new("jit_haarCascade",(method)jit_haarCascade_new,(method)jit_haarCascade_free, > sizeof(t_jit_haarCascade),0L); //A_CANT = untyped > > //add mop > mop = jit_object_new(_jit_sym_jit_mop,1,1); > //jit_mop_single_planecount(mop,1); > jit_atom_setsym(a,_jit_sym_char); > jit_atom_setsym(a+1,_jit_sym_long); > > o = jit_object_method(mop,_jit_sym_getoutput,1); > jit_object_method(o,_jit_sym_types,2,a); > > jit_class_addadornment(_jit_haarCascade_class,mop); > > //add methods > //jit_class_addmethod(_jit_haarCascade_class, (method)jit_haarCascade_matrix_calc, "matrix_calc", A_CANT, 0L); > //jit_class_addmethod(_jit_haarCascade_class, (method)jit_haarCascade_loadCascade, "loadCascade", A_CANT, 0L); > > //add attributes > attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW; > > > //setup symbols > > //Register class > jit_class_register(_jit_haarCascade_class); > > return JIT_ERR_NONE; > } > > t_jit_haarCascade *jit_haarCascade_new(void) > { > t_jit_haarCascade *x; > > return x; > } > > void jit_haarCascade_free(t_jit_haarCascade *x) > { > //jit_haarCascade_kernel_free(x); > //cvReleaseMat(&(x->temp_cv_mat)); > } > > Thanks, > Mike >
    • Sep 20 2006 | 4:04 am
      Well, this time around it was nothing so sinister. I just forgot the following:
      x = (t_jit_haarCascade *)jit_object_alloc(_jit_haarCascade_class);
      ...in my instantiation routine. Whoops. Boom. But it works now that I put that in there.
      Anyway, I will try going through opencv in debug mode if I have any of those kinds of weird problems.
      Thanks, Mike