2012年12月27日 星期四

Word 無法刪除格線

Word 2010 x64 版(OS: Windows 7)
1. 三個 '-' 可以產生分隔線。
2. 運氣不好'文字格線被設定時,貼齊格線'被啟用。
3. 無法刪除格線。
4. 解決之道
    上下各加一空白段落,將格線夾在中間
    進格式解除
5. 刪除此上下空白選項即可。


2012年12月19日 星期三

Process Stereo Video Files 1 -- Merge Files

1. Objective : Merge 2 files.
2. Hardware:
    2-1 HTC EVO : Acquire stereo files in mp4 format.
    2-2 ASUS a43sv (Windows 7 x 64)
    2-3 Software:
          2-3-1. Freemake video converter 3.2.1.0 : Convert mp4 to wmv.
          2-3-2. Expression 4.0 pro (w/o codec): can't process mp4 file.
          2-3-3. Visual studio 2010 (x86)
          2-3-4. CyberLink PowerDVD10 : Play stereo video
 3 C# procedure
    3-1. Load 2 stereo files in wmv format (Converted by Freemake Video Converter)
    3-2. Merge 2 files by the method from expression sample program.
    3-3. Call a process to start cyberlink powerdvd and play the merge file.
    3-4. A button allows user to kill the process of the player.

   

2012年12月9日 星期日

Kinect SDK+ Speech SDK + Google Street View

OS: Windows 7 x64
Tools: Visual Studio 2010, Kinect SDK1.5, Speech SDK 11
Hardware: ASUS A43S, XBOX 360 Kinect.
1. Kinect SDK GreenScreen-WPF
2. WindowLoaded
     Add
     2-1 remove AllFrameReady event
     this.sensor.AllFramesReady -= this.SensorAllFramesReady;
     2-2 Add timier 10 secs
            計時器.Interval = new TimeSpan(0, 0, 10); // 10 secs
            計時器.Tick += new EventHandler(計時器_Tick);
            計時器.Start();
     2-3 Add voice commands
            Choices CMDs = new Choices();
            for (int i = 0; i < 地點名稱陣列.Length; i++)
                CMDs.Add(地點名稱陣列[i]);
            ....
      2-4 Timer event: Enable sensor and disable voice command or vice verse
            if (EventOn)
            {
                EventOn = false;
                this.sensor.AllFramesReady -= this.SensorAllFramesReady;
                sre.RecognizeAsync(RecognizeMode.Multiple);
            }
            else
            {
                EventOn = true;
                this.sensor.AllFramesReady += this.SensorAllFramesReady;
                sre.RecognizeAsyncCancel();
            }
3.
4. 下載

2012年12月8日 星期六

Disable event trigger for a fixed period

OS : Windows 7 x64
Tool: Visual Studio 2010 ultimate SP1
WPF application
1. To make 2  window events as Load and MouseWheel, the former is used to set the fixed period timer while the latter is used to generate the simulate event.
2. The trigger of MouseWheel will sent now to the title of window.


private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            this.Title += " " + DateTime.Now.Millisecond.ToString();
            EventOn = false;
            this.MouseWheel -= new MouseWheelEventHandler(Window_MouseWheel);
            t1.Stop();
            t1.Start();
        }
        System.Windows.Threading.DispatcherTimer t1 = new System.Windows.Threading.DispatcherTimer();
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

            t1.Interval = new TimeSpan(0, 0, 0, 0, 200); //200 miliseconds
            t1.Tick += new EventHandler(t1_Tick);
            t1.Start();
        }

        bool EventOn = true;
        void t1_Tick(object sender, EventArgs e)
        {
            //this.Title += DateTime.Now.ToString();
            if (EventOn)
            {
                EventOn = false;
                this.MouseWheel -= new MouseWheelEventHandler(Window_MouseWheel);
            }
            else
            {
                EventOn = true;
                this.MouseWheel += new MouseWheelEventHandler(Window_MouseWheel);
            }
        }
3. Example shows the period may not being exactly 200 ms.


2012年12月3日 星期一

Speech SDK 語音辨識範例

1. OS: Windows 7 x64
2. Tools: VS 2010
               Speech SDK x64 (Install Runtime, SDK and then TTS SR zh-TW)
3.

<Grid>
        <Ellipse Name="OO" Margin="0,0,0,0" Stroke="Red" StrokeThickness="20" Visibility="Hidden"/>
        <Grid Name="XX" Margin="0,0,0,0" Visibility="Hidden" >
            <Line Stroke="Blue" StrokeThickness="20" X1="0" Y1="0" X2="525" Y2="350"/>
            <Line Stroke="Blue" StrokeThickness="20" X1="0" Y1="350" X2="525" Y2="0"/>
        </Grid>
  </Grid>
4.

// 1. Add Ref Microsoft Speech Object Library v 11 Not in COM
// C:\Program Files\Microsoft SDKs\Speech\v11.0\Assembly\Microsoft.Speech.dll
using Microsoft.Speech.Recognition;

namespace WPFOX1
{
    /// <summary>
    /// MainWindow.xaml 的互動邏輯
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Create a new SpeechRecognitionEngine instance.
            SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("zh-TW"));
            // SpeechRecognitionEngine sre = new SpeechRecognitionEngine();

            // Create a simple grammar that recognizes "red", "green", or "blue".
            Choices colors = new Choices();
            colors.Add("對");
            colors.Add("是");
            colors.Add("圈");
            colors.Add("錯");
            colors.Add("差");
            colors.Add("不對");
           
            GrammarBuilder gb = new GrammarBuilder();
            gb.Append(colors);

            // Create the actual Grammar instance, and then load it into the speech recognizer.
            Grammar g = new Grammar(gb);
            sre.LoadGrammar(g);

            // Register a handler for the SpeechRecognized event.
            sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
            sre.SpeechRecognitionRejected += new EventHandler<SpeechRecognitionRejectedEventArgs>(sre_SpeechRecognitionRejected);
            sre.SetInputToDefaultAudioDevice();
            sre.RecognizeAsync(RecognizeMode.Multiple);
        }

        void sre_SpeechRecognitionRejected(object sender, SpeechRecognitionRejectedEventArgs e)
        {
            this.Title = e.ToString();
        }

        void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            //this.Title = e.ToString();
            switch (e.Result.Text)
            {
                case "對":
                case "是":
                case "圈":
                    OO.Visibility = System.Windows.Visibility.Visible;
                    XX.Visibility = System.Windows.Visibility.Hidden;
                    break;
                case "錯":
                case "差":
                case "不對":
                    OO.Visibility = System.Windows.Visibility.Hidden;
                    XX.Visibility = System.Windows.Visibility.Visible;
                    break;
                default:
                    OO.Visibility = System.Windows.Visibility.Hidden;
                    XX.Visibility = System.Windows.Visibility.Hidden;
                    break;
            }
        }
    }
5 結果