Page 1 of 3
How to capture Photograph in cspro
Posted: March 22nd, 2013, 3:07 am
by manojorb
Sir,
How to capture photograph ( Respondent photo while interviewing) in CsPro data entry application.
Manoj
Re: How to capture Photograph in cspro
Posted: March 23rd, 2013, 4:28 am
by Gregory Martin
CSPro doesn't support this functionality natively. If you have another program that can take a photo, you can launch that program with the execsystem function.
Re: How to capture Photograph in cspro
Posted: August 18th, 2015, 6:55 am
by rcovane
Ok. I did call the camera and used the command line CSPro suggests. But now, how to customize the image name? For example, i'm mapping a crop and want to take pictures, the file name should be like this:
ID_C##
Where: ID is the Household ID; C means crop; and ## is the crop number.
So i can easily identify the images when i analyse it.
help me modify this code:
execsystem("camera:/storage/emulated/0/csentry/CAPI teste/Imagens/photo.jpg");
Re: How to capture Photograph in cspro
Posted: August 18th, 2015, 9:30 am
by htuser
Re: How to capture Photograph in cspro
Posted: August 18th, 2015, 1:35 pm
by josh
For capturing photos I create an item in the dictionary named PHOTO with the following value sets:
PHOTO_TAKEN
Retake photo 1
View photo 2
Keep photo 3
Refused 9
PHOTO_NOT_TAKEN
Take photo 1
Refused 9
Then I use the following logic for the item. This way if you repass through the field after taking the photo it doesn't launch the camera a second time. It also gives you an easy way to see the photo if you are reviewing the questionnaire afterwards.
PROC PHOTO
onfocus
string photoFilename = maketext("%sphotos/photo-%d-%02d-%03d.jpg",
pathname(Application),
DISTRICT, VILLAGE, HOUSEHOLD_NUMBER);
if fileexist(photoFilename) then
setvalueset(PHOTO, PHOTO_TAKEN);
else
setvalueset(PHOTO, PHOTO_NOT_TAKEN);
endif;
postproc
if PHOTO = 1 then
// Take/retake photo
execsystem(maketext("camera:%s", photoFilename));
reenter;
elseif PHOTO = 2 then
// View photo
execsystem(maketext("view:%s", photoFilename));
reenter;
elseif PHOTO = 3 then
// Keep - move to next field
elseif PHOTO = 9 then
// No photo - refused
if fileexist(photoFilename) then
filedelete(photoFilename);
endif;
// Move to next field
endif;
Re: How to capture Photograph in cspro
Posted: August 21st, 2015, 1:40 am
by rcovane
Thank you so much... It helped a lot
Re: How to capture Photograph in cspro
Posted: August 24th, 2015, 1:43 pm
by alesson_aguiar
Please, would you mind telling me how I can set these values? I really appreciate any explanation and it would be better if you copy a print of the setvalue page with these informations. Thank you.
josh wrote:For capturing photos I create an item in the dictionary named PHOTO with the following value sets:
PHOTO_TAKEN
Retake photo 1
View photo 2
Keep photo 3
Refused 9
PHOTO_NOT_TAKEN
Take photo 1
Refused 9
Then I use the following logic for the item. This way if you repass through the field after taking the photo it doesn't launch the camera a second time. It also gives you an easy way to see the photo if you are reviewing the questionnaire afterwards.
PROC PHOTO
onfocus
string photoFilename = maketext("%sphotos/photo-%d-%02d-%03d.jpg",
pathname(Application),
DISTRICT, VILLAGE, HOUSEHOLD_NUMBER);
if fileexist(photoFilename) then
setvalueset(PHOTO, PHOTO_TAKEN);
else
setvalueset(PHOTO, PHOTO_NOT_TAKEN);
endif;
postproc
if PHOTO = 1 then
// Take/retake photo
execsystem(maketext("camera:%s", photoFilename));
reenter;
elseif PHOTO = 2 then
// View photo
execsystem(maketext("view:%s", photoFilename));
reenter;
elseif PHOTO = 3 then
// Keep - move to next field
elseif PHOTO = 9 then
// No photo - refused
if fileexist(photoFilename) then
filedelete(photoFilename);
endif;
// Move to next field
endif;
Re: How to capture Photograph in cspro
Posted: August 24th, 2015, 2:04 pm
by josh
alesson_aguiar wrote:Please, would you mind telling me how I can set these values? I really appreciate any explanation and it would be better if you copy a print of the setvalue page with these informations. Thank you.
You add them the same way you would any value set to the dictionary. Click on the variable named "photo" and then click on "add value set" on the toolbar. Do this once for each of the two value sets.
- Capture.PNG (7.37 KiB) Viewed 15088 times
Re: How to capture Photograph in cspro
Posted: August 25th, 2015, 7:38 am
by alesson_aguiar
Josh, thank you for your answer. This is just what I did. but let me tell you what is happening. First, after I enter 1, I take the photo but it is not stored in any folder and I don´t know why. Second, if I enter 2 or 3, I receive "WARNING: Out of range! Please enter a valid value for PHOTO" Can you see and explain it for me, Please?
Re: How to capture Photograph in cspro
Posted: August 25th, 2015, 7:40 am
by alesson_aguiar
josh wrote:alesson_aguiar wrote:Please, would you mind telling me how I can set these values? I really appreciate any explanation and it would be better if you copy a print of the setvalue page with these informations. Thank you.
You add them the same way you would any value set to the dictionary. Click on the variable named "photo" and then click on "add value set" on the toolbar. Do this once for each of the two value sets.
Capture.PNG
Josh, thank you for your answer. This is just what I did. but let me tell you what is happening. First, after I enter 1, I take the photo but it is not stored in any folder and I don´t know why. Second, if I enter 2 or 3, I receive "WARNING: Out of range! Please enter a valid value for PHOTO" Can you see and explain it for me, Please?