Link to home
Start Free TrialLog in
Avatar of Werner Pretorius
Werner Pretorius

asked on

How to save a image using imagedata (C++ sample to vb.net)

I have a sample application written in C++ for a slap scanner. I am able to get the image scanned but do not know what to do with the data received. Can anybody guide me in the right direction?

I have attached the SaveImage Code from the sample app(Written in C++) and would like to know how convert it to vb.net. I am novice when it comes to C++.

I have tried to read the bytes from memory starting at the pointer returned to the tagImageData structure during the scanning process.

here is the structure that contains the image data:
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> Public Structure tagImageData
        Public Buffer As IntPtr '< Pointer to image buffer
        Public Width As UInteger       '< Image horizontal size
        Public Height As UInteger      '< Image vertical size
        Public ResolutionX As Double  '< Horizontal image resolution (in PPI)
        Public ResolutionY As Double  '< Vertical image resolution (in PPI)
        Public FrameTime As Double    '< Image acquisition time (in seconds)
        '< This value contains the time taken for acquisition
        '< from device (excluding processing time).
        Public Pitch As Integer       '< Image line pitch (in Bytes).
        '  Positive values indicate top down line order,
        '  Negative values mean bottom up line order
        Public BitsPerPixel As Byte   '< Number of Bits per pixel
        Public Format As Integer      '< Image color format
        Public IsFinal As Boolean     '< Marks image as finally processed
        '  A value of "FALSE" disqualifies image for further processing.
        '  (e.g. interim or preprocessed result images)
    End Structure
SaveImage.cpp
SaveImage.h
ASKER CERTIFIED SOLUTION
Avatar of Werner Pretorius
Werner Pretorius

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Werner Pretorius
Werner Pretorius

ASKER

I managed to solve the problem myself. I was reading the memory until i reach a null value at first. I decided to read the memory for (width * height ) number of bytes and that seemed to do the trick