[SailfishDevel] Camera flash control. Wired to Qt level or not?

Mohammed Hassan mohammed.hassan at jollamobile.com
Sat Nov 16 18:07:51 UTC 2013


On Sat, Nov 16, 2013 at 07:06:56PM +0200, Artem Marchenko wrote:
>  Thanks a lot, Mohammed!
>  There are two sliders in the app to control how often searchAndLock are
>  called and how soon unlock is to be called after it.
>  1. Could you, please, play with it and see which values seem to give
>  better results?
>  For now I will be fine with any more or less sane combination.

The first slider is for focus mode. I keep it at 0
The second seems to control the period of darkness between each 2 pulses. The lower the
better (but don't set it to 0).
The thirs seems to control the duration of the pulse. The larger the better but I can not
yet tell the best combination of values.

The best result is when you don't unlock() but this is a misuse of the API and I would not
be surprised if it fires back ;-)

>  2. Also could you describe the result and how it behaves when you
>  change these values? or well.. it is also external light dependent.
>  Let's say if you go into dark place (where flashlight is to be used
>  anyway), does LED produce light soft and often enough to make, say,
>  locating keys in a bag possible? Or is it more like rare annoying
>  flashes?

I think the light intensity is not dependant on the ambient light. I see it's fine
in a dark room. What is annoying is the pulses but it's not that bad.

I can try to record a video for you if my time permits (I cannot promise).

>  3. Unlock
>  That is something I don't understand :/
>  What do you mean that gstreamer output tells I have to call unlock?
>  Can you then play with the unlocking timer too? Maybe there is a magic
>  combination of values that will keep light almost constant? For
>  example, if we start searchAndLock() as often as every 50ms and don't
>  call unlock() ever.

As I said earlier. You can decide not to call unlock() and keep calling searchAndLock().
I don't know if this is tolerated by Qt or not but I can see that GStreamer parts which work
below Qt are not happy.

searchAndLock() will trigger a full focus cycle and camera HAL expects a call to unlock().

Cheers,

P.S. You can catch me on freenode (MSameer) if you use IRC.

