Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot Module #186

Merged
merged 19 commits into from
Dec 14, 2015
Merged

Conversation

nmoutinho
Copy link
Contributor

Created a Plot2D Module which allows you to easily plot data from a Mat. You can plot 1D or 2D plots, change the window size, the axis limits and the colors of all the elements.

In C++, you just have to do:

Mat data; 
Mat plot_result;
//-------------------------------//
//     fill your data here
//-------------------------------//
Ptr<plot::Plot2d> plot;
plot = plot::createPlot2d(data);
plot->render(plot_result);
//-------------------------------//
//         show the plot
//-------------------------------//
imshow("plot",plot_result );

and that's it.

These are two examples of functions being plotted:
sin(x)
sin_x

x^2
x_2

@nmoutinho
Copy link
Contributor Author

Hi @vpisarev, this is my new module now in opencv_contrib. Hope it will be added to the repository.

@@ -0,0 +1,6 @@
Plot - Module to Plot Data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the docs are now in Doxygen/Markdown format

@nmoutinho
Copy link
Contributor Author

Hi @vpisarev, thanks for your input. I already made some of the changes you suggested. The biggest one is still missing though, to make the class follow the abstract interface - hidden implementation concept.

@nmoutinho
Copy link
Contributor Author

@vpisarev, I am now uploading a new version where the class follows the concept you proposed. Hope it fills the requirements.

@nmoutinho
Copy link
Contributor Author

@vpisarev, the new version of the module is already uploaded. Thanks.

@nmoutinho
Copy link
Contributor Author

Hi @ilya-lavrenov, I am still waiting for a feedback for this new module, to know if there is something I need to change before it can be merged to the opencv_contrib repository. Thanks.

@nmoutinho
Copy link
Contributor Author

@vpisarev I've already done the changes you suggested. Thanks!

#ifdef __cplusplus

#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you may retain ony opencv2/core.hpp include in the header and move other include's to precomp.hpp. It will improve build speed

@nmoutinho
Copy link
Contributor Author

@vpisarev changes committed.

@nmoutinho
Copy link
Contributor Author

@vpisarev is that anything else I have to do?

@nmoutinho
Copy link
Contributor Author

@vpisarev are you considering to add this module to the repository or is there something I have to change? Thank you for your attention.

Plot2dImpl(Mat _plotData)
{
//if the matrix is not Nx1 or 1xN
if(_plotData.cols > 1 && _plotData.rows > 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a CV_Assert. (as well as the ifs below)

@StevenPuttemans
Copy link

@nmoutinho might be interesting for you: opencv/opencv#5386
If we combine both things, the plotting properties can become even better in OpenCV!

@StevenPuttemans
Copy link

@nmoutinho is it possible to have a look at the failed checks? This would enable us to fix everything and continue adding this. There is a new user base interested in this http://answers.opencv.org/question/73233/how-do-you-plot-graphs-in-opencv-projects/?comment=73401#comment-73401

@nmoutinho
Copy link
Contributor Author

Hi @StevenPuttemans, it is so cool that someone is interested in my Plot! I was waiting for your response since May (long time has passed...). I am a little busy now with my PhD thesis but as soon as I have time I will do all the changes required and hopefully we will get the Plot function in OpenCv. Thanks!

@StevenPuttemans
Copy link

That is great! Good luck with your PhD thesis, and hoping to hear soon from you!

@vpisarev vpisarev self-assigned this Dec 14, 2015
@vpisarev
Copy link
Contributor

@nmoutinho, sorry for a huge delay! let's finally put it in 👍

@opencv-pushbot opencv-pushbot merged commit 9bb44c6 into opencv:master Dec 14, 2015
@StevenPuttemans
Copy link

@vpisarev w00t w00t, I have the impressions you guys are doing a huge job at finally merging everything?

@nmoutinho
Copy link
Contributor Author

Thanks a lot @vpisarev ;) I really hope people like it. It still has a lot to improve but it's a good start.

@anupamsobti
Copy link

Is there a Python API available as well?

@StevenPuttemans
Copy link

StevenPuttemans commented Jun 12, 2018

Is there a Python API available as well?

Since there is not a single CV_WRAP inside the C++ code, I am afraid not. You could have a look at other modules and contribute the wrapping as a pull request?

@anupamsobti
Copy link

I'm currently a little occupied. I'll try and get back to this sometime next month.

allnes pushed a commit to allnes/opencv_contrib that referenced this pull request Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants