Draw Waveform from Mat

asked 2014-03-20 05:26:58 -0600

StudentFeM gravatar image

updated 2014-03-20 05:36:44 -0600

berak gravatar image

Hi,

I'd like to draw a waveform Diagram from cv:Mat.
So I use the line()-Function with Point(int x, int y) inside.

I try it with:

Code:

line(waveY,Point(bin_w * (i - 1),wave_h) ,Point(bin_w * (i), ycrcb_planes[0].row(i).col(0)), Scalar(128, 128, 128), 2, 8, 0);

The Problem is, that cv Point need int x and int y. So I have to convert every single "Pixel" from
Matrix into an int value.

I need something like that:

Code:

 int value = (int) ycrcb_planes[0].row(i).col(0)

Does anyone knows a solution for that?
I would be very happy :-)

edit retag flag offensive close merge delete

Comments

row() and col() make a copy from the resp. matrix column / row.

you probably wanted: uchar value = ycrcb_planes[0].at<uchar>(i,0);

berak gravatar imageberak ( 2014-03-20 05:35:12 -0600 )edit

That works, thank you very much!

StudentFeM gravatar imageStudentFeM ( 2014-03-20 08:22:31 -0600 )edit