Computer Vision Advent Calendar 2012 4日目
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
#contents
*この記事について [#k3cf209a]
-この記事は[[Computer Vision Advent Calendar 2012>http://...
-詳しくは(ry¬e{cv-advent-calendar};
*画像の並べ [#s482c4b7]
-OpenCV を使ってると、画像を並べて表示したくなることが多...
-ない人はきっとこれから多々ある。
-どれだけ短く連結できるか、って2、3パターン書いてたら、 o...
-ただ、 [[@wk77>https://twitter.com/wk77]] さん¬e{wk77...
*ソースコード [#m1e11860]
-C#のソースコード
#geshi(C#,number){{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace OpenCvSharpWithWpf
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// OpenCvSharp をダウンロードする。
// http://code.google.com/p/opencvsharp/
// Open CV にパスが通っていることを確認する。
// .NET 4.0 の WPF のプロジェクトを作る。
// OpenCvSharp.dll と OpenCvSharp.Extensions.dll への...
// (このプロジェクトファイルでは OpenCvSharpDlls 内に...
// ここから下のコードを追加する。
// 普段は using OpenCvSharp; とかしてる。
var openFileDialog = new Microsoft.Win32.OpenFileDialo...
if (openFileDialog.ShowDialog() != true) { return; }
OpenCvSharp.IplImage loadedIplImage;
try { loadedIplImage = new OpenCvSharp.IplImage(openFi...
catch { return; }
var srcIplImage = new OpenCvSharp.IplImage(30, 30, loa...
OpenCvSharp.Cv.Resize(loadedIplImage, srcIplImage);
Func<System.Windows.Controls.Image> getImageFunc = new...
{
var iplImage = srcIplImage.Clone();
var bitmapSource = OpenCvSharp.Extensions.BitmapSourc...
var wpfImage = new System.Windows.Controls.Image() { ...
wpfImage.Source = bitmapSource;
return wpfImage;
});
var horizontalStackPanel = new System.Windows.Controls...
var verticalStackPanel = new System.Windows.Controls.S...
var uniformGrid = new System.Windows.Controls.Primitiv...
var wrapPanel = new System.Windows.Controls.WrapPanel(...
for (int i = 0; i < 5; i++)
{
horizontalStackPanel.Children.Add(getImageFunc());
verticalStackPanel.Children.Add(getImageFunc());
uniformGrid.Children.Add(getImageFunc());
wrapPanel.Children.Add(getImageFunc());
}
var windowContent = new System.Windows.Controls.Primit...
windowContent.Children.Add(horizontalStackPanel);
windowContent.Children.Add(verticalStackPanel);
windowContent.Children.Add(uniformGrid);
windowContent.Children.Add(wrapPanel);
this.Content = windowContent;
this.SizeToContent = System.Windows.SizeToContent.Widt...
}
}
}
}}
*実行結果 [#v3eab029]
#ref(Result_121204.png)
*ソースコード [#w3de6e81]
-ソースコード一式もzipでご提供頂きました!
#ref(OpenCvSharpWithWpf_121204-2344.zip)
*最後に [#z7d58585]
-手島の担当は本来は12月3日だけで、それは[[1日に投稿した記...
-もうネタがないので、あとは他の方々(ry
-企画者の [[@sakanazensen>https://twitter.com/sakanazense...
終了行:
#contents
*この記事について [#k3cf209a]
-この記事は[[Computer Vision Advent Calendar 2012>http://...
-詳しくは(ry¬e{cv-advent-calendar};
*画像の並べ [#s482c4b7]
-OpenCV を使ってると、画像を並べて表示したくなることが多...
-ない人はきっとこれから多々ある。
-どれだけ短く連結できるか、って2、3パターン書いてたら、 o...
-ただ、 [[@wk77>https://twitter.com/wk77]] さん¬e{wk77...
*ソースコード [#m1e11860]
-C#のソースコード
#geshi(C#,number){{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace OpenCvSharpWithWpf
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// OpenCvSharp をダウンロードする。
// http://code.google.com/p/opencvsharp/
// Open CV にパスが通っていることを確認する。
// .NET 4.0 の WPF のプロジェクトを作る。
// OpenCvSharp.dll と OpenCvSharp.Extensions.dll への...
// (このプロジェクトファイルでは OpenCvSharpDlls 内に...
// ここから下のコードを追加する。
// 普段は using OpenCvSharp; とかしてる。
var openFileDialog = new Microsoft.Win32.OpenFileDialo...
if (openFileDialog.ShowDialog() != true) { return; }
OpenCvSharp.IplImage loadedIplImage;
try { loadedIplImage = new OpenCvSharp.IplImage(openFi...
catch { return; }
var srcIplImage = new OpenCvSharp.IplImage(30, 30, loa...
OpenCvSharp.Cv.Resize(loadedIplImage, srcIplImage);
Func<System.Windows.Controls.Image> getImageFunc = new...
{
var iplImage = srcIplImage.Clone();
var bitmapSource = OpenCvSharp.Extensions.BitmapSourc...
var wpfImage = new System.Windows.Controls.Image() { ...
wpfImage.Source = bitmapSource;
return wpfImage;
});
var horizontalStackPanel = new System.Windows.Controls...
var verticalStackPanel = new System.Windows.Controls.S...
var uniformGrid = new System.Windows.Controls.Primitiv...
var wrapPanel = new System.Windows.Controls.WrapPanel(...
for (int i = 0; i < 5; i++)
{
horizontalStackPanel.Children.Add(getImageFunc());
verticalStackPanel.Children.Add(getImageFunc());
uniformGrid.Children.Add(getImageFunc());
wrapPanel.Children.Add(getImageFunc());
}
var windowContent = new System.Windows.Controls.Primit...
windowContent.Children.Add(horizontalStackPanel);
windowContent.Children.Add(verticalStackPanel);
windowContent.Children.Add(uniformGrid);
windowContent.Children.Add(wrapPanel);
this.Content = windowContent;
this.SizeToContent = System.Windows.SizeToContent.Widt...
}
}
}
}}
*実行結果 [#v3eab029]
#ref(Result_121204.png)
*ソースコード [#w3de6e81]
-ソースコード一式もzipでご提供頂きました!
#ref(OpenCvSharpWithWpf_121204-2344.zip)
*最後に [#z7d58585]
-手島の担当は本来は12月3日だけで、それは[[1日に投稿した記...
-もうネタがないので、あとは他の方々(ry
-企画者の [[@sakanazensen>https://twitter.com/sakanazense...
ページ名: