ViniGodoy:
Esse asterisco é uma multiplicação, não um ponteiro.
O número de pixels de uma imagem é igual a altura (width) * largura (height).
Primeiramente Valeu por ter respondido Vini
bom tem algo muito estranho que não estou conseguindo identificar
porque quando dou um debug em C++
o conteudo das variaveis seguintes sao
imgsize = -858993460
wid = 1391
hgt = 1030
e quando dou debug em Java
imgsize 1432730
wid =1391
hgt = 1030
segue abaixo o codigo em java
public void Snapshot(){
ArtemisHandle hCam = ConexaoDll() ;
ArtemisHSC driver = carregarDrivers() ;
int ExposureDuration = 100; // exposure time in milliseconds
int nImgBuf=0; // allocated size of buffer
short[] pImgBuf = null;
// Ensure we're connected
if (hCam == null){
JOptionPane.showMessageDialog(null, "Erro Camera não está conectando", "Atenção", JOptionPane.ERROR_MESSAGE, null);
} else {
JOptionPane.showMessageDialog(null, "Camera Conectada com Sucesso", "Confirmação", JOptionPane.INFORMATION_MESSAGE, null);
}
// Don't switch amplifier off for short exposures
driver.ArtemisSetAmplifierSwitched(hCam, ExposureDuration > 2.5f);
// Start the exposure
driver.ArtemisStartExposure(hCam, ExposureDuration*0.001f);
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
// Wait until it's ready, or ESC is pressed.
// A more polished app would not use this method!
while(!driver.ArtemisImageReady(hCam)){
// 27 Cogigo Tecla Esc
if (KeyEvent.KEY_PRESSED == 27){
System.out.println("Saiu do while");
driver.ArtemisAbortExposure(hCam);
break;
}
try {
Thread.sleep(100);
} catch (InterruptedException ex) {
Logger.getLogger(FuncoesCamera.class.getName()).log(Level.SEVERE, null, ex);
}
}
// We'll keep a local copy of the image so we can refresh the display even if
// the original copy is lost.
// Get dimensions of image
IntByReference xRef = new IntByReference();
IntByReference yRef = new IntByReference();
IntByReference widRef = new IntByReference();
IntByReference hgtRef = new IntByReference();
IntByReference binxRef = new IntByReference();
IntByReference binyRef = new IntByReference();
// Get dimensions of image
int x,y,wid = 0,hgt = 0,binx,biny;
driver.ArtemisGetImageData(hCam, xRef, yRef, widRef, hgtRef, binxRef, binyRef);
x = xRef.getValue();
y = yRef.getValue();
wid = widRef.getValue();
hgt = hgtRef.getValue();
binx = binxRef.getValue();
biny = binyRef.getValue();
Pointer pimg= driver.ArtemisImageBuffer(hCam);
System.out.println("pimg "+pimg);
if (pimg != null){
// make sure we have enough space to store the image
int imgsize = wid*hgt;
System.out.println("imgsize "+imgsize+" "+wid+" "+hgt);
if (nImgBuf < imgsize){
//delete[] pImgBuf; //delete em C++ Serve Para Fazer Limpeza de Memoria no java Não e necessario visto que ele ja faz a limpeza
nImgBuf = imgsize;
pImgBuf = new short[nImgBuf];
}
/*
memcpy(pImgBuf, pimg, imgsize*2);
imgW=wid;
imgH=hgt;
InvalidateRect(hWnd, NULL, FALSE);
*/
}
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
}
o que poderia ser
Att JavaX