问题描述
我不熟悉将C ++与OpenCV一起使用,我想加载一个.tif图像,并找出存在多少页面/层并将该图像分成多个页面。我可以使用以下方法计算图像中的通道数 垫::通道() 并使用cv :: Split()拆分单独的通道,但我想知道是否有一种方法可以找出.tif图像中的层数并将它们拆分为单独的层,并将其另存为C ++中的单独图像。 我也使用python看到了这篇文章。 how to import multiple layers from tif file with opencv
由于我是C ++的新手,所以尽管尝试了一下,但仍很难使此代码适应C ++。我正在使用Mat图片对象。
任何帮助将不胜感激。
编辑:
for (int i = 0; i < count; i++) //Count is the number of tif images in the folder
{
images.push_back(imread(fn[i],cv::IMREAD_UNCHANGED)); //pushes all images into a vector of Mat objects
fileName = getFileExtension(fn[i],true); //getFileExtension is a function to take filename and extension seperately
Mat current_image = images[i];
imreadmulti(fileName,pages,cv::IMREAD_ANYCOLOR);
cout << images[i].dims << endl;
cout<< pages.size() << endl;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)