Ask Your Question

xczhang1024's profile - activity

2018-06-05 05:14:25 -0500 received badge  Popular Question (source)
2017-08-30 04:44:14 -0500 asked a question Otsu thresholding with mask

Otsu thresholding with mask Hi, It appears that Otsu threshold type in cv::threshold is taking the whole image into acco

2016-09-27 06:43:46 -0500 commented answer imwrite with unicode path Windows

I worked out a way around it using imencode to send the image to a vector of uchar and wrote that to file using ostream in my unicode compiled project.

I should have known really because I used imdecode to do the opposite for imread :)

2016-09-27 04:03:51 -0500 commented answer imwrite with unicode path Windows

How do I know which code page I need? And does this have anything to do with the current language of my Windows install?

2016-09-27 03:51:14 -0500 commented answer imwrite with unicode path Windows

When I use WideCharToMultiByte, it does not retain the correct string and on passing it to imwrite, it writes the file with the incorrectly converted string. The resulting string has strange symbols

Here is the code I am trying to use. ws is a std::wstring, and strTo does not get the correct value.

int size = WideCharToMultiByte( CP_UTF8, 0, &ws[0], (int)ws.size(), NULL, 0, NULL, NULL );
std::string strTo( size, 0 );
WideCharToMultiByte( CP_UTF8, 0, &ws[0], (int)ws.size(), &strTo[0], size, NULL, NULL );
2016-09-26 10:11:29 -0500 asked a question imwrite with unicode path Windows


Is there any way in Windows MFC to give a non-ascii file name to imwrite?

cv::String appears to be internally represented by char*and Unicode in Windows is UTF-16. Is there a way to convert an UTF-16 string to UTF-8 and put it in a char array? I thought chars in Windows only represents the ascii set?

I'm not the best at encoding so I'm wondering if anyone else has solved this