相关疑难解决方法(0)

当需要颜色时,OpenCv Core.line 会绘制白色

在环境中OpenCv4Android,当我创建Mat图像并用于Core.line()在图像上绘图时,它始终显示白色而不是我指定的颜色。

白色方块代替绿色方块

我看到了一个与灰度相关的问题,但我的图像尚未转换为灰度。

public class DrawingTest extends AppCompatActivity {
    public static final Scalar GREEN = new Scalar(0,255,0);
    private RelativeLayout mLayout;
    private ImageView imageView;

    static {
        System.loadLibrary("opencv_java");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_drawing_test);

        mLayout = (RelativeLayout) findViewById(R.id.activity_drawing_test);
        mLayout.setDrawingCacheEnabled(true);

        imageView = (ImageView) this.findViewById(imageView_dt);

        //test.jpg is in the drawable-nodpi folder, is an normal color jpg image.
        int drawableResourceId = getResources().getIdentifier("test", "drawable", getPackageName());
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), drawableResourceId);
        //Mat matImage = new Mat(); // …
Run Code Online (Sandbox Code Playgroud)

android opencv

1
推荐指数
1
解决办法
1518
查看次数

标签 统计

android ×1

opencv ×1