单单是图像的加载不是一两句代码就能搞定的。
如果你做图像方面的,不妨看看《Visual C++ 数字图像处理典型算法及实现》
推荐 opencv库,简单易学
例如使用opencv分离R,G,B三个分量有很多方法,如下:而且保存只需一个cvSave()函数。
#include <cvh>
#include <highguih>
int main(int argc, char argv)
{
IplImage src = cvLoadImage( argv[1], 1 );
IplImage RedChannel = cvCreateImage( cvGetSize(src), 8, 1);
IplImage GreenChannel = cvCreateImage( cvGetSize(src), 8, 1);
IplImage BlueChannel = cvCreateImage( cvGetSize(src), 8, 1);
IplImage alphaChannel = cvCreateImage( cvGetSize(src), 8, 1);
cvSetImageCOI(src,1);
cvCopy(src,BlueChannel); //提取蓝色
cvSetImageCOI(src,2);
cvCopy(src,GreenChannel); //提取绿色
cvSetImageCOI(src,3);
cvCopy(src,RedChannel); //提取红色
cvNamedWindow( "RedChannel", 1 );
cvNamedWindow( "GreenChannel", 1 );
cvNamedWindow( "BlueChannel", 1 );
cvNamedWindow( "lphaChannel", 1 );
cvShowImage( "RedChannel", RedChannel );
cvShowImage( "GreenChannel", GreenChannel );
cvShowImage( "BlueChannel", BlueChannel );
cvShowImage( "lphaChannel", alphaChannel );
cvWaitKey(0);
cvReleaseImage( &RedChannel );
cvReleaseImage( &GreenChannel );
cvReleaseImage( & BlueChannel );
cvReleaseImage( & alphaChannel );
return 0;
}
/#include <cvh>
#include <highguih>
int main(int argc, char argv)
{
IplImage src = cvLoadImage( argv[1], 1 );
IplImage RedChannel = cvCreateImage( cvGetSize(src), 8, 1);
IplImage GreenChannel = cvCreateImage( cvGetSize(src), 8, 1);
IplImage BlueChannel = cvCreateImage( cvGetSize(src), 8, 1);
IplImage alphaChannel = cvCreateImage( cvGetSize(src), 8, 1);
cvCvtPixToPlane(src,BlueChannel,GreenChannel,RedChannel,NULL);
cvNamedWindow( "RedChannel", 1 );
cvNamedWindow( "GreenChannel", 1 );
cvNamedWindow( "BlueChannel", 1 );
cvNamedWindow( "lphaChannel", 1 );
cvShowImage( "RedChannel", RedChannel );
cvShowImage( "GreenChannel", GreenChannel );
cvShowImage( "BlueChannel", BlueChannel );
cvShowImage( "lphaChannel", alphaChannel );
cvWaitKey(0);
cvReleaseImage( &RedChannel );
cvReleaseImage( &GreenChannel );
cvReleaseImage( & BlueChannel );
cvReleaseImage( & alphaChannel );
return 0;
}
/
1首先打开浩辰CAD软件,插入需要拆解面域的图纸。
2在命令面板输入快捷键“X”并按下“空格键”,然后进入到分解命令。
3使用鼠标左键单击有效拆解的面域图形,选中后面域图形为虚线。按下“空格键”或“Enter键”确定系统会自动拆解图形。
4完成复合图像分解命令后,使用鼠标左键单击可单独选中图形线条。
以上就是关于用c++怎样从彩色图像中分解出R,G,B分量,并且分别保存全部的内容,包括:用c++怎样从彩色图像中分解出R,G,B分量,并且分别保存、CAD自动拆解图形怎么 *** 作、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)