Augmented Realty e.g. in vb.net

Dec 13, 2010 at 11:22 AM

Hi,

     Can  any buddy suggest me the " Augmented Realty e.g. in vb.net"  as I have seen the example in C#.net , but I am not able to Track it

 

With Regard's

Nirav Patel

Coordinator
Dec 13, 2010 at 1:25 PM

There are no VB examples available, but you can try a converter to convert VB.Net to C#

http://converter.telerik.com/

Dec 14, 2010 at 5:16 AM

Hi teichgraf,

      Thank you very much for providing link for converting c# code to vb.net, But one more question is that  is it compulsory to use  VS.NET 2010 with silver light version 4.0  ???

      Because I am using VS.NET 2008 with silver light version 4.0 , Does it make some difference??

      Thanks  in advance

Coordinator
Dec 14, 2010 at 7:40 AM

You need the Silverlight 4 Tools to develop Silverlight. Get them from here http://www.silverlight.net/getstarted/

AFAIK they don't support Visual Studio 2008, but there's also the free Express edition of Visual Studio 2010, which is sufficient.  

Dec 14, 2010 at 8:59 AM

Hi teichgraf,

                         Thanks a lot    teichgraf  to help me out , Can we make example like following links, If you have such example  code then it would be great !!

                        http://www.youtube.com/watch?v=NxQZuo6pFUw
                        http://www.youtube.com/watch?v=ZnBcqV9POkY

                      Thanks  in advance

Coordinator
Dec 14, 2010 at 9:47 AM

The marker detection and AR functionality is provided by this library. See the samples that come with the library. I've also written a tutorial that shows step by step how to augment the reality with a TextBlock. Just replace the Textblock with an image and you have the basic functionality. http://slartoolkit.codeplex.com/wikipage?title=Beginner's%20Guide After the tutorial you should see the code of the SLARToolkitSample. Please note, that you can try the samples on this projects's home page and also see videos.

You have to implement the motion detection and gestures that are shown in the video. Such functionality is not AR and therefore not part of this library.

Also read the License terms, esp. if you want to use it for commercial purposes.

 

- Rene Schulte

Dec 16, 2010 at 10:44 AM

Hi teichgraf,              

               I Have converted your beginner's guide example into vb.net, but its not working can you tell me what is the exact problem?

Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media

Imports SLARToolKit
Imports System.Windows.Media.Media3D

Namespace SLARToolKitBeginnersGuide
    ''' <summary>
    ''' MainPage of the Beginner's Guide
    ''' </summary>
    Partial Public Class MainPage
        Inherits UserControl
        Private captureSource As CaptureSource
        Private arDetector As CaptureSourceMarkerDetector
        Public Event MarkersDetected(ByVal sender As Object, ByVal e As SLARToolKit.MarkerDetectionEventArgs)
        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub UserControl_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
            ' Initialize the webcam
            captureSource = New CaptureSource()
            captureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice()

            ' Fill the Viewport Rectangle with the VideoBrush
            Dim vidBrush = New VideoBrush()
            vidBrush.SetSource(captureSource)
            Viewport.Fill = vidBrush

            '  Initialize the Detector
            arDetector = New CaptureSourceMarkerDetector()
            ' Load the marker pattern. It has 16x16 segments and a width of 80 millimeters
            Dim marker__1 = Marker.LoadFromResource("Marker_SLAR_16x16segments_80width.pat", 16, 16, 80)
            ' The perspective projection has the near plane at 1 and the far plane at 4000
            arDetector.Initialize(captureSource, 1, 4000, marker__1)

            ' Attach the AR detection event handler
            ' The event is fired if at least one marker was detected
            Dim d As New SLARToolKit.MarkerDetectionEventArgs
            RaiseEvent MarkersDetected(sender:=Nothing, e:=d)

            ' Change to UI thread in order to manipulate the text control's projection
            Dispatcher.BeginInvoke(Function()
                                       ' Calculate the projection matrix
                                       Dim dr = d.DetectionResults
                                       If dr.HasResults Then
                                           ' Center at origin of the TextBlock
                                           Dim centerAtOrigin = Matrix3DFactory.CreateTranslation(-Txt.ActualWidth * 0.5, -Txt.ActualHeight * 0.5, 0)
                                           ' Swap the y-axis and scale down by half
                                           Dim scale = Matrix3DFactory.CreateScale(0.5, -0.5, 0.5)
                                           ' Calculate the complete transformation matrix based on the first detection result
                                           Dim world = centerAtOrigin * scale * dr(0).Transformation

                                           ' Calculate the final transformation matrix by using the camera projection matrix from SLARToolkit
                                           Dim vp = Matrix3DFactory.CreateViewportTransformation(Viewport.ActualWidth, Viewport.ActualHeight)
                                           Dim m = Matrix3DFactory.CreateViewportProjection(world, Matrix3D.Identity, arDetector.Projection, vp)

                                           ' Apply the final transformation matrix to the TextBox
                                           Txt.Projection = New Matrix3DProjection() With { _
                                            .ProjectionMatrix = m _
                                           }
                                       End If
                                   End Function)

		End Sub

        Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
            ' Request webcam access and start the capturing
            If CaptureDeviceConfiguration.RequestDeviceAccess() Then
                captureSource.Start()
            End If
        End Sub
    End Class
End Namespace



Dec 28, 2010 at 10:57 AM

Hi teichgraf,

                     Is it possible to use gestures motion detection in silverlight after using "SLARToolkit" ?

I mean to say that whether "SLARToolkit" is compatible with gestures motion detection libreries?

or

Apart from these, gestures motion detection in silverlight is possible ???

 

Many Thanks,

Nirav Patel