Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Dec 2005
    Location
    Albacete, Spain
    Posts
    380

    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
    		{
    
    		}
    	}
    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?
    ----------------------------------------------
    Every journey starts with a small step.

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Albacete, Spain
    Posts
    380

    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.
    ----------------------------------------------
    Every journey starts with a small step.

  3. #3
    Super Contributor
    Join Date
    Nov 2008
    Posts
    675

    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;
         }
    But to no avail.
    Any suggestions??

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,808

    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.

  5. #5
    Super Contributor
    Join Date
    Nov 2008
    Posts
    675

    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"));
            }
        }
    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;
        }
    And i get autoFocusSupported as ETrue

  6. #6
    Super Contributor
    Join Date
    Nov 2008
    Posts
    675

    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..

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,808

    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.

  8. #8
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    260

    Re: Using front camera with camera wrapper

    Quote Originally Posted by chandran.biju007 View Post
    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..
    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.

Similar Threads

  1. Camera Wrapper error
    By lokesh_kumar_s in forum Symbian
    Replies: 1
    Last Post: 2010-05-20, 13:15
  2. Camera Wrapper problem
    By streetpunk in forum Symbian Media (Closed)
    Replies: 10
    Last Post: 2009-12-02, 14:40
  3. Are you working with the Camera Wrapper?
    By ltomuta in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2009-11-28, 19:22
  4. Camera Wrapper
    By NevenS in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2009-07-01, 11:25
  5. Replies: 3
    Last Post: 2008-05-05, 16:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×