2
protected IplImage processImage(byte[] data, int width, int height) {
int f = 4;// SUBSAMPLING_FACTOR;
// First, downsample our image and convert it into a grayscale IplImage
IplImage grayImage = IplImage.create(width/f, height/f, IPL_DEPTH_8U, 1);
int imageWidth = grayImage.width();
int imageHeight = grayImage.height();
int dataStride = f * width;
int imageStride = grayImage.widthStep();
ByteBuffer imageBuffer = grayImage.getByteBuffer();
for (int y = 0; y < imageHeight; y++) {
int dataLine = y * dataStride;
int imageLine = y * imageStride;
for (int x = 0; x < imageWidth; x++) {
imageBuffer.put(imageLine + x, data[dataLine + f * x]);
}
}
return grayImage;
}
onPreviewFrame (byte [] 데이터, 카메라 카메라)에서 IplImage를 가져와야합니다. 내가 작성한 방식으로 원래 이미지보다 훨씬 작은 iplimage가 생성됩니다. 새 iplimage에서 동일한 치수를 유지할 수있는 방법이 있습니까? 서브 샘플링 요소를 피할 수 있을까요? 내가 어떻게 할 수 있니?Android : 자바 카메라에서 IplImage 가져 오기
네 말이 맞아 내가 바보 야! :) 나는 왜 그런지 모르지만 내가 서브 샘플을하지 않으면 이미지가 4 번 복제되기 전에 ...하지만 지금은 작동합니다! 감사! –