이 이미지를 메모리에로드하지 않고 * .tif 이미지의 일부를로드하는 방법.전체 이미지를 메모리에로드하지 않고 TIFF 이미지의 일부를로드하는 방법은 무엇입니까?
큰 TIFF 파일로 작업해야합니다. (4GB 이상). BinaryReader
을 사용하여이 파일을 읽으려고 시도했으며 BitMiracle.LibTiff.Classic
을 사용하여 바이트를 이미지로 변환했습니다. 그러나 TIFF 파일의 특정 픽셀을 읽는 방법에 대한 예제를 찾지 못했습니다.
아마도이 작업을위한 해결책이 있습니까?
ImagePart with User Defined Width
ImagePart with User Define Height
ImagePArt with User Defined Location
이 질문은, 어떻게 BigScan.tif
에서 ImagePart
를 얻을 수있다 :
Image Compression - NONE
Pixel Order - Interleaved (RGBRGB)
Byte Order - IBM PC
나는 몇 가지 변수가 :
내가 BigScan.tif
파일을 가지고 항상 말할 수 있습니다?
하지만 (x, y) 좌표가있는 "BigScan.tif"의 픽셀 정보를 읽는 것이 가장 좋습니다.
나는 같은 기능을, 지정된 장소에 BigScan.tif
에서 픽셀을 읽을 필요가 :
public Color GetPixelColorFromTiffImage(string TiffFileName, int PixelPositionX, int PixelPositionY)
{
//Some Code
return returnedColor;
}
아주 이상한하지만 내 quastion unswer 지원 did`t. 누군가 그것을 알고 있을지도 모른다. 왜 코드의이 부분을 BitMiracle Samples에서 "-11512229", "-11838376"등과 같이 '래스터'배열 번호에 썼습니다.
using (Tiff image = Tiff.Open(fullImageLocation, "r"))
{
// Find the width and height of the image
FieldValue[] value = image.GetField(TiffTag.IMAGEWIDTH);
width = value[0].ToInt();
value = image.GetField(TiffTag.IMAGELENGTH);
height = value[0].ToInt();
int imageSize = height * width;
int[] raster = new int[imageSize];
// Read the image into the memory buffer
if (!image.ReadRGBAImage(width, height, raster))
{
MessageBox.Show("Could not read image");
}
using (Bitmap btm = new Bitmap(200, 200))
{
for (int i = 0; i < btm.Width; ++i)
for (int j = 0; j < btm.Height; ++j)
btm.SetPixel(i, j, getSample(i + 330, j + 30, raster, width, height));
ReternedBitmap = btm;
}
}//using
이 정보가 도움이됩니까? http://bitmiracle.com/libtiff/help/how-to-read-tiff-scanlines-in-a-random-fashion.aspx –
글쎄, 나는이 페이지를 보았다. 그러나 나는 그것이 어떻게 도울 수 있는지 아직도 생각하고있다. 어떻게 이것을 사용하여 픽셀의 위치를 설정하고 메인 tif 파일에서 데이터를 읽을 수 있습니까? –
이미지에서 임의의 수의 스켈링을 읽을 수 있습니다. 전체 너비 (x 좌표)를 가져야하는 경우에도 적어도 행 범위 (y 좌표)를 선택할 수 있습니다. 아마도 도움이 될까요? –