How to read / write bytes from/to B4XBitmap ?
Image can be processed by this method ?
Is it best solution for image recognition ? Any other better way ?
Public Sub ImageToBytes(Image As B4XBitmap) As Byte()
Dim out As OutputStream
out.InitializeToBytesArray(0)
Image.WriteToStream(out, 100, "JPEG")
out.Close
Return out.ToBytesArray
End Sub
BytesToImage:
Public Sub BytesToImage(bytes() As Byte) As Image
Dim In As InputStream
In.InitializeFromBytesArray(bytes, 0, bytes.Length)
Dim bmp As Image
bmp.Initialize2(In)
In.Close
Return bmp
End Sub
@xulihang: Why are you taking credit for these tools when they were made by Erel in this link in 2018. How are they different. Maybe you mean 'Used them with B4J'?
This code is no longer needed. Use File.WriteBytes / ReadBytes. Write an array of bytes to a file and read a file into an array of bytes. Sub BytesToFile (Dir As String, FileName As String, Data() As Byte) Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)...
Hello, im searching for a solution to find a given Area in an Image. I want to make screenshots and simulate Mousclicks on specific areas when something is found. the Area bitmap is fix in my assets, and i need the coordinates where this little Area image is shown in the screenshot. this area...