×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    292

    Multiple camera streaming ?

    Hi guys,

    I was wondering if it's possible to show 2 or more diffèrent camera streams (each one with an effect).
    I tried doing it with the Realtime Filter Demo, but it didn't work

    Code:
                var resolution = PhotoCaptureDevice.GetAvailablePreviewResolutions(CameraSensorLocation.Back).Last();
    
                _photoCaptureDevice = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Back, resolution);
    
                await _photoCaptureDevice.SetPreviewResolutionAsync(resolution);
    
                _cameraEffect = new NokiaImagingSDKEffects();
                _cameraEffect.PhotoCaptureDevice = _photoCaptureDevice;
    ...
                _mediaElement.SetSource(_cameraStreamSource);
    
    
                _cameraEffect1 = new NokiaImagingSDKEffects();
                _cameraEffect1.PhotoCaptureDevice = _photoCaptureDevice;
    ...
                _mediaElement1.SetSource(_cameraStreamSource1);
    The Stream works only in the second part "cameraEffect1"

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    429

    Re: Multiple camera streaming ?

    My best guess is that the first Effects-Class will consume the captured images leaving nothing for the second instance to process. Looking at the sample implementation of the CameraStreamSource this seems quite likely. I guess you would have to modify the NokiaImagingSDKEffects class to allow multiple effects to be configured in conjunction with multiple MediaElements and in GetNewFrameAndApplyEffect() you then loop over all the Effect/MediaElement (Bitmap) combinations to apply the desired effect.

    Perhaps there's a better way to achieve this though.

  3. #3
    Registered User
    Join Date
    Mar 2007
    Location
    ..., Earth, Brazil, Paraiba, Campina Grande
    Posts
    72

    Re: Multiple camera streaming ?

    I've never used the Nokia Image SDK, but in HTML 5 you use the Camera stream just to get the camera image and draw it on a <canvas> tag (where you actually apply the effect).

    In this way, you can have multiple <canvas> tags (each one with its own effect) and just one camera stream that draws the camera image onto each <canvas>.

    I hope this help you.

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Multiple camera streaming ?

    HI.
    You want display same camera with different filter at the same time?
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  5. #5
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    292

    Re: Multiple camera streaming ?

    Thanks guys for your replies.

    Quote Originally Posted by yan_ View Post
    HI.
    You want display same camera with different filter at the same time?
    YES that what I'm searching for (I'm wondering why I couldn't come up with a "clear" explaination of my issue as you did haha).

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Multiple camera streaming ?

    i don't thinks you can do it with multiple media element. Or you will copy severale times same buffer (maybe it's not possible to display several media element, i don't know)
    You could do that :
    1- you create a pipeline by output, beginning by a bitmapSource.
    2- a preview buffer will be the source for each BitmapSource.

    3- you add an event on preview available event
    4- in this event if no rendering is running, get current preview in a buffer and lanch all rendering. Normally you can launch several rendering in parallel. You could try render 4 by 4.

    Pipeline outputs could be a WriteableBitmap. Theses bitmap will be displayed in Image control. You must change the cache property (to bitmapcache if i remember).
    If i have time, i'll make a small sample.
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  7. #7
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Multiple camera streaming ?

    i code quickly my idea. It need to be improved but it works.
    multiStream.zip

    In simple,
    1- i share a bitmap as image source between several pipeline. This bitmap use an int array as input.
    2- i copy preview to int array and launch rendering.

    I try to run 4 rendering in parralel. I don't know if it's better than rendering one by one.

    Yan
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  8. #8
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    292

    Re: Multiple camera streaming ?

    Thanks for your help Yan (and for the sample), I will try this asap, and hopefully get back with a positive feedback

  9. #9
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Multiple camera streaming ?

    i thinks you cnan replace Image control by Canvas and ImageBrush.
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  10. #10
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    292

    Re: Multiple camera streaming ?

    Quote Originally Posted by yan_ View Post
    i thinks you cnan replace Image control by Canvas and ImageBrush.
    tested it few minutes ago.
    It's was working "PERFECTLY", and also worked fine with the ImageBrush, but still don't know which is the best in terms of performance, I believe we should write an article for this one (can't make it for the Nokia create, about 7hours left)

    Thanks again Yan

    EDIT : after 5 hours, trying to make a simple "working" app for the sample and writing an article for nokia create I lost hope lol, hopefully I will finish it this week.
    Last edited by Loukt; 2013-12-16 at 04:51.

  11. #11
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Multiple camera streaming ?

    Quote Originally Posted by Loukt View Post
    It's was working "PERFECTLY", and also worked fine with the ImageBrush, but still don't know which is the best in terms of performance
    I understand that canvas use GPU.
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  12. #12
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    429

    Re: Multiple camera streaming ?

    I believe all XAML based rendering is using the GPU - at least when the render target is the screen buffer (might be different when rendering to a WriteableBitmap). As for performance the biggest gains might be to reduce the preview resolution used by the camera to something that's as close to the output resolution as possible so you don't have to do that resizing anywhere (also reduces the amount of processing needed to be done by the filters and the size of the memory copies).

    I don't know if you really gain much from the GPU processing in this case as the filters are processed on the CPU+NEON regardless of what method you use to render them to the display in the end.

  13. #13
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Multiple camera streaming ?

    Quote Originally Posted by SB Dev View Post
    I believe all XAML based rendering is using the GPU
    Unfortunately, we can't find good information about it. But it's what i read about canvas :
    It's faster to display dynamic element. And it's why, when you display the viewfinder you use canvas. Other element add abstraction like cache for the rendering.
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  14. #14
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    429

    Re: Multiple camera streaming ?

    If it's working without caching as constant changes to the data are expected that is highly likely to yield better performance (GPU rendering or not).

  15. #15
    Registered User
    Join Date
    Dec 2013
    Posts
    1

    Re: Multiple camera streaming ?

    Thanks for sharing. It is helpful for my experience. Thanks for such a great idea. Ans also thanks to the moderator for getting opportunity to him.

Similar Threads

  1. RTSP live streaming from IP Camera
    By viraj.mehta in forum Mobile Java General
    Replies: 5
    Last Post: 2012-04-13, 11:56
  2. camera video streaming
    By matrix241 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2008-08-09, 11:49
  3. Camera streaming to display , how?
    By skela in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2007-11-12, 15:06
  4. streaming from camera to http
    By lalle112 in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2006-10-04, 15:19
  5. camera video streaming
    By tyrial in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2006-01-27, 21:19

Posting Permissions

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