It's my first time working with images and I'm trying to save in Image as 16 bit greyscale tiff file that should look like 1 from the attached picture.
I've tried using img.Save(".\\\\MyFile\\\\myImage.tif",ImageFormat.Tiff);
but the result was 2 from attached picture.
I've changed the save to
EncoderParameters eps = new EncoderParameters(2);
eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.ColorDepth,24L);
eps.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.Compression,(long)EncoderValue.CompressionNone);
//var ei = GetEncoderInfo(ImageFormat.Tiff);
var ei = GetEncoderInfo("image/tiff");
img.Save(".\\MyFile\\myImage.tif", ei, eps);
and because color depth cannot be 16 I only managed to obtain the result 3 from attached picture. Is there a way to save the image as uncompressed 16 bit grayscale tiff file without using other libraries?
Use OpenCV like:
cv::Mat rawData( height_, width_, CV_16UC1, (void*)pPicData_);
cv::imwrite(fileName_.toStdString().c_str(), rawData);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.