Giter Club home page Giter Club logo

gencolormap's Introduction

gencolormap

These tools generate color maps for visualization. A variety of methods for sequential, diverging, and qualitative maps is available.

The color map generation is contained in just two C++ files (colormap.hpp and colormap.cpp) and requires no additional libraries. You can simply copy these two files to your own project.

Two frontends are included: a GUI for interactive use and a command line tool for scripting. The command line tool requires no libraries, the GUI requires Qt.

The following papers are implemented:

GUI screen shot

gencolormap's People

Contributors

marlam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gencolormap's Issues

GUI compilation problem

Hi

I have compiled command line tool ,

cmake .
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Warning (dev) in CMakeLists.txt:
  AUTOGEN: No valid Qt version found for target gencolormap.  AUTOMOC
  disabled.  Consider adding:

    find_package(Qt<QTVERSION> COMPONENTS Core)

  to your CMakeLists.txt file.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /home/a/gencolormap-mirror
a@zalman:~/gencolormap-mirror$ make
[ 25%] Building CXX object CMakeFiles/gencolormap.dir/cmdline.cpp.o
[ 50%] Building CXX object CMakeFiles/gencolormap.dir/colormap.cpp.o
[ 75%] Building CXX object CMakeFiles/gencolormap.dir/export.cpp.o
[100%] Linking CXX executable gencolormap
[100%] Built target gencolormap

but gui have an errror

make all
g++ -c -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o colormapwidgets.o colormapwidgets.cpp
In file included from colormapwidgets.cpp:25:
gui.hpp:28:10: fatal error: QMainWindow: No such file or directory
   28 | #include <QMainWindow>
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:415: colormapwidgets.o] Error 1

Any tips ?
I'm on Ubuntu 22.043

qmake --version
QMake version 3.1
Using Qt version 5.15.3 in /usr/lib/x86_64-linux-gnu

test image

Hi

I try to add test image by Peter Kovesi


/* Apply color map to test image. See http://peterkovesi.com/projects/colourmaps/colourmaptestimage.html */

std::string ToPPM_Test(int n, const unsigned char* srgb_colormap)
{

	static const float twopi = 2.0 * M_PI;
	int jMax = 128; // height
	int iMax = 512; // width
	int colormap_size = jMax * iMax;
	
	std::string s = "P3\n"; // magic number for plain (ASCII txt) PPM
	s += std::to_string(n) + "  " + std::to_string(jMax) + "\n"; // save n=width and jMax=height to s string
	s += "255\n"; // max val
	for (int j = 0; j < jMax; j++){ // y , jMax = height
		float v = 1.0f - (j / (jMax - 1.0f));
		for (int i = 0; i < iMax; i++) // x , so here n = width. outside n = number of colors in the map
    	
		{ 
		float u = i / (iMax - 1.0f);
		// Test image formula
		float ramp = u;
		float modulation = 0.05f * std::sin(iMax / 8 * twopi * u);
		float value = ramp + v * v * modulation;
		// Applying colormap
		int k = std::round(value * (colormap_size / 3 - 1));
		if (k < 0)
			{k = 0;}
			else if (k >= colormap_size / 3) k = colormap_size / 3 - 1;
		
		
		// add RGB string to s string
		s +=  std::to_string(srgb_colormap[3 * k + 0]) + ' '
		+     std::to_string(srgb_colormap[3 * k + 1]) + ' '
		+     std::to_string(srgb_colormap[3 * k + 2]) + '\n';
		}}
    return s;
}

It gives Segmentation fault

What should I change ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.