Anomalie #43

pb ppmFileWrite

Added by Serge Koudoro almost 9 years ago. Updated almost 9 years ago.

Status:NouveauStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:old plone Bugs
Target version:-

Description

Description:
----------------------------------------
Impossible d'enregistrer une image en ppm. On obtient l'erreur "Error in a
dynamic_cast" bien que le format de l'image soit correct (couleur, 3 UINT 8).
Un petit programme pour tester :
<CODE>
#include <morphee/imageIO/include/morpheeImageIO.hpp>
#include <morphee/image/include/morpheeImage.hpp>
int main(int argc, char *argv[]) {
morphee::ImageInterface img;
morphee::RES_C res_io;
std::string input_filename, output_filename;
morphee::imageIO::initImageIO();
input_filename.assign(argv1);
output_filename.assign(argv2);
res_io = morphee::imageIO::fileRead(img, input_filename);
if ( (res_io!= morphee::RES_OK) || (img==NULL) ) {
std::cout << "Unable to read image" << std::endl;
return 1;
}
std::cout << "read image...OK" << std::endl;
std::cout << img
>getDataCategory() << " " << img->getDataType()
<<std::endl; //verification du format
if ( (res_io = morphee::imageIO::ppmFileWrite(img, output_filename))!=
morphee::RES_OK) {//remplacer par bmpFileWrite pour voir la difference
std::cout << "Unable to write image " << res_io << std::endl;
return -1;
}
std::cout << "write image...Ok" << std::endl;
return 0;
}
</CODE>
Certainement dans imageIO_PGM.cpp, le cast suivant ne passe pas :
const Image<UINT8>
_imTemp = dynamic_cast<const Image<UINT8>*>(imageOut);
if(!_imTemp) {
MORPHEE_REGISTER_ERROR("Unable to downcast the image");
return RES_ERROR_DYNAMIC_CAST;
}

#2 13/02/2008 17:45 (Tibs)
---------------------------------------------------------------------------
Change: status: "pending" -> "accepted"
Comment:
Je savais pas que le format ppm existait vraiment ;)
Bon en tout cas, un dynamic cast c qd mm assez violent.

#1 13/02/2008 14:54 (jo)
---------------------------------------------------------------------------
Change: topic: "" -> "UI"
Change: solution: "" -> "?"
Change: title: "" -> "pb ppmFileWrite"
Change: description: "" -> "Impossible d'enregistrer une image en ppm. On obtient l'erreur "Error in a dynamic_cast" bien que le format de l'image soit correct (couleur, 3 UINT 8).

Un petit programme pour tester :
<CODE>
#include <morphee/imageIO/include/morpheeImageIO.hpp>
#include <morphee/image/include/morpheeImage.hpp>

int main(int argc, char *argv[]) {
morphee::ImageInterface *img;
morphee::RES_C res_io;
std::string input_filename, output_filename;

morphee::imageIO::initImageIO();
{
MORPHEE_REGISTER_ERROR("Unable to downcast the image");
return RES_ERROR_DYNAMIC_CAST;
}
"
input_filename.assign(argv[1]);
output_filename.assign(argv[2]);
res_io = morphee::imageIO::fileRead(img, input_filename);
if ( (res_io!= morphee::RES_OK) || (img==NULL) ) {
std::cout << "Unable to read image" << std::endl;
return 1;
}
std::cout << "read image...OK" << std::endl;
std::cout << img
>getDataCategory() << " " << img->getDataType() <&lt;std::endl; //verification du format
if ( (res_io = morphee::imageIO::ppmFileWrite(img, output_filename))!= morphee::RES_OK) {//remplacer par bmpFileWrite pour voir la difference
std::cout << "Unable to write image " << res_io << std::endl;
return -1;
}
std::cout << "write image...Ok" << std::endl;
return 0;
}
&lt;/CODE&gt;
Certainement dans imageIO_PGM.cpp, le cast suivant ne passe pas :
const Image&lt;UINT8&gt;* _imTemp = dynamic_cast&lt;const Image&lt;UINT8&gt;*>(imageOut);
if(!_imTemp)

History

#1 Updated by Serge Koudoro almost 9 years ago

  • Category set to old plone Bugs

Also available in: Atom PDF