/* * original - original "source" image data * o_width - width of original image * o_height - height of original image * src - current image * s_width - width of current image * s_height - height of current image * dest - destination image data (assume pre-malloc'd) * d_width - width of destination image * d_height - height of destination image */ void bidirectional_similarity_cpu_gpu(uchar4* original, int o_width, int o_height, uchar4* src, int s_width, int s_height, uchar4** dest, int d_width, int d_height) { mapent *map; printf( "Doing init\n"); retarget_map_init(src, s_width, s_height, dest, d_width, d_height, &map); //bidirectional_similarity_vote( src, s_width, s_height, *dest, d_width, d_height, map ); if (BDP_VIZ) { SaveBMPFile( *dest, d_width, d_height, "em-cpugpu-iter-0.bmp" ); } for ( int i = 1; i <= ITERATIONS; i++ ) { printf( "Starting EM interation %i...\n", i ); bidirectional_similarity_EM_cpu_gpu( original, o_width, o_height, *dest, d_width, d_height, map ); if (BDP_VIZ) { char fname[64]; sprintf( fname, "em-cpugpu-iter-%i.bmp", i ); // vizuaize the iterations //printf( "Output map for iteration %i...\n", i ); SaveBMPFile( *dest, d_width, d_height, fname ); } } free(map); }
bool SaveImage(const ImageSaveInfo *pInfo) { if (pInfo==nullptr) return false; bool fResult; if (::lstrcmpi(pInfo->pszFormat,TEXT("BMP"))==0) { fResult=SaveBMPFile(pInfo); } else if (::lstrcmpi(pInfo->pszFormat,TEXT("JPEG"))==0) { fResult=SaveJPEGFile(pInfo); } else if (::lstrcmpi(pInfo->pszFormat,TEXT("PNG"))==0) { fResult=SavePNGFile(pInfo); } else { fResult=false; } return fResult; }