rawImages of VB6 to XOJO

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

Hi Julen,

Looks like you right.

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

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?

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))))

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.

Hi Julian,

I encountered “not an array” error as shown

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

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

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

[code]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[/code]

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

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.

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

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:

[code]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[/code]

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.

[code]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[/code]

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

Thank Julian!

Manipulating PICTURE is very new to me.

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

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.

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