How to capture Photograph in cspro
How to capture Photograph in cspro
Sir,
How to capture photograph ( Respondent photo while interviewing) in CsPro data entry application.
Manoj
How to capture photograph ( Respondent photo while interviewing) in CsPro data entry application.
Manoj
-
- Posts: 1801
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: How to capture Photograph in cspro
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
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");
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
G.VOLNY, a CSProuser from Haiti, since 2004
Re: How to capture Photograph in cspro
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.
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;
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
Thank you so much... It helped a lot
-
- Posts: 12
- Joined: July 14th, 2014, 4:00 pm
Re: How to capture Photograph in cspro
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
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.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.
-
- Posts: 12
- Joined: July 14th, 2014, 4:00 pm
Re: How to capture Photograph in cspro
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?
-
- Posts: 12
- Joined: July 14th, 2014, 4:00 pm
Re: How to capture Photograph in cspro
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?josh wrote: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.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.