-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
前处理后图像发生部分列像素从右侧边界位移到左侧边界 #2386
Comments
原始图片也放上来吧 |
hi, 我用你的代码转图片结果显示正常,代码提供给你
|
感谢,我们找到问题所在了,MNN::CV::Rect::MakeIWH(width, height),MNN::CV::Rect::MakeIWH(destSize, destSize), fit); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
平台(如果交叉编译请再附上交叉编译目标平台):
Platform(Include target platform as well if cross-compiling):
Android
Github版本: 2.2
编译方式: cmake build
Compiling Method
前处理过程:将相机图片转换为垂直,并转为RGB,长边等比例居中缩放到256,短边两侧补0
代码:
int _size = 256;
int w = 720;
int h = 1280;
int rotation = 0;
const float means[3] = {103.53f, 116.535f, 122.40f};
const float normals[3] = {0.01743f, 0.01751f, 0.01712f};
auto pretreat = std::shared_ptrMNN::CV::ImageProcess(
MNN::CV::ImageProcess::create(MNN::CV::RGBA, MNN::CV::RGB, means, 3, normals, 3));
auto fit = MNN::CV::Matrix::ScaleToFit::kCenter_ScaleToFit;
MNN::CV::Matrix matrix = MNN::CV::Matrix::MakeRectToRect(
MNN::CV::Rect::MakeIWH(w, h),MNN::CV::Rect::MakeIWH(_size, _size), fit);
matrix.postRotate(rotation, _size / 2, _size / 2);
if (0) {
matrix.postScale(1.0/_size, 1.0/_size);
matrix.postScale(-1.0, 1.0, 0.5, 0.0);
matrix.postScale(_size, _size);
}
matrix.invert(&matrix);
pretreat->setMatrix(matrix);
auto input = _net->getSessionInput(_session, nullptr);
pretreat->convert(pImage, w, h, 0, input);
输出结果:
正确结果应为:
麻烦帮忙查一下问题所在
The text was updated successfully, but these errors were encountered: