Camere produces different quality pictures

This question is answered

Hi

I've coded the camera to take pictures to a high quality using the following code

  
 If boolTriggerIsCamera = True Then
                Try
                    Dim moImagerSettings = goImager.GetPresetSettings(PresetId.Default)
                    moImagerSettings(SettingId.ImageDownloadEnabled) = True
                    moImagerSettings(SettingId.ImageSaveToFileEnabled) = True
                    moImagerSettings(SettingId.ImageDownloadType) = ImageType.JpegColour
                    moImagerSettings(SettingId.ImageFileFormat) = ImageFileFormat.Jpeg
                    moImagerSettings(SettingId.JpegQualityPercent) = 97
                    strFilename = "\My Documents\" & strFilenamePrefix & " - " & Format$(Now, "ddMMyyyy-hhMMss") & ".jpeg"
                    moImagerSettings(SettingId.ImageFilename) = strFilename
                    moImagerSettings(SettingId.ImageDownloadEnabled) = True
                    moImagerSettings(SettingId.SubsamplingFactor) = 1
                    goImager.SetMultipleSettings(moImagerSettings)
                Catch ex As Exception
                    MessageBox.Show("GetPresetSettings(PresetId.Default) failed with " + ex.Message)
                    Return
                End Try
        Else
                goImager.CaptureAsync()
        End If

But I'm getting varying results.  One picture is 1.4MB then the next picture is 104KB.  I can't get the camera to reliably create pictures of high quality everytime.  Any idea why this might be please?

I'm using the Omni XT15. with Windows Embedded Handheld 6.4 and CE OS 5.2.29058.  I'm programming using VS2008 .NET 3.5.

Thanks 

Verified Answer
  • When you do a SetMultipleSettings, it does not save the settings to the preset from which you took default settings from.

    Thus, when you execute your 'zoom' settings, you grab the Default preset to start off with.  That will NOT reflect any changes made previously in your triggerdown set... It gets the original DefaultID settings, and then you make only a handful of changes there.

    My advice is to have one function that you always call to make setting changes to the imager, and from there you always start by grabing the defaultID settings, then add whatever standard/common changes that you always need, and then end it with specialty changes that vary from instance to instance...

    You'll see from the EP10 zoom demo that I do just that....

    Ideally, one way to avoid this is to create your own Preset, and save all the basic settings there, and then draw from it when you need it.  But both ways will work fine....

