Boa Noite!
Pessoal, preciso de uma ajudinha
preciso contar pontos luminosos em imagens 3D usando coordenadas X Y Z Altura Largura e Profundidade
se alguem puder me dar uma dica por onde começar
agradeço a atenção de Todos
Atenciosamente javaX
Boa Noite!
Pessoal, preciso de uma ajudinha
preciso contar pontos luminosos em imagens 3D usando coordenadas X Y Z Altura Largura e Profundidade
se alguem puder me dar uma dica por onde começar
agradeço a atenção de Todos
Atenciosamente javaX
Descreva melhor seu problema. O que é uma imagem 3D? Um modelo? Duas imagens estereoscópicas?
Como são esses pontos? Pode postar duas ou mais imagens de exemplo?
Vini Agradeço sua atenção
ainda não tenho essas imagens , porem assim que tiver posto
precisarei muito da ajuda de Vocês
Tentei passar as informações que tenho no momento
Até onde eu sei e para medir radiação em uma imagem ou seja
essa imagem seria uma foto onde eu teria uma cor fluorecente em verde
onde a radiação foi maior aplicada , tem haver com radioterapia
Atenciosamente JavaX
Só depois das imagens poderemos auxiliar, então.
Até lá leia sobre o espaço de cor hsv e sobre thresholding.
Vini
Bom dia!
Preciso de uma ajudinha estou trabalhando em um projeto
onde tenho uma maquina fotografica que acesso atravez de uma dll escria em c++ e uso o Jna para acessar
ate ai tudo Ok , porem a dll me retorna um endereco de memoria , e preciso transforma esse endereco em imagem
vc tem alguma ideia de como posso fazer isso
pesquisando em alguns site achei esse que manipula a nemoria em java
fico grato por toda a ajuda que poder me dar
Att JavaX
Só sabendo o que diabos vc fez no seu JNI.
Mas o ponteiro provavelmente aponta para a região de memória onde os dados da imagem estão. Como vc tem a largura, altura e densidade da imagem, basta ler esses dados ainda no JNI e carrega-los num byte array. E esse byte array vc retorna para o Java num byte[] ou num ByteBuffer.
Com isso, basta usar o ImageIO.read para carregar os dados num BufferedImage.
Vini
Obrigado pela sua Atenção :
O codigo abaixo onde acesso a dll usando o Jna
me Retora isso = native@0x4d20020
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package neo;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import neo.ArtemisHSC.ArtemisImageBuffer;
/**
*
* @author administrador
*/
public class Neo {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println(new File("native").getAbsolutePath());
//Carrega os drivers da camera
ArtemisHSC driver = (ArtemisHSC) Native.loadLibrary("native/ArtemisHSC.dll", ArtemisHSC.class);
//Exibe versão dos Drivers
System.out.println("Version: " + driver.ArtemisAPIVersion());
//Conecta à camera
ArtemisHSC.ArtemisHandle camera = conectar(driver);
if(camera == null) {
System.out.println("Não foi possivel conectar à camera!");
} else {
System.out.println("Conectado!");
capturar(camera, driver);
desconectar(driver, camera);
}
}
//Carrega a Dll de acesso à camera
public static ArtemisHSC carregarDrivers() {
return (ArtemisHSC) Native.loadLibrary("native/ArtemisHSC.dll", ArtemisHSC.class);
}
//Conecta à camera
public static ArtemisHSC.ArtemisHandle conectar(ArtemisHSC driver) {
return driver.ArtemisConnect(-1);
}
//Conecta à camera
public static boolean desconectar(ArtemisHSC driver, ArtemisHSC.ArtemisHandle camera) {
return driver.ArtemisDisconnect(camera);
}
//Captura imagem da camera
public static void capturar(ArtemisHSC.ArtemisHandle camera, ArtemisHSC driver) {
int ExposureDuration=100; // exposure time in milliseconds
// Don't switch amplifier off for short exposures
driver.ArtemisSetAmplifierSwitched(camera, ExposureDuration>2.5f);
// Start the exposure
driver.ArtemisStartExposure(camera, ExposureDuration*0.001f);
// SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)));
// Wait until it's ready, or ESC is pressed.
// A more polished app would not use this method!
while(!driver.ArtemisImageReady(camera))
{
try {
// if (GetAsyncKeyState(VK_ESCAPE)&0x8000)
// {
// ArtemisAbortExposure(hCam);
// return;
// }
Thread.sleep(100);
} catch (InterruptedException ex) {
Logger.getLogger(Neo.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();
driver.ArtemisGetImageData(camera, xRef, yRef, widRef, hgtRef, binxRef, binyRef);
int x, y, wid, hgt, binx, biny;
x = xRef.getValue();
y = yRef.getValue();
wid = widRef.getValue();
hgt = hgtRef.getValue();
binx = binxRef.getValue();
biny = binyRef.getValue();
int nImgBuf = 0;
short[] pImgBuf = null;
Pointer pimg= driver.ArtemisImageBuffer(camera);
System.out.println(pimg);
// Codigo que aparece native@0x4d30020
if (pimg != null)
{
// make sure we have enough space to store the image
int imgsize=wid*hgt;
if (nImgBuf<imgsize)
{
nImgBuf=imgsize;
pImgBuf =new short[nImgBuf];
}
// pimg.getShort(412221472);
pImgBuf = pimg.getShortArray(0, 1000);
BufferedImage bImageFromConvert;
System.out.println("");
// memcpy(pImgBuf, pimg, imgsize*2);
// imgW=wid;
// imgH=hgt;
// InvalidateRect(camera, null, false);
}
// SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
}
}
se for possivel , poderia me dar um exemplo , ou linkis pra que eu possa fazer isso
Att Javax
Provavelmente não faz sentido imprimir a classe Pointer, ela não tem o toString() implementado.
Que métodos essa classe tem? Não tenho acesso aos Javadocs dessa API que você está usando, por isso, fica difícil te ajudar.
Se vc arranjar um byte[] com os dados da imagem, fica fácil carrega-la.
[quote=ViniGodoy]Provavelmente não faz sentido imprimir a classe Pointer, ela não tem o toString() implementado.
Que métodos essa classe tem? Não tenho acesso aos Javadocs dessa API que você está usando, por isso, fica difícil te ajudar.
Se vc arranjar um byte[] com os dados da imagem, fica fácil carrega-la.[/quote]
Vini
Bom dia!
Solicito uma ajudinha sua , se vc poder e claro
estou conseguindo gerar imagem com o que tenho abaixo porem a imagem sai toda preta se poder me informa onde estou erando
e gostaria de um Exemplo de como seria um array de byte[] com a informação que preciso ter para poder gerar uma imagem
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);
int imgsize = wid*hgt;
int[] data = new int[wid * hgt];
BufferedImage image = new BufferedImage(wid, hgt, BufferedImage.TYPE_INT_RGB);// a profundidade foi especificada em TYPE_INT_RGB, ou seja 3 bytes(um para cada banda)
image.setRGB(0, 0, wid, hgt, data, 0, wid);
ImageIO.write(image, "BMP", new File("c:\\java\\Teste.bmp"));
Att Javax
A imagem sai toda preta porque você está errando ao montar a imagem que pega do byte buffer. Seguinte:
a primeira coisa que precisa fazer é ter certeza de que a fonte está te entregando esse bytebuffer de maneira correta. O melhor jeito de fazer isso é recuperar um vetor de bytes a partir dele e verificar se a imagem não está preta, ou seja, se o vetor não está completamente zerado.
Após isso você pode voltar a trabalhar na síntese da imagem.
Essa imagem vem mesmo no formato raw? Se for um png ou bmp, a forma correta seria criar um ByteArrayInputStream com os bytes e carregar a imagem com o método ImageIO.read:
ByteArrayInputStream input = new ByteArrayInputStream(data);
BufferedImage imagem = ImageIO.read(input);
Outra coisa. Não vi em seu código onde você carrega o array data. Você apenas criou ele, sem atribuir nada a seu valor.