Skip to content

warp_perspective 输出图像全黑 #215

@fengyanWang

Description

@fengyanWang

您好,我这边基于get_perspective_transform和warp_perspective,对图像做仿射变换,但是输出的图像一直是全黑的,相关代码如下,期待您的回复!

  fcv::Point2f src_points[4];
  fcv::Point2f dst_points[4];
  int target_height = 0, target_width = 0;
  .......
  
  fcv::Mat transform = fcv::get_perspective_transform(src_points, dst_points);

  fcv::Mat fcv_src(img_w, img_h, fcv::FCVImageType::PKG_RGBA_F32, imgData.data);
  fcv::Mat fcv_dst;
  fcv::warp_perspective(fcv_src, fcv_dst, transform);

  cv::Mat opencvMat(img_h, img_w, CV_8UC(fcv_dst.channels()),fcv_dst.data());
  std::string res_path = "/data/local/tmp/flycv_res.jpg";
  cv::imwrite(res_path, opencvMat);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions