Milan Domazet
Milan Domazet

Reputation: 113

Matlab imagesc clims to OpenCV

I am rewriting an application from matlab to C++. The problem is with this line

imagesc(proj_data.log_P0,m+s*[-3,3])

proj_data.log_P0 is some matrix with float values, so what I did in C++ and OpenCV is normalizing that matrix to values that OpenCV can show (range from 0 to 1). That part is working but the part that is making the problem is the clims (bolded) part imagesc(proj_data.log_P0,m+s*[-3,3]). As I understood the clims part is changing the range of colormap, is there any way to do this in OpenCV? It is a grayscale image.

Upvotes: 1

Views: 494

Answers (1)

Milan Domazet
Milan Domazet

Reputation: 113

I found the solution. Before doing the normalization I just found all the matrix elements larger than m+s*3 and changed them to m+s*3, and all the elements smaller than m+s*-3 and changed them to m+s*-3. After doing this with the matrix elements I did the normalization to range from 0 to 1. Same result like in MATLAB's imagesc with clims.

Upvotes: 1

Related Questions