开发者

OpenCV: create image from floating point data

开发者 https://www.devze.com 2023-03-18 11:08 出处:网络
I have a floating point data [size: 4000 X 140 ]. I want to convert it to an IplImage in OpenCV. To have an idea about data, I am giving first 8 X 8 entries of that data.These data are very close to z

I have a floating point data [size: 4000 X 140 ]. I want to convert it to an IplImage in OpenCV. To have an idea about data, I am giving first 8 X 8 entries of that data.These data are very close to zero. So, I am getting a dark image.

-1.14E-04   -4.71E-04   -1.27E-04    2.43E-04   4.58E-04     1.63E-04    2.56E-04    2.86E-04
 1.12E-04   -2.80E-04    2.89E-05   -2.18E-04   4.08E-05    -2.23E-04   -7.96E-05   -3.97E-05
-3.98E-04   -2.35E-04    6.11E-04    4.53E-05   4.74E-05     8.02E-05    2.10E-04    1.10E-04
 2.08E-04    3.09E-04   -1.34E-开发者_如何学JAVA04   -2.58E-04   -2.25E-04   -1.74E-04    2.28E-04    2.65E-04
-6.65E-04   -2.94E-04    6.37E-04   -5.16E-05    9.90E-05    1.05E-04   -2.20E-04   -5.49E-05
 1.85E-04    5.69E-04   -5.19E-04   -4.98E-05    2.07E-04   -2.00E-05    1.24E-04    1.49E-04
 1.54E-04   -4.09E-04    4.29E-04   -7.67E-04    5.19E-04    3.56E-04   -4.82E-04    3.66E-04
-1.71E-04   -5.15E-04    5.71E-04   -5.68E-04   -2.75E-04   -6.17E-05    1.40E-04    2.19E-04

1) when I am multiplying these entries with a factor like 10E4 or 10E5, I can see an image. But image quality is very poor unlike matlab-generated image. [ MATLAB code corresponding image:

[path,file] = uigetfile;
data = load(strcat(file,path));
figure;
imagesc(data); 
colormap(gray);

]

[ OpenCV code sequence: I created CvMat and filled it with those data. I prepared IplImage from that CvMat. I resized the image( 560 X 420 ) ]

2) There are many negative data. Should those be consider zero? or Should all the data be added with a number(like 10E-4) to make all entries positive? or should I proceed through someother ways?

3) I changed contrast , brightness. But those seem to be useless.


Try mapping the minimum value to 0.0 and the maximum to 1.0.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号