这是我的代码,当我尝试使用imshow时,图像是黑色的
cv::Mat src(height, width, CV_16U);
for (int i = 0; i < width* height; ++i)
{
src.at<unsigned short>(i) = input_image[i]/1023;
}
cv::Mat temp;
cv::resize(src, temp, cv::Size(), 0.3, 0.3, cv::INTER_LINEAR);
cv::imshow("image1", temp);
cv::waitKey(0);
cv::Mat imageData;
cv::cvtColor(src, imageData, cv::COLOR_BayerGR2RGB);
cv::resize(imageData, temp, cv::Size(), 0.3, 0.3, cv::INTER_LINEAR);
cv::imshow("image1", temp);
cv::waitKey(0);
如果我将代码更改为
cv::Mat src(height, width, CV_32F);
for (int i = 0; i < width* height; ++i)
{
src.at<float>(i) = input_image[i]/1023;
}
你能解释一下如何显示图像吗?
答案 0 :(得分:1)
由于您的COUNT(*)
在SELECT e.WOID,
CASE WHEN COUNT(f.FACILITYID) = 0 THEN 'UNKNOWN LOCATIONS'
WHEN COUNT(*) > 1 THEN 'MULTIPLE FACILITIES'
ELSE MAX(f.FACILITYNAME)
END AS facilityName
FROM WOENTITY AS e
LEFT JOIN FACILITY AS f
ON f.FACILITYID = e.ENTITYUID
GROUP BY e.WOID
ORDER BY e.WOID;
范围内,除以1023,您得到的值介于0和1之间。当您将其转换为无符号整数类型时,您的图像全部为零。 (它可能会将它们中的一些变为1,但无论如何这都不会真正可见。)
要获得使用input_image
全范围的数字,您需要乘以0..1023
:
unsigned short
或
65535