el siguiente código publicar el mensaje de error:OpenCV - aserción (dst.data == dst0.data) en cvCvtColor
// object is a color image with type cv::Mat
IplImage* temp_object = &(IplImage)object;
IplImage* ipl_object = cvCreateImage(cvGetSize(temp_object), 8, 3);
assert(temp_object->nChannels == 3 && temp_object->depth == IPL_DEPTH_8U);
assert(ipl_object->nChannels == 3 && ipl_object->depth == IPL_DEPTH_8U);
cvCvtColor(ipl_object, temp_object, CV_BGR2GRAY);
error
OpenCV Error: Assertion failed (dst.data == dst0.data) in cvCvtColor, file /opt/local /var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_opencv/opencv/work/OpenCV-2.3.1/modules/imgproc/src/color.cpp, line 3175 terminate called throwing an exception`
código actualizado después de la modificación (debería funcionar ahora). ¡Gracias por la ayuda!
IplImage temp_object (object);
IplImage* ipl_object = cvCreateImage(cvGetSize(&temp_object), 8, 1);
cvCvtColor(&temp_object, ipl_object, CV_BGR2GRAY);
Gracias por la explicación. 'IplImage * temp_object = static_cast (& object);' will give out 'error: static_cast no válido del tipo' cv :: Mat * 'para escribir' IplImage * '' –
LKS
@ user1020390: En ese caso, quizás quiera hacer un nuevo objeto; necesitas darle un nombre para que no sea temporal. Ver mi edición –
Gracias. Creo que debería funcionar ahora. – LKS