pantonante
3/30/2018 - 5:08 PM

OpenCV image type

void printImageType(int type) {
  // find type
  int imgTypeInt = type % 8;
  int channel = (type / 8) + 1;

  switch (imgTypeInt) {
    case 0:
      std::cout << "CV_8UC" << channel << std::endl;
      break;
    case 1:
      std::cout << "CV_8SC" << channel << std::endl;
      break;
    case 2:
      std::cout << "CV_16UC" << channel << std::endl;
      break;
    case 3:
      std::cout << "CV_16SC" << channel << std::endl;
      break;
    case 4:
      std::cout << "CV_32SC" << channel << std::endl;
      break;
    case 5:
      std::cout << "CV_32FC" << channel << std::endl;
      break;
    case 6:
      std::cout << "CV_64FC" << channel << std::endl;
      break;
    default:
      break;
  }
}