1

I am using Twain Dot Net to scan a relatively simple image and ultimately I am using Emgu CV to find the edges. Here is a screenshot of something I have scanned:

white/gray image

However I adjust the thresholds in the image detection I get exactly the same edge detected but it is not the correct position (it is too wide - the thing I have scanned is grey). If I scan an image that is black like this I get the edge detected that I would expect:

black image

In both cases you can see a purple edge (which is not there on the real object).

My feeling is that this purple edge is causing the edge detection to do the wrong thing for the first one because it matches where the purple is but for the black one it matches where the black is (because the intensity of the black is higher than purple but the intensity of the grey is not). I am thinking that would explain why adjusting the threshold values in emgu makes no difference.

So, my question is - is there a twain setting that I can set to remove this purple or is it a feature of the scanner (I found this interesting discussion on Flickr that points to the hardware but I have tried it with three different scanners (two the same model, one completely different) and they all do the same)?

Here is the code I am using to scan the image:

var resolution = new ResolutionSettings
{
    Dpi = 2400,
    ColourSetting = ColourSetting.Colour
};

var rotation = new RotationSettings
{
    AutomaticBorderDetection = false,
    AutomaticDeskew = false,
    AutomaticRotate = false,
    FlipSideRotation = FlipRotation.FanFold
};

var areaSettings = new AreaSettings(Units.Centimeters, 
    4.0f,
    0.0f, 
    6.0f, 
    19.0f)

var twainSettings = new TwainScanSettings
{
    UseDocumentFeeder = null,
    ShowTwainUI = false,
    ShowProgressIndicatorUI = false,
    UseDuplex = false,
    Resolution = resolution,
    Area = areaSettings,
    AdditionalLight = true,
    Rotation = rotation
};

var scanner = new TwainEngine(new WinFormsWindowMessageHook(form.Handle));
scanner.SelectSource("Microtek ScanWizard EZ");
scanner.TransferImage += (tsender, targs) =>
{
    targs.Image.Save(@"c:\Users\Public\out.bmp",
        System.Drawing.Imaging.ImageFormat.MemoryBmp);
};

scanner.StartScanning(twainSettings);
kmp
  • 10,535
  • 11
  • 75
  • 125
  • Does the purple exist if you scan a document with the built-in scanning module of your scanner? If not, probably the purple is caused by Twain Dot Net. And then you can contact its tech support. – flysakura Jun 15 '12 at 05:30

0 Answers0