是否可以在gnuplot中绘制类似于[v(1); ...; v(i-1); v(i)]的矩阵(直方图)。这是stringstream << 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命令)调用类似“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脚本上的所有以前版本都使用google f.e.
关于opencv - Gnuplot,Opencv。从cv::Mat显示直方图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9350011/