locked
Tracking algorithm with metro RRS feed

  • שאלה

  • Hi,

    well, I've developed a tracking algorithm, and I want to implement it with metro ... my question is ... how do I get a stream of images from the camera  (i need the pixeldata) and show them ? I tried to search for this ... all I could find is using MFC .. which doesn't help me ...

    any idea how can I get this pixel data stream from the camera do some manipulation and show it to the user ?

    יום חמישי 28 יוני 2012 16:04

תשובות

  • Hi BlacKICce,

    You've posted a question in the Metro Style Applications Israeli forum. All questions here should be asked in Hebrew language.

    For this time only, I'll pass and provide you with an answer.

    First, I understand that you're familiar with C++ since you've mentioned MFC, and this is good, since for your solution, I highly recommend using C++ and not C# for Video processing.

    In general, to capture Video from a video device into a file or a stream, you should use the:

    Windows::Media::Capture::MediaCapture type. Specifically you should call the StartRecordToStreamAsync method.

    There is a great sample in the SDK which you can download from here:

    http://code.msdn.microsoft.com/windowsapps/media-capture-sample-adf87622

    Hope this help.

    Tomer Shamam,

    CodeValue


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • הוצע כתשובה על-ידי תומר שמםModerator יום חמישי 28 יוני 2012 20:09
    • סומן כתשובה על-ידי BlacKICcE יום שישי 29 יוני 2012 07:32
    יום חמישי 28 יוני 2012 20:04
    מנחה דיון

כל התגובות

  • Hi BlacKICce,

    You've posted a question in the Metro Style Applications Israeli forum. All questions here should be asked in Hebrew language.

    For this time only, I'll pass and provide you with an answer.

    First, I understand that you're familiar with C++ since you've mentioned MFC, and this is good, since for your solution, I highly recommend using C++ and not C# for Video processing.

    In general, to capture Video from a video device into a file or a stream, you should use the:

    Windows::Media::Capture::MediaCapture type. Specifically you should call the StartRecordToStreamAsync method.

    There is a great sample in the SDK which you can download from here:

    http://code.msdn.microsoft.com/windowsapps/media-capture-sample-adf87622

    Hope this help.

    Tomer Shamam,

    CodeValue


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • הוצע כתשובה על-ידי תומר שמםModerator יום חמישי 28 יוני 2012 20:09
    • סומן כתשובה על-ידי BlacKICcE יום שישי 29 יוני 2012 07:32
    יום חמישי 28 יוני 2012 20:04
    מנחה דיון
  • Hi,

    There are several ways to read Video File:

    1. IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read);

    2. Convert stream to byte array -

    using (MemoryStream zipMemoryStream = new MemoryStream(WindowsRuntimeBufferExtensions.ToArray(await FileIO.ReadBufferAsync(mainFile))))
    {
    }

    3. Data Reader

            private async Task ReadVideoPath()
            {
                try
                {
                    StorageFile sampleFile = await ApplicationData.Current.LocalFolder.GetFileAsync(videoDataFilename);
                    using (IRandomAccessStream readStream = await sampleFile.OpenAsync(FileAccessMode.Read))
                    {
                        // Read the file to an IInputStream stream, then get and load the DataReader.
                        using (IInputStream inputStream = (IInputStream)readStream)
                        {
                            using (DataReader dataReader = new DataReader(inputStream))
                            {
                                uint numBytesLoaded = await dataReader.LoadAsync((uint)readStream.Size);
                                videoFile = dataReader.ReadString(numBytesLoaded);
                            }
                        }
                    }
                }
                catch (System.IO.FileNotFoundException)
                {
                    // photoDataFilename not found
                }
            }


    Please mark the replies as answers if they help and unmark them if they provide no help.
    My blog: blogs.microsoft.co.il/blogs/shair

    Shai Raiten

    יום שישי 29 יוני 2012 17:30
  • Thanks for your answer, but it's not relevant since the question was "how do I get a stream of images from the camera". Not from a file.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    יום שישי 29 יוני 2012 21:57
    מנחה דיון