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

Cannot navigate #28

Open
minglok943 opened this issue Mar 5, 2022 · 3 comments
Open

Cannot navigate #28

minglok943 opened this issue Mar 5, 2022 · 3 comments

Comments

@minglok943
Copy link

I use the header only integration method. Adding -I./inc in Makefile to compile CvPlot library. But I cannot navigate on any windows of plot. Could you help?

@wpalfi
Copy link
Collaborator

wpalfi commented Mar 5, 2022

Are you using cv::imshow() maybe? Mouse navigation requires CvPlot::show(). If that does not help, please give a minimal complete example.

@minglok943
Copy link
Author

~/Desktop/OpencvC++/myPlot$ tree
.
├── inc
│   └── CvPlot
│       ├── core
│       │   ├── Axes.h
│       │   ├── DrawableDeque.h
│       │   ├── Drawable.h
│       │   ├── makeAxes.h
│       │   ├── Projection.h
│       │   ├── RenderTarget.h
│       │   └── Transformation.h
│       ├── core.h
│       ├── cvplot.h
│       ├── drawables
│       │   ├── Border.h
│       │   ├── Group.h
│       │   ├── HorizontalGrid.h
│       │   ├── HorizontalLine.h
│       │   ├── Image.h
│       │   ├── LineBase.h
│       │   ├── LineType.h
│       │   ├── MarkerType.h
│       │   ├── Series.h
│       │   ├── Title.h
│       │   ├── VerticalGrid.h
│       │   ├── VerticalLine.h
│       │   ├── XAxis.h
│       │   ├── XLabel.h
│       │   ├── YAxis.h
│       │   └── YLabel.h
│       ├── gui
│       │   ├── MouseAdapter.h
│       │   ├── MouseEvent.h
│       │   ├── show.h
│       │   └── Window.h
│       ├── gui.h
│       ├── imp
│       │   ├── Axes.ipp
│       │   ├── Border.ipp
│       │   ├── cvplot.ipp
│       │   ├── DrawableDeque.ipp
│       │   ├── Drawable.ipp
│       │   ├── Group.ipp
│       │   ├── HorizontalGrid.ipp
│       │   ├── HorizontalLine.ipp
│       │   ├── Image.ipp
│       │   ├── LineBase.ipp
│       │   ├── makeAxes.ipp
│       │   ├── MouseAdapter.ipp
│       │   ├── Series.ipp
│       │   ├── Title.ipp
│       │   ├── util.ipp
│       │   ├── version.ipp
│       │   ├── VerticalGrid.ipp
│       │   ├── VerticalLine.ipp
│       │   ├── XAxis.ipp
│       │   ├── XLabel.ipp
│       │   ├── YAxis.ipp
│       │   └── YLabel.ipp
│       ├── Internal
│       │   ├── LinearProjection.h
│       │   ├── no_warning.h
│       │   ├── Pimpl.h
│       │   ├── RawProjection.h
│       │   └── util.h
│       ├── libdef.h
│       └── version.h
├── main.cpp
├── Makefile
└── tune

This is my directory

#define CVPLOT_HEADER_ONLY
#include "CvPlot/cvplot.h"


using namespace cv;
using namespace std;

int main(int argc, char **argv)
{
	auto axes = CvPlot::plot(std::vector<double>{ 3, 3, 4, 6, 4, 3 }, "-o");
	cv::Mat mat = axes.render(300, 400);
	CvPlot::show("mywindow", axes);

	return 0;
}

This is my code

CC = "g++"
PROJECT = tune
SRC = main.cpp

LIBS = `pkg-config opencv4 --cflags --libs`

$(PROJECT) : $(SRC)
	$(CC) $(SRC) $(LIBS) -I./inc -o $(PROJECT) 

This is my Makefile

@wpalfi
Copy link
Collaborator

wpalfi commented Mar 11, 2022

I tried your example and it works fine on Ubuntu (WSL2) with mouse navigation. Maybe you want to set a breakpoint here

cv::setMouseCallback(_windowName, [](int event, int x, int y, int flags, void* userdata) {

and/or here
Window& window = *static_cast<Window*>(userdata);

to see what's going wrong?

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

No branches or pull requests

2 participants