Open Jiwon-Hwang opened 2 years ago
Mat의 요소가 어떤 타입의 데이터인지 지정
CV_8UC1
: 8bit unsigned char (0~255) => imshow 가능CV_8SC1
: 8bit signed char (-128~127) => imshow 가능CV_16UC1
: 16bit unsigned short (0~65535)CV_16SC1
: 16bit signed short (-32768~32767)CV_32SC1
: 32bit signed int (-2147483648~2147483647)cv::normalize(src, dst, 0, 1, NORM_MINMAX, CV_8UC1);
Convert Arr to Mat
Convert Mat to Arr
Convert 16bit(short) to 8bit(unsigned char)
// get min, max double minVal; double maxVal; Point minLoc; Point maxLoc; minMaxLoc(img, &minVal, &maxVal, &minLoc, &maxLoc);
// normalization img_8UC1 -= minVal; img_8UC1.convertTo(img_8UC1, CV_8U, 255.0 / (maxVal - minVal)); // 8bit(uchar)