Ask Your Question
3

Having weird issues drawing lines on android

asked 2012-11-14 16:58:13 -0600

Jdban gravatar image

When I draw lines on android, I'm getting weird graphical glitches like so: image description

these lines are being drawn to the image pretty simply:

Core.line(mRgba, pt1, pt2, new Scalar(0, 255, 0), 3);

Does anyone know why its not doing what it should be doing and just putting that entire line as green?

edit retag flag offensive close merge delete

5 answers

Sort by ยป oldest newest most voted
4

answered 2012-11-15 03:05:26 -0600

Daniil Osokin gravatar image

Hi! May be something wrong with alpha channel usage? Try this call with 255 value of alpha channel:

Core.line(mRgba, pt1, pt2, new Scalar(0, 255, 0, 255), 3);
edit flag offensive delete link more
1

answered 2012-11-16 01:26:38 -0600

  1. The first possible reason is data raise. If I understand correctly you use some time demand algorithm to process frame from camera. So, camera rewrite your mat faster then you can process it. Some parts of frame belongs to already processed frame and some parts belong to new frame from camera.
  2. The second possible reason is invalid data access due to access to invalid submats of current frame of some operations with incompatible data types.
edit flag offensive delete link more
0

answered 2013-05-25 07:46:03 -0600

Hugo Feng gravatar image

Used to have the same weird problem here. Finally I found out the cause was these lines:

bmp = Bitmap.createScaledBitmap(bmp, canvas.getWidth(), canvas.getHeight(), false);
canvas.drawBitmap(bmp, 0, 0, null);

After I changed them to:

canvas.drawBitmap(bmp, (canvas.getWidth() - bmp.getWidth()) / 2, (canvas.getHeight() - bmp.getHeight()) / 2, null);

Everything went fine and solid. However image may not fullfill the canvas in this way. Still haven't found a proper way to scale the image ...

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-11-14 16:58:13 -0600

Seen: 1,991 times

Last updated: May 25 '13