Android Question How to read camera image from url

cenyu

Active Member
Licensed User
Longtime User
Hello, i have to read image from pc camera ... For example i have a camera connected to PC on http://10.0.2.10
I must get image from this url and do OCR into B4A then store result as text to SQL DataBase
I finding some example related to this task but no success
Can you help me with some example...for reading camera image from url


I found this code:
B4X:
Dim job As HttpJob
job.Initialize("", Me)
job.Download2("http://190.160.1.12/", Array As String("get", "Actual"))
Wait For (job) JobDone(job As HttpJob)
Sleep(100)                             'add this
Log("job.Success = " & job.Success)    'and this

But this store url data to string array...


Thanks!
 
Last edited:

JohnC

Expert
Licensed User
Longtime User
Is the camera connected to the PC using a USB cable or an Ethernet cable?
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
httputils will work if .12 is an http server. if not, not.
technically, jobdownload2 might work, depending on what "get" and "actual" mean. ("get" is a funny choice of words, since "get" is what job.download and job.download2 already do).
normally, to download an image, you just need job.download( url & name_of_image ).
if success, you read image:
dim bitmap as bitmap = job.getbitmap
then you can do what you want with the bitmap.

first you said .10 was the url, but then you used .12. so it's unclear what you're doing. if the image never resides on the server, it's going to be tricky to retrieve it from the camera and onto your android device. the smb protocol could work, depending on how the various devices are networked and how they see one another. a lot of answered questions... you need to spell out your configuration.

just have your android device take a picture of the image and do the ocr. win-win.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
What is the brand and model of the camera?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
If the camera responds to a ping, I doubt that the cable/connection type matters.

Where does the OP say the "camera" responds to a ping?

He did say that the camera is *connected* to a PC. And when he mentioned the IP address of 10.0.2.10, it is unclear if that is the PC's IP address or maybe the camera is an IP camera and that is the camera's IP address.

However, if the camera is a dumb USB camera, I don't think you can have an android app get an image from an USB camera over an Ethernet connection unless the *PC* software for the camera supports a web server of some sort.

So, that's why I asked about the connection type.

If I find out the camera is an IP camera, then I can offer links to RTSP or Mjpeg video capture examples in this forum.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Note that I liked your subsequent query. ✌
LOL, I thought that might be a quicker method to find out exactly what we are dealing with
 
Upvote 0

emexes

Expert
Licensed User
my camera responds to a ping...
Try browsing the IP, ie, type http://10.0.2.10 into your browser address bar and press Enter key.

Perhaps you might get a status page with a fresh picture on it.

If that happens, you can find out the URL of the picture and then do a regular http download using that URL.

Although that seems like it'd be too easy. ?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
If you can provide the make and model of your camera, we can lookup the specs and see what protocols it supports.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…