c++ - OpenCV convertTo 从 bmp 图像到 double/CV_64FC1 没有给出与 Matlab 中相同的值
问题描述
在 OpenCV C++ 中,我尝试过
cv::Mat mat=cv::imread("input.bmp");
mat.convertTo(mat, CV_64FC1, 1.0/255.0);
for (int i=0; i<2; i++) {
std::cout<<"\n";
for (int j=0; j<2; j++) {
std::cout<<mat.at<double>(i,j)<< " ";
}
}
这些值与我在 Matlab 中得到的值相匹配,但如果我尝试:
for (int i=314; i<316; i++) {
std::cout<<"\n";
for (int j=350; j<352; j++) {
std::cout<<mat.at<double>(i,j)<< " ";
}
}
我得到的值是
.165 .189
.274 .208
在 Matlab 中,如果我这样做
im=imread("input.bmp")
im2double(im(315:316,351:352))
我明白了
.294 .310
.317 .294
为什么是这样?
解决方案
推荐阅读
- ruby-on-rails - 自定义路线和搜查
- c++ - 从 Beast.1.0.0-b66 到 Boost.1.67.0.Beast 的端口性能下降
- azure-cosmosdb - 索引特定 DocumentDB 类型的实体
- java - 计算 HOG 后获取零描述符
- java - Jcraft 1.5 SFTP 覆盖失败 ID 4
- hp-uft - 如何使用 UFT 按 Enter
- ios - 如何使用自动调整大小修复 iPhone X 上的按钮大小调整
- java - Vaadin:识别 HTML 添加的 CSS 类
- python - 从图像和标签中有效地提取补丁
- arrays - 替换数组中的多次出现 - Swift 4.1