Ask Your Question

Revision history [back]

C++ How can I down bit level with using 'resize'?? or is there Dithering function exist?

Hi. I wanna resize image without changing DPI and bit level. So I use this code.

[

vector<int> params2; params2.push_back(IMWRITE_TIFF_XDPI); params2.push_back(XDPI); // XDPI is same with original's params2.push_back(IMWRITE_TIFF_YDPI); params2.push_back(YDPI); // YDPI is same with original's

resize(ori_image, resized_image, Size(ori_image.cols , ori_image.rows));

imwrite("resized_test_image.tif", resized_image, params2);

]

I solved DPI problem with 'IMWRITE_TIFF_XDPI' But I dont know how to fix bit level. There is 'IMWRITE_PNG_BILEVEL ' in 'ImwriteFlags' for Binary level PNG, 0 or 1, default is 0. But it cannot use for tiff image. Original image's bit level is 1 but resized image's bit level is 8. How can I fix bit level?? Or use other codes like dithering?

C++ How can I down bit level with using 'resize'?? or is there Dithering function exist?

Hi. I wanna resize image without changing DPI and bit level. So I use this code.

[

[
  

vector<int> params2; params2.push_back(IMWRITE_TIFF_XDPI); params2.push_back(XDPI); // XDPI is same with original's params2.push_back(IMWRITE_TIFF_YDPI); params2.push_back(YDPI); // YDPI is same with original's

original's

resize(ori_image, resized_image, Size(ori_image.cols , ori_image.rows));

ori_image.rows));

imwrite("resized_test_image.tif", resized_image, params2);

params2);

]

]

I solved DPI problem with 'IMWRITE_TIFF_XDPI' IMWRITE'_TIFF_XDPI But I dont know how to fix bit level. There is 'IMWRITE_PNG_BILEVEL ' IMWRITE_PNG_BILEVEL in 'ImwriteFlags' ImwriteFlags for Binary level PNG, 0 or 1, default is 0. But it cannot use for tiff image. Original image's bit level is 1 but resized image's bit level is 8. How can I fix bit level?? Or use other codes like dithering?