Using front camera with camera wrapper
I am trying to take pictures with the front camera using the camera wrapper.
I figured out that to access the front camera I have to construct the CCameraEngine object with:
iCameraWrapper = CCameraEngine::NewL(1, 0, this)
that triggers a call to MCameraEngineObserver's method MceoCameraReady(), which looks like follows in my current code:
[CODE]void CPictureTaker::MceoCameraReady()
{
if (iCameraWrapper->State() == CCameraEngine::EEngineIdle)
{
iCaptureSize = TSize(640, 480); // Captured picture size
TRAPD(err, iCameraWrapper->PrepareL(iCaptureSize)); // Prepare camera
if(!err)
{
iTimer = CSPTimer::NewL(this);
iTimer->StartL(CConfiguration::iConfiguration.iPictureTime * 1000);
}
}
else
{
}
}[/CODE]
I am trying this on a 6210, 6710 and 5800, which all have front camera. In all cases, PrepareL() leaves with -5 (KErrNotSupported). After leaving, the MCameraEngineObserver's method MceoHandleError() is also called with aErrorType = EErrAutoFocusMode and aError = -5 (KErrNotSupported).
Not sure why this is happening. I am not calling any autofocus function whatsoever yet. But the thing is that, since PrepareL() has failed, I can't actually take any picture with the front camera.
What am I doing wrong?, or is it not possible to take pictures with front camera?
Re: Using front camera with camera wrapper
just found out that the front camera does not support the default CCamera::EFormatExif format. If I use CCamera::EFormatFbsBitmapColor4K, it works OK:
iCameraWrapper->PrepareL(iCaptureSize, CCamera::EFormatFbsBitmapColor4K)
I guess that I'll have to convert the bitmap to jpeg manually.
Re: Using front camera with camera wrapper
Hi,
I am facing exactly the same issue but with back camera of Nokia C5.
I tried this also
[code]
CCamera::TFormat format = ImageFormatMax(camInfo);
TRAPD(err,iCameraWrapper->PrepareL(iCaptureSize,format));
CCamera::TFormat CCamProfileContainer::ImageFormatMax(TCameraInfo &aInfo)
{
if ( aInfo.iImageFormatsSupported & CCamera::EFormatFbsBitmapColor16M )
{
return CCamera::EFormatFbsBitmapColor16M;
}
else if ( aInfo.iImageFormatsSupported & CCamera::EFormatFbsBitmapColor64K)
{
return CCamera::EFormatFbsBitmapColor64K;
}
else if ( aInfo.iImageFormatsSupported & CCamera::EFormatFbsBitmapColor4K)
{
return CCamera::EFormatFbsBitmapColor4K;
}
else if ( aInfo.iImageFormatsSupported & CCamera::EFormatMonochrome)
{
return CCamera::EFormatMonochrome;
}
else return CCamera::EFormatMonochrome;
}
[/code]
But to no avail.
Any suggestions??
Re: Using front camera with camera wrapper
Make sure that your TCameraInfo is really initialized somewhere. You may also want to check the actual value of iImageFormatsSupported.
Re: Using front camera with camera wrapper
Hi Wizard,
Yes. It has been initialized as follows
iCameraWrapper->Camera()->CameraInfo(camInfo);
The format supported i get is
CCamera::EFormatFbsBitmapColor16M;
And
[code]
void CCamProfileContainer::MceoCameraReady()
{
UseCaptureBackCbaL();
if (iCameraWrapper->State() == CCameraEngine::EEngineIdle)
{
// Prepare camera
//TRAPD(err,iCameraWrapper->PrepareL(iCaptureSize));
iCameraWrapper->Camera()->CameraInfo(camInfo);
CCamera::TFormat format = ImageFormatMax(camInfo);
TRAPD(err,iCameraWrapper->PrepareL(iCaptureSize,format));
if (err)
{
SetError(_L("Camera prepare error %d"), err);
return;
}
// Start viewfinder. Viewfinder pictures starts coming into MceoViewFinderFrameReady();
TRAPD(err2,iCameraWrapper->StartViewFinderL(iViewFinderSize));
if (err2)
{
SetError(_L("Camera start viewfinder error %d"), err2);
return;
}
SetTitle(_L("Camera viewfinder"));
}
}
[/code]
And err and err2 turn out to be KErrNone . But this method completes and the control enters void CCamProfileContainer::MceoHandleError( TCameraEngineError aErrorType, TInt aError )
And aErrorType is EErrAutoFocusMode.
Like the person starting this post, I have not even used the auto focus functionality. The only check i make in constructor is as follows
[code]
if(iCameraWrapper->IsAutoFocusSupported()){
autoFocusSupported = ETrue;
}else{
autoFocusSupported = EFalse;
}
[/code]
And i get autoFocusSupported as ETrue
Re: Using front camera with camera wrapper
The code works with all cameras and only gives this issue with C5. I compared the camera specifications of say E71 on which the code works with C5.The camera seems to be same..
Re: Using front camera with camera wrapper
You may want to check if the Camera example works with the C5. Based on your description it can easily happen that it will not work. And in that case there is no reason for your code to work either.
Re: Using front camera with camera wrapper
[QUOTE=chandran.biju007;769482]The code works with all cameras and only gives this issue with C5. I compared the camera specifications of say E71 on which the code works with C5.The camera seems to be same..[/QUOTE]Hi,
E71 is a S60 3rd edition FP1 device, so camera handling under the hood is done very differently (NewL, CCamera API and custom interfaces for settings) than with C5 (New2L, CCameraAdvancedSettings). Also, E71 has autofocus, C5 something called "full focus", so in fact also the camera HW on these two phones is very different.
Have you tried your app on another device with a full focus camera? It's possible that this feature could be messing up CameraWrapper's autofocus detection somehow. If you want to investigate this further, see if the return values for CCameraAdvancedSettings::SupportedAutoFocusTypes(), SupportedFocusRanges() and SupportedFocusModes() are any different than values returned for some other S60 3rd ed. FP2/5th ed. device without autofocus.