看板 MacDev 關於我們 聯絡資訊
我想使用IplImage來產生一個1-bit 單通道 非0即1的黑白影像 我的程式碼 IplImage *image; CvSize size = cvSize( 320, 240); char array[320*240]; image = cvCreateImageHeader( size, IPL_DEPTH_1U, 1 ); for(int x = 0 ; x < 320*240 ; x++){ array[ x ] = x%2; } cvSetImageData( image, array, image->widthStep ); cvSaceImage( "testImage.tiff", image ); 但卻得到錯誤訊息 OpenCV ERROR: Input image depth is not supported by function () in function cvGetMat, ../../../cxcore/src/cxarray.cpp(2799) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... called from cvUnregisterType, ../../../cxcore/src/cxpersistence.cpp(4933) Terminating the application... 在東問西查後,cvSaceImage()的說明文件裡有提到 Only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function. 看到這個我心涼一半了 我主要的應用只是儲存影像而已 所以並不會對影像做操作 由於是大量的儲存影像 所以用 8-bit 來存,空間會吃很兇 請問各位大大有甚麼辦法解決這個問題嗎O_Q ? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.166.50.16
nat626:救命呀 我搞了兩天搞不出來 大大們幫幫忙O_Q 01/16 15:48
nat626:或是有沒有其他的framework可以用O_Q ? 01/16 15:49
Blueshiva:Cocoa的NSImage系列就可以產生TIFF,只是不知道你的應用 01/16 23:14
Blueshiva:能不能配合上去而已 01/16 23:14
bizkit:用grayscale呢? 01/25 09:44