【问题标题】:Problems with saving image with OpenCV?使用 OpenCV 保存图像的问题?
【发布时间】:2017-12-03 22:28:33
【问题描述】:

所以,这就是我想要的。我有一个使用 OpenCV 绘制圆圈的相机框架。现在,我有一个按钮,允许用户捕获图像帧,然后将图像保存在内部存储中。但问题来了。我不希望图像框中的圆圈出现在保存的图像中。如何在保存之前消除圆圈,然后在保存图像后,圆圈又回到屏幕上?

【问题讨论】:

  • 在图像的克隆上绘制圆圈。渲染克隆,保存原始。

标签: java android opencv


【解决方案1】:

我希望我理解正确。 你覆盖mrgba 矩阵,同时调用Imgproc.circle(mrgba,new Point(centerx,centery),200,new Scalar(255,0,0),10);。首先,复制图像矩阵,就像对 black 所做的那样,然后自己绘制圆。

【讨论】:

    【解决方案2】:

    你试过了吗

    #create a clone (circle) of original (mrgba)
    BufferedImage circle = new BufferedImage(widthOfImage, heightOfImage, 
    BufferedImage.TYPE_INT_RGB);
    Graphics g =circle.createGraphics();
    g.drawImage(mrgba, 0, 0, null);
    
    Imgproc.circle(circle,new Point(centerx,centery),200,new Scalar(255,0,0),10);  #put circle on circle
    
    cv2.imshow("Image", circle) //show circle
    cv2.imwrite(/path/to/file/name, mrgba) //save original
    

    类似的东西。

    【讨论】:

      猜你喜欢
      • 2019-09-03
      • 2020-07-26
      • 2011-07-10
      • 2021-12-27
      • 1970-01-01
      • 1970-01-01
      • 2012-10-28
      • 2010-12-29
      • 2021-02-12
      相关资源
      最近更新 更多