Android Question bmp.inizialize3(data as bitmap)

LordZenzo

Well-Known Member
Licensed User
Longtime User
Sto usando la funzione bitmap Initialize3 per copiare una foto in una nuova immagine da passare in seguito alla libreria MobileVisionBitmap
ma la copia non è fatta,
infatti nel tooltip si può leggere tra parentesi (la copia viene eseguita se necessario)
come faccio a forzare la copia ogni volta?
e poi perche devono esserci dei casi in cui non copia? se uso quella funzione è perche voglio la copia ogni volta la uso

(google traslator)

I'm using the bitmap function Initialize3 to copy a photo into a new image to be passed to the MobileVisionBitmap library
but the copy is not made,
in fact, in the tooltip you can read in brackets (the copy is executed if necessary)
how can I force the copy every time?
and then why should there be cases in which he does not copy? if I use that function it's because I want the copy every time I use it
 

LordZenzo

Well-Known Member
Licensed User
Longtime User
routine incriminata
B4X:
Sub CatturedGoText
    If Not(SetRetro) Or Not(SetFronte) Then Return
    If OCRpane="" Then
        Dim bmp As Bitmap=FotoRetro
        bmp.Initialize3(FotoRetro)
        'OCR
        OCRpane="2"
        mvbm.decodeBitmap(bmp)
    
        bmp.Initialize3(FotoFronte)
        'OCR
        OCRpane="1"
        mvbm.decodeBitmap(bmp)
    End If
    Log("3")
    camEx.CloseNow 'restart preview
    StartActivity(Inserimento)
    
End Sub
this code
 
Upvote 0

LordZenzo

Well-Known Member
Licensed User
Longtime User
Immagine.png


la copia non viene eseguita, ma è assolutamente necessaria, come faccio a forzare che avvenga?

the copy is not performed, but it is absolutely necessary, how can I force it to happen?
 
Upvote 0

LordZenzo

Well-Known Member
Licensed User
Longtime User
1.png
2.png

@Erel come si risolve?

the ocr degrades the image
here is the need for a copy to "degrade" and one to save, as if I did a photocopy of a book and then pass the marker on the words I have to memorize, I do it on the photocopy so as not to ruin the book
but if the pointers are identical, ruining one will ruin the other
 
Last edited:
Upvote 0

LordZenzo

Well-Known Member
Licensed User
Longtime User
Why do you need to make a copy? A non-mutable bitmap cannot be changed anyway.

when it passes through MobileVisionBitmap the bitmap is degraded and emptied, but I need it to remain, so I make a copy with Initialize3 which should create an independent copy, but although in other places in the program it works, this routine does not work
 
Upvote 0

LordZenzo

Well-Known Member
Licensed User
Longtime User
If the bitmap is not mutable then it cannot be changed. You are doing something wrong.

it's not me editing the bitmap but the MobileVisionBitmap library
if you do not believe you can do all the tests you want, I have lost one night and many dozens of tests, the solution would be that Initialize3, but in that, and only in that routine behaves abnormally
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Bitmap.Initialize3 behaves exactly as it should. It is very rarely needed. The only case where it can be useful is if you want to convert a mutable bitmap to an immutable bitmap. If the original bitmap is already an immutable bitmap then it doesn't do anything.

Immutable bitmaps should not be modified. If this library modifies such bitmaps then the problem is in the library. You can always copy the bitmap yourself with Canvas.DrawBitmap.
 
Upvote 0
Top