Draw Waveform from Mat

asked Mar 20 '14

StudentFeM gravatar image

updated Mar 20 '14

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 :-)

Preview: (hide)

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 (Mar 20 '14)edit

That works, thank you very much!

StudentFeM gravatar imageStudentFeM (Mar 20 '14)edit