kamaci
kamaci

Reputation: 75137

How to Display Image of a 2D RGB Matrix at C++

Firstly, I should say that I am not familiar with C++. My purpose is that. There is a function at Matlab imagesc. With a given input of 2d matrix that has double values of RGB it shows a RGB image. I want same at C++ and found that: Imagesc equivalent in C? it says that I can use CImg.

However I couldn't do it at CImg (I couldn't find anything at documentation and google)

My question: How can I show a RGB image with a given 2D matrix at CImg?

PS: Other libraries that CImg is welcome. I just need a simple and basic solution for my purpose.

EDIT 1: I have a Win7 Operating System and I use Visual Studio 2010.

EDIT 2: Solutions with other libraries is welcome.

Upvotes: 0

Views: 2490

Answers (2)

cjuliard
cjuliard

Reputation: 154

Why not using the CImg::display(); method ? It just display your image in an interactive viewer, just as Matlab does with imagesc.

CImg<double> matrix(200,200);  // Assume this is your matrix data.
matrix.display("My Matrix");

Upvotes: 1

stark
stark

Reputation: 13189

One of the methods for constructing a Cimg is from a memory buffer of values, where the value type is templated.

Upvotes: 0

Related Questions