Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为何Mat在写入图片后数据预测不一样 #349

Closed
wangha43 opened this issue Apr 12, 2018 · 2 comments
Closed

为何Mat在写入图片后数据预测不一样 #349

wangha43 opened this issue Apr 12, 2018 · 2 comments

Comments

@wangha43
Copy link

wangha43 commented Apr 12, 2018

在解码一段视频流获得的Mat后,使用ncnn获得的概率不一样,但是Mat数据是一样的
Mat rectMat = temp(v[i]);
fc->detect_facialnet(rectMat);
imwrite("/home/wxc/Pictures/test.png",rectMat);
Mat cv_test = imread("/home/wxc/Pictures/test.png");
fc->detect_facialnet(cv_test);
一个是解码出来的,一个保存后再读取的,经查看打印出来的数据都一样.
其中detect_facialnet是使用ncnn去计算概率,使用的都是ncnn::mat::pixel_bgr2gray
请问哪里不一样呢,搞的头大了没找出原因

@nihui
Copy link
Member

nihui commented Apr 12, 2018

Mat::from_pixels assumes the pixel buffer continous
so, try cloning

Mat rectMat = temp(v[i]).clone();

@wangha43
Copy link
Author

Done,You are right.
Gracias!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants