TiffEncoder write support more depth type#21428
Conversation
|
Could you please add corresponding tests: https://github.com/opencv/opencv/blob/4.x/modules/imgcodecs/test/test_tiff.cpp ? |
|
I don't know how to create a geotiff file, so I don't have a short type tif file(TIFFTAG_SAMPLEFORMAT is : SAMPLEFORMAT_INT), my testting file is download from https://download.osgeo.org/geotiff/samples/usgs/, file name is "i30dem.tif",. |
|
Maybe the test could just do |
|
I am updated testing code, and pull gray_8u.tif to opencv_extra repo. |
modules/imgcodecs/test/test_tiff.cpp
Outdated
| TEST(Imgcodecs_Tiff, readWrite_unsigned) | ||
| { | ||
| const string root = cvtest::TS::ptr()->get_data_path(); | ||
| const string filenameInput = root + "readwrite/gray_8u.tiff"; |
There was a problem hiding this comment.
gray_8u.tiff
vs
gray_8u.tif
Please run tests locally before submitting.
There was a problem hiding this comment.
How to run tests locally? are there any document I can study? Thank you very much!
There was a problem hiding this comment.
8.Run testsuite locally:
1.get the required sample data by cloning https://github.com/opencv/opencv_extra (choose corresponding branch).
2.export OPENCV_TEST_DATA_PATH=<path_to_opencv_extra>/testdata.
3.execute each test binary from the build directory, e.g. ./bin/opencv_test_core.
got it!I will run it next time.
modules/imgcodecs/test/test_tiff.cpp
Outdated
|
|
||
| Mat matS8; | ||
| img.copyTo(matS8); | ||
| matS8.flags |= CV_8SC1; //hard code set type as CV_8SC1 for testing. |
There was a problem hiding this comment.
Use convertTo() instead of hijacking of internal flags.
| { | ||
| case CV_8U: | ||
| sample_format = SAMPLEFORMAT_UINT; | ||
| case CV_8S: |
There was a problem hiding this comment.
add line with /* FALLTHRU */ comment before non-break "case".
Here and below.
Details:
alalek
left a comment
There was a problem hiding this comment.
Well done! Thank you for contribution 👍
TiffEncoder write support more depth type * TiffEncoder write support more depth type * testing code * update testing code * add fallthrough
Merge with extra: opencv/opencv_extra#955
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.