我imread()在使用jpg文件的Windows 7上遇到了Matlab(2014)和OpenCV(3.0)中的函数问题.
通过读取相同的文件jpg和相同的像素,我没有相同的值.
这是我的2个代码:(OpenCV代码后跟Matlab代码)和我的值(模式调试在OpenCV中看到,键盘在Matlab中)
#include <opencv2\opencv.hpp>
#include <cstdio>
using namespace cv;
using namespace std;
int main()
{
Mat img = imread("test.jpg");
uchar pb = img.at<Vec3b>(0, 0).val[0];
uchar pg = img.at<Vec3b>(0, 0).val[1];
uchar pr = img.at<Vec3b>(0, 0).val[2];
int d = img.depth();
int t = img.type();
}
Run Code Online (Sandbox Code Playgroud)
价值观:
pixel [0,0] = (147,174,204); // = index(1,1) in the image.
d = 0;
t = 16;
Run Code Online (Sandbox Code Playgroud)
代码Matlab:
img = imread('test.jpg');
img(1,1,:)
whos img
Run Code Online (Sandbox Code Playgroud)
价值观:
ans(:,:,1) =
148
ans(:,:,2) =
174
ans(:,:,3) = …Run Code Online (Sandbox Code Playgroud)