diff --git a/README.md b/README.md
index 0aaf158077..6ea1b29113 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# JKQtPlotter
-This is an extensive library of function/data plotter classes for Qt (>= 4.7, tested with Qt up to 5.4).
+This is an extensive library of function/data plotter classes for Qt (>= 4.7, tested with Qt up to 5.11).
This software is licensed under the term of the GNU Lesser General Public License 2.1
(LGPL 2.1) or above.
@@ -17,17 +17,18 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
-| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest1_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest) | [Very Basic Example (Line Graph)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest) | C-style arrays of data |
-| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_symbols_and_errors) | C-style arrays of data |
-| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_barchart_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_barchart) | [Simple Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_barchart) | C-style arrays of data |
-| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarVerticalGraphStacked_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_stackedbars) | [Stacked Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_stackedbars) | C++-style vectors of data |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest1_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest) | [Very Basic Example (Line Graph)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest) | `JKQTPxyLineGraph`
C-style arrays of data |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_symbols_and_errors) | `JKQTPxyLineErrorGraph`
C-style arrays of data |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_barchart_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_barchart) | [Simple Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_barchart) | `JKQTPbarVerticalGraph`
C-style arrays of data |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarVerticalGraphStacked_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_stackedbars) | [Stacked Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_stackedbars) | `JKQTPbarVerticalStackableGraph`, `JKQTPbarHorizontalStackableGraph`
C++-style vectors of data |
### Image data Plots
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
-| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_imageplot) | [1-channel Raw C Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_imageplot) | image data copied from C-style row-major array into a single column of the internal datastore |
-| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_imageplot_opencv) | [1-channel OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_imageplot_opencv) | image data copied from OpenCV cv::Mat-structure into a single column of the internal datastore |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_imageplot) | [1-channel Raw C Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_imageplot) | `JKQTPColumnMathImage`
image data copied from C-style row-major array into a single column of the internal datastore |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_imageplot_opencv) | [1-channel OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_imageplot_opencv) | `JKQTPColumnMathImage`
image data copied from OpenCV cv::Mat-structure into a single column of the internal datastore |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_rgbimageplot_opencv) | [RGB OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_rgbimageplot_opencv) | `JKQTPColumnRGBMathImage`
image data copied from OpenCV cv::Mat-structure into three columns of the internal datastore |
### Tools and Special Features
diff --git a/lib/jkqtplotter/jkqtpdatastorage.h b/lib/jkqtplotter/jkqtpdatastorage.h
index e880fa8285..db5e698cda 100644
--- a/lib/jkqtplotter/jkqtpdatastorage.h
+++ b/lib/jkqtplotter/jkqtpdatastorage.h
@@ -274,6 +274,8 @@ class LIB_EXPORT JKQTPdatastore{
* \param name name for the column
* \param channel to copy from \a mat
* \return the ID of the newly created column
+ *
+ * \note You need to define the Macro JKQTPLOTTER_OPENCV_INTERFACE when compiling this lib to enabled this function.
*/
size_t copyCvMatToColumn(const cv::Mat& mat, const QString& name=QString(""), int channel=0);
#endif
diff --git a/lib/jkqtplotter/jkqtpimageelements.h b/lib/jkqtplotter/jkqtpimageelements.h
index cd7650c9f1..9a4faa4f35 100644
--- a/lib/jkqtplotter/jkqtpimageelements.h
+++ b/lib/jkqtplotter/jkqtpimageelements.h
@@ -508,13 +508,22 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
JKQTPGET_SET_MACRO(int, colorBarOffset)
JKQTPGET_SET_MACRO(double, colorBarRelativeHeight)
JKQTPGET_SET_MACRO(double, imageMin)
+ inline void set_imageMinR(double m) {
+ set_imageMin(m);
+ }
JKQTPGET_SET_MACRO(double, imageMax)
+ inline void set_imageMaxR(double m) {
+ set_imageMax(m);
+ }
JKQTPGET_SET_MACRO(double, imageMinG)
JKQTPGET_SET_MACRO(double, imageMaxG)
JKQTPGET_SET_MACRO(double, imageMinB)
JKQTPGET_SET_MACRO(double, imageMaxB)
JKQTPGET_SET_MACRO(bool, autoImageRange)
JKQTPGET_SET_MACRO(QString, imageName)
+ inline void set_imageNameR(const QString& m) {
+ set_imageName(m);
+ }
JKQTPGET_SET_MACRO(QString, imageNameG)
JKQTPGET_SET_MACRO(QString, imageNameB)
JKQTPGET_SET_MACRO(QString, imageNameFontName)
diff --git a/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv.png b/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv.png
new file mode 100644
index 0000000000..25c8ae2879
Binary files /dev/null and b/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv.png differ
diff --git a/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv_small.png b/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv_small.png
new file mode 100644
index 0000000000..3822e9679d
Binary files /dev/null and b/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv_small.png differ
diff --git a/test/jkqtplotter_simpletest_imageplot_opencv/README.md b/test/jkqtplotter_simpletest_imageplot_opencv/README.md
index fec6352f66..d5b81342f9 100644
--- a/test/jkqtplotter_simpletest_imageplot_opencv/README.md
+++ b/test/jkqtplotter_simpletest_imageplot_opencv/README.md
@@ -3,9 +3,12 @@
# JKQtPlotter
## Simple math image plot, showin a 1-channel OpenCV cv::Mat
-This project (see `./test/jkqtplotter_simpletest_imageplot_opencv/`) simply creates a JKQtPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is stored as a simple C-array in row-major ordering and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore). This very simple interface can also be used to interface with many common image processing libraries, like CImg or OpenCV.
+This project (see `./test/jkqtplotter_simpletest_imageplot_opencv/`) simply creates a JKQtPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is generated as an OpenCV cv::Mat image and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore).
+To copy the data a special OpenCV Interface function `JKQTPdatastore::copyCvMatToColumn()` is used, that copies the data from a cv::Mat directly into a column.
-The soruce code of the main application is (see `./test/jkqtplotter_simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp`):
+The function `JKQTPdatastore::copyCvMatToColumn()` is only available, when the preprocessore macro `JKQTPLOTTER_OPENCV_INTERFACE` is defined when compiling the JKQtPlotter library.
+
+The source code of the main application is (see `./test/jkqtplotter_simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp`):
```c++
#include
#include
diff --git a/test/jkqtplotter_simpletest_rgbimageplot_opencv/.gitignore b/test/jkqtplotter_simpletest_rgbimageplot_opencv/.gitignore
new file mode 100644
index 0000000000..0082aa1a30
--- /dev/null
+++ b/test/jkqtplotter_simpletest_rgbimageplot_opencv/.gitignore
@@ -0,0 +1 @@
+/OpenCV-3.4.1
diff --git a/test/jkqtplotter_simpletest_rgbimageplot_opencv/README.md b/test/jkqtplotter_simpletest_rgbimageplot_opencv/README.md
new file mode 100644
index 0000000000..9ad6298a09
--- /dev/null
+++ b/test/jkqtplotter_simpletest_rgbimageplot_opencv/README.md
@@ -0,0 +1,103 @@
+[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)
+
+# JKQtPlotter
+
+## Simple math image plot, showin a 1-channel OpenCV cv::Mat
+This project (see `./test/jkqtplotter_simpletest_imageplot_opencv/`) simply creates a JKQtPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is generated as an OpenCV cv::Mat image and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore).
+To copy the data a special OpenCV Interface function `JKQTPdatastore::copyCvMatToColumn()` is used, that copies the data from a cv::Mat directly into a column.
+
+The function `JKQTPdatastore::copyCvMatToColumn()` is only available, when the preprocessore macro `JKQTPLOTTER_OPENCV_INTERFACE` is defined when compiling the JKQtPlotter library.
+
+The source code of the main application is (see `./test/jkqtplotter_simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp`):
+```c++
+#include
+#include
+#include "jkqtplotter/jkqtplotter.h"
+#include "jkqtplotter/jkqtpimageelements.h"
+#include
+#include
+
+
+
+int main(int argc, char* argv[])
+{
+ QApplication app(argc, argv);
+
+ JKQtPlotter plot;
+
+
+ // 1. create a plotter window and get a pointer to the internal datastore (for convenience)
+ plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
+ plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
+ plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
+ JKQTPdatastore* ds=plot.getDatastore();
+
+
+ // 2. now we open a BMP-file and load it into an OpenCV cv::Mat
+ cv::Mat picture = cv::imread("example.bmp");
+
+
+
+ // 3. make data available to JKQtPlotter by adding it to the internal datastore.
+ // In this step the contents of each channel of the openCV cv::Mat is copied into a column
+ // of the datastore in row-major order
+ size_t cPictureR=ds->copyCvMatToColumn(picture, "R-channel", 2);
+ size_t cPictureG=ds->copyCvMatToColumn(picture, "G-channel", 1);
+ size_t cPictureB=ds->copyCvMatToColumn(picture, "B-channel", 0);
+
+
+ // 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data
+ JKQTPColumnRGBMathImage* graph=new JKQTPColumnRGBMathImage(&plot);
+ graph->set_title("");
+ // set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
+ graph->set_Nx(picture.cols);
+ graph->set_Ny(picture.rows);
+ // where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
+ graph->set_x(0);
+ graph->set_y(0);
+ // width and height of the image in plot-axis-coordinates
+ graph->set_width(picture.cols);
+ graph->set_height(picture.rows);
+ // image column with the data
+ graph->set_imageRColumn(cPictureR);
+ graph->set_imageGColumn(cPictureG);
+ graph->set_imageBColumn(cPictureB);
+ // determine min/max of each channel manually
+ graph->set_imageMinR(0);
+ graph->set_imageMaxR(255);
+ graph->set_imageMinG(0);
+ graph->set_imageMaxG(255);
+ graph->set_imageMinB(0);
+ graph->set_imageMaxB(255);
+
+
+
+ // 5. add the graphs to the plot, so it is actually displayed
+ plot.addGraph(graph);
+
+ // 6. set axis labels
+ plot.get_xAxis()->set_axisLabel("x [pixels]");
+ plot.get_yAxis()->set_axisLabel("y [pixels]");
+
+ // 7. fix axis aspect ratio to width/height, so pixels are square
+ plot.get_plotter()->set_maintainAspectRatio(true);
+ plot.get_plotter()->set_aspectRatio(double(picture.cols)/double(picture.rows));
+
+ // 8. autoscale the plot so the graph is contained
+ plot.zoomToFit();
+
+ // show plotter and make it a decent size
+ plot.show();
+ plot.resize(800,600);
+ plot.setWindowTitle("JKQTPColumnMathImage");
+
+
+ return app.exec();
+}
+
+```
+The result looks like this:
+
+![jkqtplotter_simpletest_imageplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv.png)
+
+[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)
\ No newline at end of file
diff --git a/test/jkqtplotter_simpletest_rgbimageplot_opencv/example.bmp b/test/jkqtplotter_simpletest_rgbimageplot_opencv/example.bmp
new file mode 100644
index 0000000000..b4535acc52
Binary files /dev/null and b/test/jkqtplotter_simpletest_rgbimageplot_opencv/example.bmp differ
diff --git a/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp b/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp
new file mode 100644
index 0000000000..6ff3012fae
--- /dev/null
+++ b/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp
@@ -0,0 +1,84 @@
+#include
+#include
+#include "jkqtplotter/jkqtplotter.h"
+#include "jkqtplotter/jkqtpimageelements.h"
+#include
+#include
+
+
+
+int main(int argc, char* argv[])
+{
+ QApplication app(argc, argv);
+
+ JKQtPlotter plot;
+
+
+ // 1. create a plotter window and get a pointer to the internal datastore (for convenience)
+ plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
+ plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
+ plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
+ JKQTPdatastore* ds=plot.getDatastore();
+
+
+ // 2. now we open a BMP-file and load it into an OpenCV cv::Mat
+ cv::Mat picture = cv::imread("example.bmp");
+
+
+
+ // 3. make data available to JKQtPlotter by adding it to the internal datastore.
+ // In this step the contents of each channel of the openCV cv::Mat is copied into a column
+ // of the datastore in row-major order
+ size_t cPictureR=ds->copyCvMatToColumn(picture, "R-channel", 2);
+ size_t cPictureG=ds->copyCvMatToColumn(picture, "G-channel", 1);
+ size_t cPictureB=ds->copyCvMatToColumn(picture, "B-channel", 0);
+
+
+ // 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data
+ JKQTPColumnRGBMathImage* graph=new JKQTPColumnRGBMathImage(&plot);
+ graph->set_title("");
+ // set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
+ graph->set_Nx(picture.cols);
+ graph->set_Ny(picture.rows);
+ // where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
+ graph->set_x(0);
+ graph->set_y(0);
+ // width and height of the image in plot-axis-coordinates
+ graph->set_width(picture.cols);
+ graph->set_height(picture.rows);
+ // image column with the data
+ graph->set_imageRColumn(cPictureR);
+ graph->set_imageGColumn(cPictureG);
+ graph->set_imageBColumn(cPictureB);
+ // determine min/max of each channel manually
+ graph->set_imageMinR(0);
+ graph->set_imageMaxR(255);
+ graph->set_imageMinG(0);
+ graph->set_imageMaxG(255);
+ graph->set_imageMinB(0);
+ graph->set_imageMaxB(255);
+
+
+
+ // 5. add the graphs to the plot, so it is actually displayed
+ plot.addGraph(graph);
+
+ // 6. set axis labels
+ plot.get_xAxis()->set_axisLabel("x [pixels]");
+ plot.get_yAxis()->set_axisLabel("y [pixels]");
+
+ // 7. fix axis aspect ratio to width/height, so pixels are square
+ plot.get_plotter()->set_maintainAspectRatio(true);
+ plot.get_plotter()->set_aspectRatio(double(picture.cols)/double(picture.rows));
+
+ // 8. autoscale the plot so the graph is contained
+ plot.zoomToFit();
+
+ // show plotter and make it a decent size
+ plot.show();
+ plot.resize(800,600);
+ plot.setWindowTitle("JKQTPColumnMathImage");
+
+
+ return app.exec();
+}
diff --git a/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.pro b/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.pro
new file mode 100644
index 0000000000..b156e4ffee
--- /dev/null
+++ b/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.pro
@@ -0,0 +1,24 @@
+# source code for this simple demo
+SOURCES = jkqtplotter_simpletest_rgbimageplot_opencv.cpp
+
+# configure Qt
+CONFIG += qt
+QT += core gui svg
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
+
+# output executable name
+TARGET = jkqtplotter_simpletest_rgbimageplot_opencv
+
+# include JKQtPlotter source code
+include(../../lib/jkqtplotter.pri)
+# here you can activate some debug options
+#DEFINES += SHOW_JKQTPLOTTER_DEBUG
+#DEFINES += JKQTBP_AUTOTIMER
+
+
+# link agains OpenCV-3.4.1
+INCLUDEPATH += $$PWD/OpenCV-3.4.1/include/
+LIBS += -L$$PWD/OpenCV-3.4.1/bin/ -llibopencv_core341 -llibopencv_imgcodecs341
+
+# add OpenCV-interface to JKQTPdatastore
+DEFINES += JKQTPLOTTER_OPENCV_INTERFACE