Gnuplot,Opencv。显示来自cv :: Mat的直方图

时间:2012-02-19 14:25:25

标签: opencv gnuplot data-presentation

是否可以在gnuplot中绘制像[v(1); ...; v(i-1); v(i)]这样的矩阵(直方图)。这是stringstream的标准输出<< CV ::垫()。这是色调值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 个答案:

答案 0 :(得分:1)

你有几个选择 (1)使用GNUPLOT-CPP包装器(在此处下载:http://code.google.com/p/gnuplot-cpp/) 这将通过其教程/文档

指导自己

(2)简单的解决方案。将值保存到文件中,比如“DATA.txt”,然后从cpp(exec命令)调用类似“plot.plt”的脚本,它看起来像:

    #!/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脚本f.e。