>  Best regards,
>  Artem.
>  On Sat, Nov 16, 2013 at 6:56 PM, Mohammed Hassan
>  <[1]mohammed.hassan at jollamobile.com> wrote:
> 
>  Great job Artem
>  I tried it and it works (it pulses as expected).
>  If I point camera to a lamp then the led lights up for a long time.
>  If I direct it away from the lamp then the pulses are shorter.
>  I personally am not sure about the Qt API but from gstreamer output,
>  I see that
>  you must call unlock().
>  I will try to test it tomorrow morning and see if it will still fire
>  or not.
>  I guess we also need to tweak the timer for locking and unlocking
>  but I don't
>  really have any suggestions.
>  Cheers,
> 
>  On Sat, Nov 16, 2013 at 06:22:32PM +0200, Artem Marchenko wrote:
>  > I prepared the next test app, that starts searchAndLock() every
>  given
>  > number of ms and optionally does unlock() soon after it (not sure if
>  > you have to unlock before starting the next searchAndLock() ). Plus
>  you
>  > can play with the search mode if Manual happens to be not good
>  enough.
>  > Anybody willing to try on real hardware? Preferably both in dark and
>  > light environment (maybe flash starts in dark conditions only as
>  > Mohammed told).
> 
>  > Link to ARM RPM - [1][2]http://bit.ly/videofla109
> 
>  > Or here's full source code
> 
>  > -
>  [2][3]https://github.com/amarchen/video-flash-trial/tree/v0.1-9/
> 
>  > Cheers,
>  > Artem.
>  >
>  > On Sat, Nov 16, 2013 at 6:05 PM, Mohammed Hassan
> 
>  > <[3][4]mohammed.hassan at jollamobile.com> wrote:
>  >
>  > The point is not to be in continuous focus mode (CAF) because if you
>  > are in that mode
>  > then camera might not try to focus if it happens to have focus
>  > already (CAF mode = camera
>  > tries to focus all the time).
>  > In manual or fixed focus modes, camera will not try to focus all the
>  > time and will instead
>  > wait until it is instructed to focus and then it will do it.
>  > That is simply the reason.
>  > CAF focus is not guaranteed to be out of focus but manual is
>  > guaranteed to be out
>  > of focus ;-)
>  > Cheers,
>  >
>  > On Sat, Nov 16, 2013 at 05:58:30PM +0200, Artem Marchenko wrote:
>  > > Can you explain why Fixed (manual) focus mode? :/
>  > > Sorry to ask for details, it's a little difficult without the
>  device
>  > at
>  > > hand?
>  > > Are you trying to tell that in a Fixed mode camera will seek for
>  > focus
>  > > forever?
>  > > Artem.
>  > > On Sat, Nov 16, 2013 at 5:55 PM, Mohammed Hassan
>  >
> 
>  > > <[1][4][5]mohammed.hassan at jollamobile.com> wrote:
>  > >
>  > > searchAndLock() should work as long as you are in a dark
>  > > place (that's what LED torch is for ;-))
>  > > and make sure the focus mode is set to fixed focus mode.
>  > > Good luck!
>  > > Cheers,
>  > >
>  > > On Sat, Nov 16, 2013 at 05:35:47PM +0200, Artem Marchenko wrote:
>  > > > I used to work a little with GStreamer in the past, it wasn't
>  much
>  > > fun,
>  > > > though I was doing video processing, not just LED manipulation..
>  > > > Oh well, I try searchAndLock trick, if it doesn't work, I'll
>  need
>  > to
>  > > > think if I am into diving to gstreamer or into waiting for the
>  > Torch
>  > > > API. Technically, waiting for Torch is correct probably, I am
>  just
>  > > > driven by the opportunity to make the very first torch for Jolla
>  > :)
>  > > > Cheers,
>  > > > Artem.
>  > > >
>  > > > On Sat, Nov 16, 2013 at 5:28 PM, Mohammed Hassan
>  > >
>  >
> 
>  > > > <[1][2][5][6]mohammed.hassan at jollamobile.com> wrote:
>  > > >
>  > > > Hi Artem,
>  > > >
>  > > > On Sat, Nov 16, 2013 at 04:43:57PM +0200, Artem Marchenko wrote:
>  > > > > Thanks, Mohammed.
>  > > > >
>  > > > > I know that torch mode is not supported, but ON mode is. So my
>  > > > current
>  > > > > workaround idea is to make phone think it shoots video with
>  > flash
>  > > > mode
>  > > > > ON (ok, we can even shoot video for real if needed).
>  Assumption
>  > is
>  > > > that
>  > > > > video + flash mode ON should make phone record video with
>  light
>  > > > > constantly ON. Currently it doesn't work for me, maybe because
>  > > > > assumption is wrong or maybe I am just using some api the
>  wrong
>  > > way.
>  > > >
>  > > > It will not work that way. There is a special mode for torch
>  light
>  > > > but it's
>  > > > not yet been implemented.
>  > > >
>  > > > > 2nd workaround idea is to make phone seekAndLock all the time
>  > > > causing
>  > > > > flash to be ON. That is likely to result in a multitude of
>  short
>  > > > > flashes though.
>  > > >
>  > > > That can work but it will be slow "light bursts".
>  > > > A 3rd option would be going even below GSTreamer and Qt and talk
>  > to
>  > > > the camera HW directly.
>  > > > This is harder -trust me- and will tie you to the hardware.
>  > > > I am really sorry I don't have a solution for you :(
>  > > > I can only promise it will be available soon in an update.
>  > > > Cheers,
>  > > >
>  > > > > When you record video with the flash ON in a system camera
>  app,
>  > > does
>  > > > it
>  > > > > cause LED to have kith ON all the time?
>  > > > >
>  > > > > Artem.
>  > > > >
>  > > > > On Saturday, November 16, 2013, Mohammed Hassan wrote:
>  > > > >
>  > > > > Hi Artem,
>  > > > > On Sat, Nov 16, 2013 at 02:48:30PM +0200, Artem Marchenko
>  wrote:
>  > > > > > Hi All
>  > > > > > *Context*
>  > > > > > I am trying to build a flashlight app, but the same question
>  > is
>  > > > > valid
>  > > > > > for any camera app that wants to shoot photos/videos in low
>  > > > > light.
>  > > > > > *The problem*
>  > > > > > I am trying to control LED flash by setting flash mode to ON
>  > > (api
>  > > > > > confirms that ON mode is supported) and starting camera.
>  > Nothing
>  > > > > > happens. I also tried actually capturing photo, shooting
>  video
>  > > > > and
>  > > > > > seekAndLocking. I don't have a device myself, but kind
>  people
>  > on
>  > > > > IRC
>  > > > > > told that only two short LED flashes happen (during seeking
>  > for
>  > > > > focus
>  > > > > > probably).
>  > > > > > Could somebody, please, advise how to control flash in
>  > Sailfish
>  > > > > OS? Or
>  > > > > > maybe you could confirm that libhybris flash control just
>  > isn't
>  > > > > wired
>  > > > > > to Qt level?
>  > > > > This is unfortunately not supported.
>  > > > > The only flash modes supported now are: on, off or auto.
>  > > > > Torch light mode is not yet supported but I assure you it will
>  > > come
>  > > > > in an update soon.
>  > > > > I am not that familiar with Qt but I know it's a limitation of
>  > the
>  > > > > layer underneath Qt.
>  > > > > The best you can do now is to wait for the phone itself and
>  > tinker
>  > > > > as you like and I am
>  > > > > sure you will manage to do it :-)
>  > > > > Cheers,
>  > > > > P.S. libhybris camera wrapper is not used by sailfish. It
>  might
>  > or
>  > > > > might not work.
>  > > > > _______________________________________________
>  > > > > SailfishOS.org Devel mailing list
>  > > > >
>  > > > > --
>  > > > > Artem Marchenko
>  > > >
>  > >
>  >
> 
>  > > > > [1][2][3][6][7]http://agilesoftwaredevelopment.com
>  > > > > [2][3][4][7][8]http://twitter.com/AgileArtem
>  > > > >
>  > > > > References
>  > > > >
>  > > > > 1. [4][5][8][9]http://agilesoftwaredevelopment.com/
>  > > > > 2. [5][6][9][10]http://twitter.com/AgileArtem
>  > > >
>  > > > --
>  > > > Artem Marchenko
>  > > > [6][7][10][11]http://agilesoftwaredevelopment.com
>  > > > [7][8][11][12]http://twitter.com/AgileArtem
>  > > >
>  > > > References
>  > > >
>  > > > 1. mailto:[9][12][13]mohammed.hassan at jollamobile.com
>  > > > 2. [10][13][14]http://agilesoftwaredevelopment.com/
>  > > > 3. [11][14][15]http://twitter.com/AgileArtem
>  > > > 4. [12][15][16]http://agilesoftwaredevelopment.com/
>  > > > 5. [13][16][17]http://twitter.com/AgileArtem
>  > > > 6. [14][17][18]http://agilesoftwaredevelopment.com/
>  > > > 7. [15][18][19]http://twitter.com/AgileArtem
>  > >
>  > > --
>  > > Artem Marchenko
>  > > [16][19][20]http://agilesoftwaredevelopment.com
>  > > [17][20][21]http://twitter.com/AgileArtem
>  > >
>  > > References
>  > >
>  > > 1. mailto:[21][22]mohammed.hassan at jollamobile.com
>  > > 2. mailto:[22][23]mohammed.hassan at jollamobile.com
>  > > 3. [23][24]http://agilesoftwaredevelopment.com/
>  > > 4. [24][25]http://twitter.com/AgileArtem
>  > > 5. [25][26]http://agilesoftwaredevelopment.com/
>  > > 6. [26][27]http://twitter.com/AgileArtem
>  > > 7. [27][28]http://agilesoftwaredevelopment.com/
>  > > 8. [28][29]http://twitter.com/AgileArtem
>  > > 9. mailto:[29][30]mohammed.hassan at jollamobile.com
>  > > 10. [30][31]http://agilesoftwaredevelopment.com/
>  > > 11. [31][32]http://twitter.com/AgileArtem
>  > > 12. [32][33]http://agilesoftwaredevelopment.com/
>  > > 13. [33][34]http://twitter.com/AgileArtem
>  > > 14. [34][35]http://agilesoftwaredevelopment.com/
>  > > 15. [35][36]http://twitter.com/AgileArtem
>  > > 16. [36][37]http://agilesoftwaredevelopment.com/
>  > > 17. [37][38]http://twitter.com/AgileArtem
>  >
>  > --
>  > Artem Marchenko
>  > [38][39]http://agilesoftwaredevelopment.com
>  > [39][40]http://twitter.com/AgileArtem
>  >
>  > References
>  >
>  > 1. [41]http://bit.ly/videofla109
>  > 2. [42]https://github.com/amarchen/video-flash-trial/tree/v0.1-9/
>  > 3. mailto:[43]mohammed.hassan at jollamobile.com
>  > 4. mailto:[44]mohammed.hassan at jollamobile.com
>  > 5. mailto:[45]mohammed.hassan at jollamobile.com
> 
>  > 6. [46]http://agilesoftwaredevelopment.com/
>  > 7. [47]http://twitter.com/AgileArtem
> 
>  > 8. [48]http://agilesoftwaredevelopment.com/
>  > 9. [49]http://twitter.com/AgileArtem
> 
>  > 10. [50]http://agilesoftwaredevelopment.com/
>  > 11. [51]http://twitter.com/AgileArtem
> 
>  > 12. mailto:[52]mohammed.hassan at jollamobile.com
>  > 13. [53]http://agilesoftwaredevelopment.com/
>  > 14. [54]http://twitter.com/AgileArtem
>  > 15. [55]http://agilesoftwaredevelopment.com/
>  > 16. [56]http://twitter.com/AgileArtem
>  > 17. [57]http://agilesoftwaredevelopment.com/
>  > 18. [58]http://twitter.com/AgileArtem
>  > 19. [59]http://agilesoftwaredevelopment.com/
>  > 20. [60]http://twitter.com/AgileArtem
>  > 21. mailto:[61]mohammed.hassan at jollamobile.com
>  > 22. mailto:[62]mohammed.hassan at jollamobile.com
>  > 23. [63]http://agilesoftwaredevelopment.com/
>  > 24. [64]http://twitter.com/AgileArtem
>  > 25. [65]http://agilesoftwaredevelopment.com/
>  > 26. [66]http://twitter.com/AgileArtem
>  > 27. [67]http://agilesoftwaredevelopment.com/
>  > 28. [68]http://twitter.com/AgileArtem
>  > 29. mailto:[69]mohammed.hassan at jollamobile.com
>  > 30. [70]http://agilesoftwaredevelopment.com/
>  > 31. [71]http://twitter.com/AgileArtem
>  > 32. [72]http://agilesoftwaredevelopment.com/
>  > 33. [73]http://twitter.com/AgileArtem
>  > 34. [74]http://agilesoftwaredevelopment.com/
>  > 35. [75]http://twitter.com/AgileArtem
>  > 36. [76]http://agilesoftwaredevelopment.com/
>  > 37. [77]http://twitter.com/AgileArtem
>  > 38. [78]http://agilesoftwaredevelopment.com/
>  > 39. [79]http://twitter.com/AgileArtem
> 
>  --
>  Artem Marchenko
>  [80]http://agilesoftwaredevelopment.com
>  [81]http://twitter.com/AgileArtem
> 
> References
> 
>  1. mailto:mohammed.hassan at jollamobile.com
>  2. http://bit.ly/videofla109
>  3. https://github.com/amarchen/video-flash-trial/tree/v0.1-9/
>  4. mailto:mohammed.hassan at jollamobile.com
>  5. mailto:mohammed.hassan at jollamobile.com
>  6. mailto:mohammed.hassan at jollamobile.com
>  7. http://agilesoftwaredevelopment.com/
>  8. http://twitter.com/AgileArtem
>  9. http://agilesoftwaredevelopment.com/
>  10. http://twitter.com/AgileArtem
>  11. http://agilesoftwaredevelopment.com/
>  12. http://twitter.com/AgileArtem
>  13. mailto:mohammed.hassan at jollamobile.com
>  14. http://agilesoftwaredevelopment.com/
>  15. http://twitter.com/AgileArtem
>  16. http://agilesoftwaredevelopment.com/
>  17. http://twitter.com/AgileArtem
>  18. http://agilesoftwaredevelopment.com/
>  19. http://twitter.com/AgileArtem
>  20. http://agilesoftwaredevelopment.com/
>  21. http://twitter.com/AgileArtem
>  22. mailto:mohammed.hassan at jollamobile.com
>  23. mailto:mohammed.hassan at jollamobile.com
>  24. http://agilesoftwaredevelopment.com/
>  25. http://twitter.com/AgileArtem
>  26. http://agilesoftwaredevelopment.com/
>  27. http://twitter.com/AgileArtem
>  28. http://agilesoftwaredevelopment.com/
>  29. http://twitter.com/AgileArtem
>  30. mailto:mohammed.hassan at jollamobile.com
>  31. http://agilesoftwaredevelopment.com/
>  32. http://twitter.com/AgileArtem
>  33. http://agilesoftwaredevelopment.com/
>  34. http://twitter.com/AgileArtem
>  35. http://agilesoftwaredevelopment.com/
>  36. http://twitter.com/AgileArtem
>  37. http://agilesoftwaredevelopment.com/
>  38. http://twitter.com/AgileArtem
>  39. http://agilesoftwaredevelopment.com/
>  40. http://twitter.com/AgileArtem
>  41. http://bit.ly/videofla109
>  42. https://github.com/amarchen/video-flash-trial/tree/v0.1-9/
>  43. mailto:mohammed.hassan at jollamobile.com
>  44. mailto:mohammed.hassan at jollamobile.com
>  45. mailto:mohammed.hassan at jollamobile.com
>  46. http://agilesoftwaredevelopment.com/
>  47. http://twitter.com/AgileArtem
>  48. http://agilesoftwaredevelopment.com/
>  49. http://twitter.com/AgileArtem
>  50. http://agilesoftwaredevelopment.com/
>  51. http://twitter.com/AgileArtem
>  52. mailto:mohammed.hassan at jollamobile.com
>  53. http://agilesoftwaredevelopment.com/
>  54. http://twitter.com/AgileArtem
>  55. http://agilesoftwaredevelopment.com/
>  56. http://twitter.com/AgileArtem
>  57. http://agilesoftwaredevelopment.com/
>  58. http://twitter.com/AgileArtem
>  59. http://agilesoftwaredevelopment.com/
>  60. http://twitter.com/AgileArtem
>  61. mailto:mohammed.hassan at jollamobile.com
>  62. mailto:mohammed.hassan at jollamobile.com
>  63. http://agilesoftwaredevelopment.com/
>  64. http://twitter.com/AgileArtem
>  65. http://agilesoftwaredevelopment.com/
>  66. http://twitter.com/AgileArtem
>  67. http://agilesoftwaredevelopment.com/
>  68. http://twitter.com/AgileArtem
>  69. mailto:mohammed.hassan at jollamobile.com
>  70. http://agilesoftwaredevelopment.com/
>  71. http://twitter.com/AgileArtem
>  72. http://agilesoftwaredevelopment.com/
>  73. http://twitter.com/AgileArtem
>  74. http://agilesoftwaredevelopment.com/
>  75. http://twitter.com/AgileArtem
>  76. http://agilesoftwaredevelopment.com/
>  77. http://twitter.com/AgileArtem
>  78. http://agilesoftwaredevelopment.com/
>  79. http://twitter.com/AgileArtem
>  80. http://agilesoftwaredevelopment.com/
>  81. http://twitter.com/AgileArtem


More information about the Devel mailing list