Salut

j'utilise une librairie pour traiter une image que j'ai téléchargé du net (libpotrace.dll)en C, grâce à sa documentation j'ai pu avoir les paramètre de la fonction que je vais utilisé pour la vectorisation qui est

potrace_state_t *potrace_trace(const potrace_param_t *param, const potrace_bitmap_t *bm);

les paramètres sont :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
typedef unsigned long potrace_word;
 
struct potrace_bitmap_s {
  int w, h;              /* width and height, in pixels */
  int dy;                /* words per scanline (not bytes) */
  potrace_word *map;     /* raw data, dy*h words */
};
typedef struct potrace_bitmap_s potrace_bitmap_t;
 
struct potrace_param_s {
  int turdsize;        /* area of largest path to be ignored */
  int turnpolicy;      /* resolves ambiguous turns in path decomposition */
  double alphamax;     /* corner threshold */
  int opticurve;       /* use curve optimization? */
  double opttolerance; /* curve optimization tolerance */
  potrace_progress_t progress; /* progress callback function */
};
typedef struct potrace_param_s potrace_param_t;
dans mon application java j'ai mis ceci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class Potrace_bitmap_t extends Structure{
    public int w=36;
    public int h=2; /* width and height, in pixels */
    public int dy=2; /* words per scanline (not bytes) */      
    public long [] map =new long[dy*h];
}
 
public class potrace_param_t  extends Structure{    
    //public static class ByValue extends Nat implements Structure.ByValue { }
 
    public int turdsize=0;
    public int turnpolicy=0;
    public double alphamax=0;
    public int opticurve=0;
    public double opttolerance=0;      
 
}
button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent arg0) {
potrace_param_t na=lib.potrace_param_default();//cette fonction remet les paramètre de potrace_param_t au valeur par défaut
Potrace_bitmap_t bm=new Potrace_bitmap_t();
bm.map[0]=1113215L;
bm.map[1]=4026531840L;
bm.map[2]=3276415L;
bm.map[3]=4026531840L;
Potrace_state_t pt=lib.potrace_trace(na, bm);
}
});
lorsque je lance potrace_param_default()j'ai aucun problème, je peux récupérer et afficher les valeur par défaut.
mais a l'exécution de potrace_trace(na, bm), il m'affiche cette erreur :
An unexpected error has been detected by Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6504fbee, pid=2728, tid=2436

Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing) Problematic frame: C [libpotrace.dll+0xfbee]

An error report file with more information is saved as hs_err_pid2728.log

If you would like to submit a bug report, please visit: http://java.sun.com/webapps/bugreport/crash.jsp

je sais plus comment résoudre ce problème, j'ai chercher sur le forum et google mais aucun des réponse trouvé n'a pu m'aider.

merci pour vos réponse.