gnuplot、opencv。 CV :: MATからヒストグラムを分配します
-
27-10-2019 - |
質問
gnuplotで[v(1); ...; v(i-1); v(i)]のようなマトリックス(ヒストグラム)をプロットすることは可能ですか。これは、StringsStream << CV :: MAT()を備えた標準出力です。これは、色相値0〜180のy値です。
[25; 0; 0; 0; 0; 0; 1; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 4; 0; 0; 0; 5; 0; 0; 0; 0; 0; 16; 0; 0; 0; 0; 0; 3; 0; 0; 0; 4; 0; 10; 0; 0; 1; 0; 0; 4; 0; 37; 3; 3; 0; 0; 11; 10; 7; 0; 0; 47; 0; 0; 16; 0; 18; 91; 8; 41; 34; 101; 22; 15; 149; 223; 45; 94; 25; 0; 312; 745; 53; 28; 166; 413; 253; 47; 682; 144; 63; 630; 48; 92; 222; 3; 253; 175; 1; 62; 7; 1; 80; 0; 40; 9; 0; 1; 0; 0; 2; 12; 0; 0; 0; 9; 1; 0; 0; 0; 0; 2; 0; 0; 0; 0; 0; 5; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 7; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0]
Gnuplotのデータを提示する方法に関する短いガイドはいいでしょう。
解決
いくつかの選択肢があります(1)gnuplot-cppラッパーを使用します(こちらをダウンロード: http://code.google.com/p/gnuplot-cpp/)これは、そのチュートリアル/ドキュメントを通してそれ自体を導きます
(2)簡単な解決策。値をファイルに保存します。「data.txt」と言ってから、cpp(exec command)から「plot.plt」のようなスクリプトから「exec command)からinvoke:次のように見えます。
#!/usr/bin/gnuplot -persist
set terminal postscript
set output "TXTFILE.ps"
unset key
#set title "Titel"
set xlabel "cy/px"
set ylabel "SFR"
(...)
set grid
plot "DATA.txt" using 1:2 smooth csplines w l ls 1,\
"DATA.txt" using 3:4 smooth csplines w l ls 2
# EOF
ご覧のとおり、出力したばかりのdata.txtをプロットします。 Gnuplotスクリプトの前のすべてにGoogleを使用するFE