I am starting to create a simple app that, at the moment, should at least save the image that I try to take with my camera to the download folder. The code I’m posting is this:
When I click the “Take Photo” button, it seems like something happens, but when I go into a file manager, I don’t see anything in the “Download” folder. I would expect to find the photo I just took. The app is set up correctly, but the photo is not being taken. I am testing in “Kompanion” mode through qr code, but I also tried building the app into an APK to see if, as user Professional suggested, it was a permissions issue. However, it is not a permissions issue because, when I open the app for the first time, Android asks if I want to grant read and write permissions. Any other ideas? In the meantime, I am trying to read the documentation for the Surface View component, which seems quite sparse, honestly. Is it just me who dont know how to read documentation?
Anyway thank you for your replies. I’m waiting for more suggestions
Okay, I finally managed to do it, it was nothing more than this:
I hadn’t realized that the image was being saved in this specific path. In the end, I don’t care much because now comes the trickier part. I should take that same image and convert the text present in the image into textual format. So, I’m using the OCR component. I tried messing around with it a bit, the text file gets saved but inside the text file there isn’t the converted text but instead there’s this error written:
{"OCRExitCode":3,"IsErroredOnProcessing":true,"ErrorMessage":["Not a valid base64 image. The accepted base64 image format is 'data:<content_type>;base64,<base64_image_content>'. Where 'content_type' like 'image/png' or 'image/jpg' or 'application/pdf' or any other supported type."],"ErrorDetails":"Not a valid base64 image. The accepted base64 image format is 'data:<content_type>;base64,<base64_image_content>'. Where 'content_type' like 'image/png' or 'image/jpg' or 'application/pdf' or any other supported type.","ProcessingTimeInMilliseconds":"0"}
I have made the changes you requested to make the code dynamic; I would have made them anyway later on. Initially, I had statically placed those values to test the code. I have also added the labels you asked for and found that as soon as it enters the OCR1.GotResponse block, it throws an error and the labels are not created. This is the new code:
Note that the value of the label is fixed at the second-to-last block; the last block is not even taken into consideration. Also, note that there is another error at the bottom where I can’t understand because the text is truncated.
To respond to @Professional, at first I tried with @ but the message informed me that my level is too low to use that function. Nevertheless, I inserted the block you advised, but there are no errors or alerts, the only thing that happens after about ten seconds is that the application crashes. As for @Taifun, I modified the code as you told me, but when I try to take a photo, the label shows nothing. I am trying in every way to solve the situation, but I can’t understand where the problem lies. I even thought that it was the API that I hadn’t inserted, but the API key is included. There’s some piece I’m missing and I can’t figure it out.
You are calling to check the OCR server status without checking the response… what about using the Got Server Status event and if the server is available, then continue with your logic?
Also if something is not working you should debug your blocks… for example display the image from the Picture Created event in another label as test
first of all, the image is generated, but I already knew this because I found the image in the path I mentioned earlier. As for the server response, I’m not sure how to interpret the result. What does begin 0, end -1, length 4514 mean? I imagine it means that the server has given a response and that it has generated the result in OCR? In any case, the situation remains the same. Regarding the scope for the component file, it is on legacy. As shown in the screenshot:
I remind you that I believe I am missing some steps that are currently escaping me. I am reading and re-reading the OCR documentation, but something is not clear to me; maybe I am missing something that could be obvious to a professional but not to someone who, like me, is still a beginner.
You will find here the server status from the ocr provider. Possible results are ‘UP’ or ‘DOWN’. ‘pro Usa1’ = Usa, East Coast. ‘pro Usa2’ = Usa, West Coast.
I’m not familiar with that component, but it looks like it is not working amymore?
The object “parsedText” got the result text to the end.
The other problem was that the image needed to be compressed because the camera was generating an image larger than 2MB, which is not allowed in the FREE version of ocr.space. I solved this issue in this way because I need to photograph the text from very close up. The compression plugin I added works very well, but it compresses the image too much, making it very, very grainy. It’s not over, though. Now I have to move on to the next step. If I have any other problems, I’ll contact you. Naturally, I thank you for all the help you have given me. You have been invaluable. I hope to see your messages in the future for other problems I might have. Thanks to all of you.