1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Tests and rgbe fix

This commit is contained in:
Fedor Morozov
2013-06-24 05:54:58 +04:00
parent 96dfbf5d24
commit 84ea0c9a97
4 changed files with 111 additions and 3 deletions
+3 -3
View File
@@ -56,8 +56,8 @@
// feel free to modify it to suit your needs.
// Some opencv specific changes have been added:
// inline define specified, channel order changed (to ger bgr by default),
// error handler uses CV_Error.
// inline define specified, error handler uses CV_Error,
// defines changed to work in bgr color space.
//
// posted to http://www.graphics.cornell.edu/~bjw/
// written by Bruce Walter (bjw@graphics.cornell.edu) 5/26/95
@@ -380,7 +380,7 @@ int RGBE_ReadPixels_RLE(FILE *fp, float *data, int scanline_width,
}
if ((rgbe[0] != 2)||(rgbe[1] != 2)||(rgbe[2] & 0x80)) {
/* this file is not run length encoded */
rgbe2float(&data[0],&data[1],&data[2],rgbe);
rgbe2float(&data[RGBE_DATA_RED],&data[RGBE_DATA_GREEN],&data[RGBE_DATA_BLUE],rgbe);
data += RGBE_DATA_SIZE;
free(scanline_buffer);
return RGBE_ReadPixels(fp,data,scanline_width*num_scanlines-1);
+25
View File
@@ -406,3 +406,28 @@ TEST(Highgui_WebP, encode_decode_lossy_webp)
}
#endif
TEST(Highgui_hdr, regression)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "../cv/hdr/";
string name_rle = folder + "grand_canal_rle.hdr";
string name_no_rle = folder + "grand_canal_no_rle.hdr";
Mat img_rle = imread(name_rle, -1);
ASSERT_FALSE(img_rle.empty()) << "Could not open " << name_rle;
Mat img_no_rle = imread(name_no_rle, -1);
ASSERT_FALSE(img_no_rle.empty()) << "Could not open " << name_no_rle;
double min = 0.0, max = 1.0;
minMaxLoc(abs(img_rle - img_no_rle), &min, &max);
ASSERT_FALSE(max > 0);
string tmp_file_name = tempfile(".hdr");
vector<int>param(1);
for(int i = 0; i < 2; i++) {
param[0] = i;
imwrite(tmp_file_name, img_rle, param);
Mat written_img = imread(tmp_file_name, -1);
ASSERT_FALSE(written_img.empty()) << "Could not open " << tmp_file_name;
minMaxLoc(abs(img_rle - written_img), &min, &max);
ASSERT_FALSE(max > 0);
}
}