Image from multiple camera

74 views
Skip to first unread message

Scientistnobee

unread,
Sep 2, 2019, 11:31:14 AM9/2/19
to MIT App Inventor Forum
Hi Everyone,

I am trying to capture image from each of the camera individually from the newer Android phones with multiple cameras. 
Please let me know, if there is any application already done or how to do it using the App Inventor?


TimAI2

unread,
Sep 2, 2019, 11:42:34 AM9/2/19
to MIT App Inventor Forum
Try HERE
(paid extension)

Scientistnobee

unread,
Sep 2, 2019, 5:39:54 PM9/2/19
to MIT App Inventor Forum
Hi Tim, thanks for your reply. Even the paid extension is not working with multiple cameras. It's only for one front and one back camera.

SteveJG

unread,
Sep 2, 2019, 5:57:42 PM9/2/19
to MIT App Inventor Forum
App Inventor 2 Camera object does not have a way to control what 'camera' should be used to take a picture.  What it can do is:

Camera

Use a camera component to take a picture on the phone.

Camera is a non-visible component that takes a picture using the device's camera. After the picture is taken, the path to the file on the phone containing the picture is available as an argument to the AfterPicture event. The path can be used, for example, as the Picture property of an Image component.

Properties

none

Methods

TakePicture()
Opens the phone's camera to allow a picture to be taken.

Events

AfterPicture(Text image)
Called after the picture is taken. The text argument image is the path that can be used to locate the image on the phone.

Non MIT Extensions (especially paid extensions) should be debugged by the extension developer.  Suggest you contact the developer, especially since the one you tested is a paid extension.   If the extension is for multiple camera's, he/she certainly should provide you a sollution since the paid extension "is not working with multiple cameras" on your device.

Let us know what you find out so it can be posted here





TimAI2

unread,
Sep 2, 2019, 6:13:12 PM9/2/19
to MIT App Inventor Forum
You should be able to set the default camera with the device's native camera app, then use Ai2 to take the picture
Possibly use activityStarter to open the native camera app on the device ?

Scientistnobee

unread,
Sep 3, 2019, 6:21:24 AM9/3/19
to MIT App Inventor Forum
Hi Tim, 

Thanks for your reply. I don't want to select the cameras manually. I am looking for an automated solution.

Scientistnobee

unread,
Sep 3, 2019, 6:30:44 AM9/3/19
to MIT App Inventor Forum
Hi Steve, 

Thanks for your detailed reply. So, in built camera functions are useless. 
I was referred to camera extension app by Tim, so I replied here. Sorry for that. I will ask Taifun directly.
I will post my findings here.

Taifun

unread,
Sep 3, 2019, 2:23:08 PM9/3/19
to MIT App Inventor Forum
sorry, but the camera extension allows you only to select front or back camera
Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

RICARDO MARTIN

unread,
Dec 9, 2019, 10:35:50 AM12/9/19
to MIT App Inventor Forum
Hi Everyone:

I have just download "CAMERA EXTENSION" from Taifun and I have make a very simple program, when button is pressed, I want to take first photo with front camera and then take photo wit rear camera. I have tried 2 ways:

1st WAY: call both cameras under same trigger event (button1). Only FRONT picture is saved, no REAR picture saved. If I interchange both calls, then only REAR picture is saved and no FRONT picture saved
front_and_rear_camera2.JPG





















2nd WAY: I have tride to separarte both camera triggers, first take FRONT picture when button1 is pressed (FRONT picture is saved ok) and when event Front_AfterPicture is launched then I call TakePicture REAR camera but it is not saved in disk. If I interchange order, happens the opposite as in 1st way

front_and_rear_camera.JPG




















What am I doing wrong?

Thanks in advance,

Ricardo

Taifun

unread,
Dec 9, 2019, 10:59:41 AM12/9/19
to mitappinv...@googlegroups.com
yes, the first method will not work, because you can't take a picture front and back at the same time
use the second method, but use only one camera extension component like this:

set the property UseFrontCamera to true
take the first picture
in the after picture event set the property UseFrontCamera to false
take the second picture

Taifun

RICARDO MARTIN

unread,
Dec 9, 2019, 11:35:24 AM12/9/19
to MIT App Inventor Forum
Dear Taifun:

Changed as you suggested and it works. But if I use this method I can´t use again  .AfterPicture event  to detect when second  image /Pictures/front.jpg has been saved. Any suggestion to solve this?

Thanks in advance,

Ricardo

front_and_rear_camera3.JPG

Taifun

unread,
Dec 9, 2019, 1:35:05 PM12/9/19
to MIT App Inventor Forum
use a global variable to detect, if you take the first or second picture
Taifun

RICARDO MARTIN

unread,
Dec 9, 2019, 2:27:17 PM12/9/19
to MIT App Inventor Forum
Sorry Taifun, maybe it is something very easy but to be honest, due to my lack of experience I don´t see how to do it. Any example will be welcomed.
With kindest regards,
Ricardo

Taifun

unread,
Dec 9, 2019, 2:35:33 PM12/9/19
to MIT App Inventor Forum
use a global variable, let's name it firstPicture and initialize that variable with true (from the Logic drawer)
in the after picture event you then can check that variable like this

if firstPicture
then do all the things you want to do after the first picture has been taken and set the global variable firstPicture to false
else do all the things you want to do after the second picture has been taken and set the global variable firstPicture back to true

Taifun

RICARDO MARTIN

unread,
Dec 9, 2019, 2:46:09 PM12/9/19
to MIT App Inventor Forum
Got it. Thanks!!
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages