Android Question Getting Pixel Co-ordinates from Camera Image

ChocoScope

Member
Licensed User
Longtime User
I would like to generate a set of pixel co-ordinates from a camera image which are lit up RED and save it in a binary file. I want to generate it from the image in memory rather than grabbing a picture and storing it as .jpg as I want to do it multiple times. The final file will be used for data (pictures) from a 3D laser scanner. Can anyone please point me to or supply suitable programs to do this.
 

JordiCP

Expert
Licensed User
Longtime User
Yes, manually processing all the pixels is always slow. However, you could change the resolution to 320x240 (and replace all fixed ocurrences of "640" and "480" in code by a variable, since now they are hard-coded) and processing will decrease to 1/4th of the current time or less. I am sure that the camera will still detect the laser beam, since sensors are not so fine-grained.

Once you have it working and feel comfortable with it you could jump to OpenCV. All this can be done with just a few lines of code (but also means learning the new syntax)
 
Upvote 0

ChocoScope

Member
Licensed User
Longtime User
The idea of the high resolution is that the laser beam shines on the object you are scanning and outlines every curve and detail
which you then turn into a point cloud. so the more detail the better.

I tried getting into OpenCV using Python but couldn't get Python to recognise it. Tried setting all sorts of paths but to no avail.
Didn't realise that b4a had access to it. Is it built into b4a? Perhaps you could point me to further reading on the b4a aspects of it.
I am willing to learn.
 
Upvote 0

ChocoScope

Member
Licensed User
Longtime User
Is it possible to put a Filter onto preview to turn it into a sillouette. Similar to applying sepia or negative?
Would that be any faster?
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
--> The OpenCV for B4A lib wrapper is freely available and you can read about it HERE

If you have already used it with Python you already know what OpenCV can do. The only difference will be the syntax (the B4A wrapper tries to keep as close as possible to the Java API) , the input/output interfaces (here we use JavaCameraView) and the fact that in Android some complex things will be more limited in speed.

Is it possible to put a Filter onto preview to turn it into a sillouette. Similar to applying sepia or negative?
You can try with some of the camera pre-built effects. However, I don't know if they take effect only on the shown image, or also the preview buffer that you get.
With openCV you will not need to prefilter, since the detection of brightest pixels will be incredibly fast.
 
Upvote 0

ChocoScope

Member
Licensed User
Longtime User
Followed your link to OpenCV for B4A and did a bit of reading. It is so vast and I can see myself only using a very small part of it.
It looks Fantastic! But the same old problem for me ... I can't open your examples as I only have v3.00
I do not use B4A enough to invest in an upgrade, so I think I will have to go without and manage with the program you have given me.
I am still very grateful for your help though.
 
Upvote 0
Top