1 Attachment(s)
Qwt spectrogram with dashed contour
Hi,
I'm trying to display contour line of a qwt spectrogramm as dashed line.
Thus I sligthly modified the spectrogram exemple
Code:
void Plot::showContour( bool on )
{
d_spectrogram
->setDefaultContourPen
(QColor(Qt
::yellow),
3, Qt
::DashLine);
replot();
}
void Plot::showSpectrogram( bool on )
{
//d_spectrogram->setDefaultContourPen(
// on ? QPen( Qt::black, 0 ) : QPen( Qt::NoPen ) );
replot();
}
and here's the result:
Attachment 10039
any idea on how I can handle this?
thanks for your attention
regards
Re: Qwt spectrogram with dashed contour
The CONREC algo returns many, many small lines that look like a being connected.
There is another algo that calculates real polygons ( what could be interesting option for drawing a spectrogram in a different way - being composed of vector graphics ) but I never implemented this one.
Uwe
Re: Qwt spectrogram with dashed contour
Thanks a lot for your answer Uwe,
is there a simple way to get access to the contour lines? In that way I could perhaps decimate them to archieve the desired effect.
Pierrick
Re: Qwt spectrogram with dashed contour
You could overload QwtRasterData::contourLines() or QwtPlotSpectrogram::renderContourLines and store the result somewhere.
For creating vector shapes or bezier paths you could have a look at: http://apptree.net/conrec.htm. If you want to go this direction ( or you have any other vectorizer in mind ) I would be very happy if you would contribute some code.
Uwe
Re: Qwt spectrogram with dashed contour
I overloaded the QwtRasterData::contourLines() to see the result and now (thanks to you Uwe) I can see the problem which is the number of polylines.
I have no time yet to resolve that but I think this link can help : http://bost.ocks.org/mike/simplify/ it shows the use of the Visvalingam’s algorithm which can simplify shapes.
I'll try to do something as soon as I got times
Pierrick
Re: Qwt spectrogram with dashed contour
Quote:
Originally Posted by
Pierrick
it shows the use of the Visvalingam’s algorithm which can simplify shapes.
This is an alternative for Douglas Peucker ( already implemented as QwtWeedingCurveFitter ) what is about reducing the number of points of a polygon. What you need is to build a polygon from an "unordered" set of single lines - what is something very different.
But nevertheless I will check the algo as it seems to be a "less quality but faster" thing. But I'm not sure as by reducing the chunk size you already have an easy way to speed to Douglas Peucker heavily.
Uwe