All Replies
  • Do you dispose of goImager (the Imager object) every so often, or only at the closing of the application?  How often is boolTriggerIsCamera evaluated?

    What version of ICS are you using?

  • Hi Steven

    I have a sneaky feeling that I'm writing settings all over the place and perhaps losing my preferred defaults for high quality when the user pulls the trigeger.  My code does the following:

    1. If the user wants the flash turned on - I turn on the falsh as one setting when they check the menu option
    2. If the user wants to zoom - I zoom to the level they require as another setting when they check the preferred zoom setting
    3. The picture quality is always set high when the user pulls the trigger

    I turn on the flash and zoom by the use of a pop-up menu.  The user has an option to click 'Use Flash' and this turns on the flash immediately (so they can see the picture in the image preview).  The user has 4 zoom settings from Normal (1) to 4 (Max Zoom). 

    If the "Use Flash" menu option is checked, then everytime the user chooses to take a new picture, I turn on the flash and at the same time I set the zoom to whichever zoom option is checked on the menu.  This is all done when the user clicks the "New Picture" button.  The high quality settings are set when the user pulls the trigger.  So below are the functions and the events where I set settings:

    Sub configureZoom()
            Dim moImagerSettings = goImager.GetPresetSettings(PresetId.Default)
            moImagerSettings(SettingId.DigitalZoom) = intZoomLevel
            goImager.SetMultipleSettings(moImagerSettings)
        End Sub

        Sub configureFlash()
            Dim moImagerSettings = goImager.GetPresetSettings(PresetId.Default)

            If mnuItemUseFlash.Checked = True Then
                Dim intsafeLevel = ImagerScannerTriggerHelper.goImager.GetCapability(CapabilityId.MaximumIlluminationLevel)
                moImagerSettings(SettingId.AutoExposureMaximumIlluminationLevel) = intsafeLevel
                moImagerSettings(SettingId.ContinuousIlluminationEnabled) = True
                'moImagerSettings(SettingId.AutoExposureEnabled) = True
            Else
                moImagerSettings(SettingId.ContinuousIlluminationEnabled) = False
                'moImagerSettings(SettingId.AutoExposureEnabled) = True
            End If

            goImager.SetMultipleSettings(moImagerSettings)

        End Sub

    'Now when the user pulls the trigger, the following is setting in the trigger down event (some settings are commented out so please read carefully):

        Private Sub onTriggerDownEvent(ByVal SourceId As UInteger, ByVal SourceFriendlyName As String)
            If boolTriggerDisabled = False Then
                If boolTriggerIsCamera = True Then
                    Try
                        Dim moImagerSettings = goImager.GetPresetSettings(PresetId.Default)

                        'moImagerSettings(SettingId.ImageDownloadEnabled) = True
                        moImagerSettings(SettingId.ImageDownloadType) = ImageType.JpegColour
                        moImagerSettings(SettingId.ImageFileFormat) = ImageFileFormat.Jpeg
                        moImagerSettings(SettingId.JpegQualityPercent) = 97
                        strFilename = "\My Documents\" & strFilenamePrefix & " - " & Format$(Now, "ddMMyyyy-hhMMss") & ".jpeg"
                        moImagerSettings(SettingId.ImageFilename) = strFilename
                        moImagerSettings(SettingId.SubsamplingFactor) = 1
                        'moImagerSettings(SettingId.DigitalZoom) = intZoomLevel
                        moImagerSettings(SettingId.ImageSaveToFileEnabled) = True

                        goImager.SetMultipleSettings(moImagerSettings)
                    Catch ex As Exception
                        MessageBox.Show("GetPresetSettings(PresetId.Default) failed with " + ex.Message)
                        Return
                    End Try
                Else
                    goImager.CaptureAsync()
                End If
            End If
        End Sub

    It could be that I'm overwriting settings everywhere.  One thing is clear, I'm not really certain what each setting really does as they come from other examples.  I've tried moving the code out of the "trigger down" event and setting all my options in one go when the user clicks the "New Picture" button but then I can't get the flash turned on for some reason and I've noticed that if the ImageSaveToFile option is in the button event then another picture gets written.  Do you have any suggestions as to "what should go where" please?

  • When you do a SetMultipleSettings, it does not save the settings to the preset from which you took default settings from.

    Thus, when you execute your 'zoom' settings, you grab the Default preset to start off with.  That will NOT reflect any changes made previously in your triggerdown set... It gets the original DefaultID settings, and then you make only a handful of changes there.

    My advice is to have one function that you always call to make setting changes to the imager, and from there you always start by grabing the defaultID settings, then add whatever standard/common changes that you always need, and then end it with specialty changes that vary from instance to instance...

    You'll see from the EP10 zoom demo that I do just that....

    Ideally, one way to avoid this is to create your own Preset, and save all the basic settings there, and then draw from it when you need it.  But both ways will work fine....

  • Hi Steven

    I genuinely thought this was the case but I was marching on regardless.  Where is the EP10 Zoom demo that you refer to please.  I tried searching for it but just got a french page with some links to firmware stuff.

    Thanks again for the feedback.

  • One further question:

    With the settings.  If I set moImagerSettings(SettingId.ImageSaveToFileEnabled) = True, does that cause a picture to be written away immediately or only when the trigger is pulled as I did try to put all the settings in one place but I found that I couldn't get the flash to turn on all of a sudden and pictures were being written out to disk before the trigger was being pulled when I called the routine to set all the settings at once.

  • I've found the zoom demo on the site and I've also located the imager .chm help file (Program Files\Psion\Imager SDK V15.1\Documentation) with the settings described.  I was searching the help file using the key word "ImageDownloadEnabled" which yeilded nothing, where as "SettingId_ImageDownloadEnabled" is what I should have been looking for.

    Thanks once again.