Question

seeking all the people who knows how to use QWT.

I am trying to duplicate a MatLab plot equivalent graph using QWT, QT5 and Visual Studio C++. The graph I am trying to duplicate is a graph of mean pixel values along the y-axis.

The code in MatLab looks something like this:

figure;
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
set(gcf,'name','plot of mean along y','numbertitle','off') %set figure name


meanvalue= mean(BW2,2); //where the BW2 is the image I am trying to plot
meanvalue2 = floor(mean(BW2,2));
meanvalue
plot(meanvalue);
xlabel('row number');          
ylabel('mean value'); 
title('Analysis');


figure;
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
set(gcf,'name','Histogram of mean along y','numbertitle','off') %set figure name

m=size(gray,1);


bin = m;
bar(meanvalue);
subplot(1, 1, 1);

This code is written by me in MatLab, and I have been then trying to duplicate this code in C++. This is because MatLab is expensive and I was told by my supervisor to emulate this code in MSVC 2010 instead.

From recommendations online and on stackoverflow forums, the 2 most popular seems to be GNUPLOT and QWT. I have tried GNUPLOT, but ran into many configuration problems which I cannot solve. Hence I recently changed to QWT about 2 weeks plus ago.

I have worked with some basic plots for QWT from QT creator itself. Due to lack of documentation, I do not really know how to plot the MatLab equivalent code shown above. Can anyone with QWT experience guide me please? I been stuck on this for about a month already.

Another question is can I write this code equivalent from the QT add in for Visual Studio? This is because all the documentation and tutorials I found so far are for within QT itself, and requires editing of the .pro file.

When I try create a project from the QT add-in, there isn't any .pro file in which I can edit. Please do advice. Sorry for my lack of expertise in QWT. Thanks all. Any suggestions, sample codes, ideas are strongly welcomed and will be greatly appreciated.

Was it helpful?

Solution

I don't have a full example ready right now, but I can give you a pointer about using Qt with Visual Studio:

http://qt-project.org/downloads#qt-other

After you install the Qt Add-In for visual studio, importing a .pro file and source files is straight forward. You use the new file menu that gets added into visual studio, and you have access to it.

Make sure you can do a basic qt program in visual studio before you work on getting the Qwt libraries supported in it.

http://qwt.sourceforge.net/class_qwt_plot_histogram.html

Here is the specific class you will want to use from Qwt.

http://www.qtcentre.org/forums/23-Qwt

Here is where most forum posts about Qwt have ended up.

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top