This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
DPI Not Respected in UnmanagedImage.ToManagedImage() #896
Open
Description
What would you like to submit? (put an 'x' inside the bracket that applies)
- question
- bug report
- feature request
Issue description
I have a 300 DPI bitonal image that I'm trying to process with Accord.Net. The code looks something like this:
var img2 = Accord.Imaging.Image.FromFile(@"C:\Some\Folder\PCAMatching\haystack.tif");
var tgtImg = UnmanagedImage.FromManagedImage(img2.Clone(PixelFormat.Format24bppRgb));
.... some other code here
var tm = new ExhaustiveTemplateMatching(0.9f);
int padding = 50;
var cropRect = new Rectangle(bestMatch.X - padding, bestMatch.Y - padding, srcImg.Width + padding * 2, srcImg.Height + padding * 2);
var cropROI = new Crop(cropRect);
var cropBmp = cropROI.Apply(tgtImg);
TemplateMatch[] matchings = tm.ProcessImage(cropBmp, srcImg);
Bitmap sourceImage = tgtImg.ToManagedImage();
At this point sourceImage is now 96 DPI versus the 300 DPI image that I originally loaded.
I haven't studied the code but I do not see a property on UnmanagedImage for Horizontal or Vertical Resolution. I suspect that's part of the problem.
Thanks,
Darren