|
发表于 2008-12-27 17:08:56
|
显示全部楼层
如何实现整型图象到读点图象的转换
ConvertScale
Converts one array to another with optional linear transformation
void cvConvertScale( const CvArr* src, CvArr* dst, double scale=1, double shift=0 );
#define cvCvtScale cvConvertScale
#define cvScale cvConvertScale
#define cvConvert( src, dst ) cvConvertScale( (src), (dst), 1, 0 )
src
Source array.
dst
Destination array.
scale
Scale factor.
shift
Value added to the scaled source array elements.
In case of scale=1, shift=0 no prescaling is done. This is a specially optimized case and it has the appropriate cvConvert synonym. If source and destination array types have equal types, this is also a special case that can be used to scale and shift a matrix or an image and that fits to cvScale synonym.
这是OpenCV的documentation 当scale = 1, shift = 0时, 等效于转换
待转换的类型由其头的类型决定
举例
IplImage* img = cvLoadImage(filename, CV_LOAD_IMAGE_ANYCOLOR);
IplImage* floatImage = cvCreateImage(cvSize(img->width, img->height), IPL_DEPTH_32F, 3);
cvConvertScale(img, floatImage); |
|