|
|
|
|
@ -117,7 +117,7 @@ int VideoDev_SVBCam::Open() {
|
|
|
|
|
Close();
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
printf ("%s:%d %s height: %ld width: %ld\n", __FILE__, __LINE__, __FUNCTION__, camprop.MaxHeight, camprop.MaxWidth);
|
|
|
|
|
printf ("%s:%d %s MaxHeight: %ld MaxWidth: %ld\n", __FILE__, __LINE__, __FUNCTION__, camprop.MaxHeight, camprop.MaxWidth);
|
|
|
|
|
|
|
|
|
|
for(int i=0; i < 8 && camprop.SupportedVideoFormat[i] != SVB_IMG_END; i++) {
|
|
|
|
|
printf ("%s:%d %s VideoFormat Index:%d ", __FILE__, __LINE__, __FUNCTION__, i);
|
|
|
|
|
@ -162,7 +162,7 @@ int VideoDev_SVBCam::Open() {
|
|
|
|
|
printf("\t\tSVB_IMG_END\n");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf ("\t\tunbekannt\n");
|
|
|
|
|
printf ("\t\tunknown\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -178,7 +178,7 @@ int VideoDev_SVBCam::Open() {
|
|
|
|
|
print_error(err);
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
printf ("%s:%d %s Got Control idx: %d name:%s desc:%s [%ld - %ld]\n", __FILE__, __LINE__, __FUNCTION__,
|
|
|
|
|
printf ("%s:%d %s Got Control idx:%d name:%s desc:%s [%ld - %ld]\n", __FILE__, __LINE__, __FUNCTION__,
|
|
|
|
|
i, camcontrols[i].Name, camcontrols[i].Description, (long)camcontrols[i].MinValue, (long)camcontrols[i].MaxValue);
|
|
|
|
|
vctl.name = (char*)camcontrols[i].Name;
|
|
|
|
|
vctl.id = i;
|
|
|
|
|
@ -209,26 +209,26 @@ int VideoDev_SVBCam::Open() {
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case (V4L2_PIX_FMT_RGB32):
|
|
|
|
|
case (V4L2_PIX_FMT_BGR32):
|
|
|
|
|
if ((err = SVBSetOutputImageType(camid, SVB_IMG_RGB32)) != SVB_SUCCESS) {
|
|
|
|
|
print_error(err);
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case (V4L2_PIX_FMT_RGB24):
|
|
|
|
|
if ((err = SVBSetOutputImageType(camid, SVB_IMG_RGB24)) != SVB_SUCCESS) {
|
|
|
|
|
print_error(err);
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case (V4L2_PIX_FMT_BGR24):
|
|
|
|
|
if ((err = SVBSetOutputImageType(camid, SVB_IMG_RGB24)) != SVB_SUCCESS) {
|
|
|
|
|
print_error(err);
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
conf_format = convert_from_pixelformat(V4L2_PIX_FMT_RGB24);
|
|
|
|
|
inframe_pixfmt = V4L2_PIX_FMT_RGB24;
|
|
|
|
|
if ((err = SVBSetOutputImageType(camid, SVB_IMG_RGB24)) != SVB_SUCCESS) {
|
|
|
|
|
print_error(err);
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
conf_format = convert_from_pixelformat(V4L2_PIX_FMT_BGR24);
|
|
|
|
|
inframe_pixfmt = V4L2_PIX_FMT_BGR24;
|
|
|
|
|
if ((err = SVBSetOutputImageType(camid, SVB_IMG_RGB24)) != SVB_SUCCESS) {
|
|
|
|
|
print_error(err);
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -264,8 +264,8 @@ int VideoDev_SVBCam::Close() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* prepare inframe for raw picture data, will hold a video frame with 16bit per channel
|
|
|
|
|
* inframe size = 2*3*W*H
|
|
|
|
|
* prepare inframe for raw picture data, will hold a video frame with 16bit per channel or BGR32/BGR24
|
|
|
|
|
* inframe size = 4*W*H
|
|
|
|
|
* send the start capture signal to the cam
|
|
|
|
|
*/
|
|
|
|
|
int VideoDev_SVBCam::CaptureStart() {
|
|
|
|
|
@ -281,7 +281,7 @@ int VideoDev_SVBCam::CaptureStart() {
|
|
|
|
|
//
|
|
|
|
|
// allocate memory for frame data
|
|
|
|
|
if (inframe != NULL) free (inframe);
|
|
|
|
|
inframe_size = 6 * inframe_w * inframe_h;
|
|
|
|
|
inframe_size = 4 * inframe_w * inframe_h;
|
|
|
|
|
inframe = (unsigned char*) malloc(inframe_size);
|
|
|
|
|
|
|
|
|
|
ConvertStart(&cdata, inframe_pixfmt);
|
|
|
|
|
@ -368,14 +368,53 @@ int VideoDev_SVBCam::GetDeviceFormats(string device, std::list<string> *formats)
|
|
|
|
|
Close();
|
|
|
|
|
return VDEV_STATUS_ERROR;
|
|
|
|
|
}
|
|
|
|
|
printf ("%s:%d %s height: %ld width: %ld maxdepth:%d BayerPattern:%d\n", __FILE__, __LINE__, __FUNCTION__, camprop.MaxHeight,
|
|
|
|
|
camprop.MaxWidth, camprop.MaxBitDepth, camprop.BayerPattern);
|
|
|
|
|
printf ("%s:%d %s MaxHeight:%ld MaxWidth:%ld MaxDepth:%d\n", __FILE__, __LINE__, __FUNCTION__, camprop.MaxHeight,
|
|
|
|
|
camprop.MaxWidth, camprop.MaxBitDepth);
|
|
|
|
|
char pattern[5];
|
|
|
|
|
switch(camprop.BayerPattern) {
|
|
|
|
|
case SVB_BAYER_RG:
|
|
|
|
|
strcpy(pattern, "RGGB");
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_BG:
|
|
|
|
|
strcpy(pattern, "BGGR");
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_GR:
|
|
|
|
|
strcpy(pattern, "GRBG");
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_GB:
|
|
|
|
|
strcpy(pattern, "GBRG");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
strcpy(pattern, "NONE");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf ("%s:%d %s BayerPattern:%s Color:%d Binning: \n", __FILE__, __LINE__, __FUNCTION__, pattern, camprop.IsColorCam);
|
|
|
|
|
for(int i=0; i < 16 && camprop.SupportedBins[i] != 0; i++) {
|
|
|
|
|
printf ("%s:%d %s Binning Index:%d ", __FILE__, __LINE__, __FUNCTION__, i);
|
|
|
|
|
printf ("\t\%dx%d\n", camprop.SupportedBins[i], camprop.SupportedBins[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int i=0; i < 8 && camprop.SupportedVideoFormat[i] != SVB_IMG_END; i++) {
|
|
|
|
|
printf ("%s:%d %s VideoFormat Index:%d ", __FILE__, __LINE__, __FUNCTION__, i);
|
|
|
|
|
switch (camprop.SupportedVideoFormat[i]) {
|
|
|
|
|
case SVB_IMG_RAW8:
|
|
|
|
|
printf("\t\tSVB_IMG_RAW8\n");
|
|
|
|
|
switch(camprop.BayerPattern) {
|
|
|
|
|
case SVB_BAYER_RG:
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SRGGB8));
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_BG:
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SBGGR8));
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_GR:
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SGRBG8));
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_GB:
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SGBRG8));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SVB_IMG_RAW10:
|
|
|
|
|
printf("\t\tSVB_IMG_RAW10\n");
|
|
|
|
|
@ -388,7 +427,22 @@ int VideoDev_SVBCam::GetDeviceFormats(string device, std::list<string> *formats)
|
|
|
|
|
break;
|
|
|
|
|
case SVB_IMG_RAW16:
|
|
|
|
|
printf("\t\tSVB_IMG_RAW16\n");
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SGRBG16));
|
|
|
|
|
switch(camprop.BayerPattern) {
|
|
|
|
|
case SVB_BAYER_RG:
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SRGGB16));
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_BG:
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SBGGR16));
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_GR:
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SGRBG16));
|
|
|
|
|
break;
|
|
|
|
|
case SVB_BAYER_GB:
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_SGBRG16));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SVB_IMG_Y8:
|
|
|
|
|
printf("\t\tSVB_IMG_Y8\n");
|
|
|
|
|
@ -407,17 +461,17 @@ int VideoDev_SVBCam::GetDeviceFormats(string device, std::list<string> *formats)
|
|
|
|
|
break;
|
|
|
|
|
case SVB_IMG_RGB24:
|
|
|
|
|
printf("\t\tSVB_IMG_RGB24\n");
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_RGB24));
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_BGR24));
|
|
|
|
|
break;
|
|
|
|
|
case SVB_IMG_RGB32:
|
|
|
|
|
printf("\t\tSVB_IMG_RGB32\n");
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_RGB32));
|
|
|
|
|
formats->push_back(convert_from_pixelformat(V4L2_PIX_FMT_BGR32));
|
|
|
|
|
break;
|
|
|
|
|
case SVB_IMG_END:
|
|
|
|
|
printf("\t\tSVB_IMG_END\n");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf ("\t\tunbekannt\n");
|
|
|
|
|
printf ("\t\tunknown\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|