予期していなかった奇妙な動作が見られます。CV_64FC3
タイプ(3 チャネル、浮動小数点値)の純白のマトリックスで、色付きの円を描いています。予期しない動作は、円が実際には特定の RGB 値に対してのみ表示されることです。これは、2 つの異なる色に対する私のプログラムのサンプル出力です。
明らかに、灰色の円がありません。私の質問: なぜですか? そして、どうすればそれを表示できますか?以下は、実行できる小さなプログラムのサンプル コードです。
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
void main()
{
const unsigned int diam = 200;
cv::namedWindow("test_window");
cv::Mat mat(diam, diam, CV_64FC3);
// force assignment of each pixel to white.
for (unsigned row = 0; row < diam; ++row)
{
for (unsigned col = 0; col < diam; ++col)
{
mat.at<cv::Vec3d>(row, col)[0] = 255;
mat.at<cv::Vec3d>(row, col)[1] = 255;
mat.at<cv::Vec3d>(row, col)[2] = 255;
}
}
// big gray circle.
cv::circle(mat, cv::Point(diam/2, diam/2), (diam/2) - 5, CV_RGB(169, 169, 169), -1, CV_AA);
cv::imshow("test_window", mat);
cv::waitKey();
}