rawImages of VB6 to XOJO

  1. ‹ Older
  2. 4 months ago

    ronaldo f

    Jun 30 Pre-Release Testers, Xojo Pro Philippines

    Thanks for the Idea Julian.

    Unfortunately, the picture that has to be shown on a imagewell is currently sits on a object called rawImage_param which is shown below.

    -image-

    Got a hard time searching from forum on how to get individual values (rawImage_param ) so that I can apply it from the sample code you sent.

    Any idea?

  3. Julian S

    Jun 30 Pre-Release Testers, Xojo Pro UK
    Edited 4 months ago

    Do you call GrCapRawImageToHandle to get back a handle to a HBITMAP if not how to you populate rawImage_param with the data, are you getting a pointer to the data from the ImageCallback?

  4. Eugene D

    Jun 30 Pre-Release Testers, Xojo Pro Canada scispec.ca

    Hi Ronaldo,

    Could I ask you to make a rawImage file that says something like "Hello World" and post it for a few of us to download and determine the structure of the image for you? Like Julian mentioned, without an example image, its really difficult to determine the format to convert the image.

    I don't want data from a picture of your fingerprint, since this is personal data :)

  5. ronaldo f

    Jun 30 Pre-Release Testers, Xojo Pro Philippines

    HI Julian,

    " how to you populate rawImage_param with the data" - After I touch the Finger print scanner, XOJO win app captured the data and present to me the RawImage_Param as shown from the photo.

    -image-

    My problem now is, how to extract it to form as binary stream or memoryblock.

  6. ronaldo f

    Jun 30 Pre-Release Testers, Xojo Pro Philippines

    HI Eugine,

    "Could I ask you to make a rawImage file " - Actually, that's my problem. there is no image available yet. The finger print scanner just return value in RawImage_param which I dont know how to extract it to create a photo.

  7. Julian S

    Jun 30 Pre-Release Testers, Xojo Pro UK
    Edited 4 months ago

    If you put the following in your code, what do you see on the debug output:

    system.DebugLog(str(rawImage_Param(0)))
    system.DebugLog(encodehex(str(rawImage_Param(0))))

    How many rows are there in the data?
    What is the width and height of the image from the data shown above or is there nothing to indicate that?
    Who wrote your Xojo win app, do you have access to the source code of it?

  8. ronaldo f

    Jul 1 Pre-Release Testers, Xojo Pro Philippines

    Hi Julian,

    for your questions:
    1. A total of 138,430 (index of 0) as shown from the screenshot
    -image-

    2. Height = 390, Width 355. This was also returned by fingerprint event. See picture below
    -image-

    3. It was written on Visual Basic 6 before and I am converting it to Xojo Desktop.

  9. Julen I

    Jul 1 Europe

    Just to make sure we are talking about the same thing, what you expect to get is the grayscale picture on you post above, without the overlayed analysis of the image, right?

    If so, as mentioned by others, it looks like each of those bytes you have in VB corresponds to the 8 bit grayscale value of each pixel of your image. The VB array has a total of 138450 elements which could correspond to a 355x390 image.

    Something to consider when using the data you have: in the hexadecimal data you get in Xojo the last two bytes repeat for all elements in the array.

    Also, a grayscale pixel of value PixelValue correponds to a RGB pixel of value RGB(PixelValue, PixelValue, PixelValue).

    If the image you are expecting to get includes the overlayed analysis, forget about the grayscale.

    HTH,

    Julen

  10. ronaldo f

    Jul 1 Pre-Release Testers, Xojo Pro Philippines

    Hi Julen,

    Looks like you right.

    In visual basic, after acquiring the fingerprint, the image is shown is Gray as seen in the photo

    -image-

    In XOJO, I want to disply it also. Unfortnately, I am stucked on converting the RawImage value to actual photo.

    Maybe you can help too?

  11. Julian S

    Jul 1 Pre-Release Testers, Xojo Pro UK
    Edited 4 months ago

    And what do you see on your debug output when you put this at the top of ImageAquired_Event?

    system.DebugLog(str(rawImage_Param(0)))
    system.DebugLog(encodehex(str(rawImage_Param(0))))
  12. Christian S

    Jul 1 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    If you have such an image to download, I'd love to play with the bytes and see if I can show you some code.

  13. ronaldo f

    Jul 1 Pre-Release Testers, Xojo Pro Philippines

    Hi Julian,

    I encountered "not an array" error as shown

    -image-

  14. ronaldo f

    Jul 1 Pre-Release Testers, Xojo Pro Philippines

    HI Chris,

    I wish I can extract or convert this RawImage_param to a file. But I can access the element. Xojo told that its an object and not an array as shown here

    -image-

  15. Julian S

    Jul 1 Pre-Release Testers, Xojo Pro UK
    Edited 4 months ago

    Ronaldo, are you able to PM me the project so I can have a dig? I know what the problem is but I don't know why GrFingerXLib is using Variants to store pointers to strings. They should really be using a the pointer returned from the unsigned char* rawImage

  16. Julian S

    Jul 1 Pre-Release Testers, Xojo Pro UK
    Edited 4 months ago

    Or you could change

    rawImage_Parm As Variant

    to

    rawImage_Param As Ptr

    and where ever else it is mentioned throughout the project

    then use the following code inside ImageAcquired_Event

    Dim pic As Picture = New Picture(width_Param, height_Param)
    
    Dim surface As RGBSurface = pic.RGBSurface
    
    Dim offset As Integer = 0
    
    For y As Integer = 0 To height_Param - 1
      For x As Integer = 0 To width_Param - 1
        surface.Pixel(x, y) = rgb(rawImage_Param.Byte(offset), rawImage_Param.Byte(offset), rawImage_Param.Byte(offset))
        offset = offset + 1
      Next
    Next
    
    ImageWell1.Image = pic

    I'm coding blind here, so you might need to fix some syntax issues.

  17. ronaldo f

    Jul 1 Pre-Release Testers, Xojo Pro Philippines

    I can share here the code but you need the actual device so that the image can be acquire.

    This is the device that I am using.
    -image-

    Here is the file
    https://www.mediafire.com/file/ekbqy5q10okm8nd/fp2.xojo_binary_project/file

  18. Julian S

    Jul 1 Pre-Release Testers, Xojo Pro UK
    Edited 4 months ago

    Ah, ActiveX, other than hacking around the control to change the Variants to pointers I'll try to use what you have, I don't use variants so there might be a better way to convert the Variant Array of Objects to a usable format, but this should get you going, put this inside the ImageAcquired_Event:

    Dim o() As Object = rawImage_Param
    
    Dim pic As New Picture(width_Param, height_Param)
    
    Dim surface As RGBSurface = pic.RGBSurface
    Dim offset As Integer = 0
    Dim tmp As Integer
    
    For y As Integer = 0 To height_Param - 1
      For x As Integer = 0 To width_Param - 1
        tmp = asc(str(o(offset)))
        //system.DebugLog(str(tmp))
        surface.Pixel(x, y) = rgb(tmp, tmp, tmp)
        offset = offset + 1
      Next
    Next
    
    ImageWell1.Image = pic
  19. Julian S

    Jul 1 Pre-Release Testers, Xojo Pro UK
    Edited 4 months ago

    If anyone is interested in trying to get the data out via a quicker method, here's a way to set up the rawImage_Param variable to contain data similar to how Ronaldo is finding it.

    Dim o() As Object
    
    Dim v1 As Variant = "a"
    Dim v2 As Variant = "b"
    Dim v3 As Variant = "c"
    
    o.append(v1)
    o.append(v2)
    o.append(v3)
    
    Dim rawImage_Param As Variant = o
    Break

    Edit: Made the demo work on win or mac by not using COM

  20. ronaldo f

    Jul 1 Pre-Release Testers, Xojo Pro Philippines

    Thank Julian!

    Manipulating PICTURE is very new to me.

    I placed the exact code you provide me and here's the result!

    -image-

    I thought I will end up chasing to convert my old VB6 finger print to xojo.

    I am now amazed and motivated to continue my conversion.

  21. Julian S

    Jul 1 Pre-Release Testers, Xojo Pro UK

    You are more than welcome Ronaldo, I learned a few things too :)

or Sign Up to reply!