使用16位有符号格式打开CV不工作...裁剪和调整图像大小 [英] Open CV using 16 bit signed format not working... Cropping and re-sizing an image
问题描述
我试图创建一个块,可以接收图像并放大其中的一部分。为了做到这一点我使用OpenCV(我是新的)。
I am attempting to make a block that can take in an image and zoom in on a section of it. In order to do this I am using OpenCV (which i'm new to).
我的问题是,每当我运行使用16位有符号(cv_16sC1)我得到错误OpenCV错误:不支持的格式或格式()在cvGetRectSubPix,文件/media/virtex4/re/OpenCV-2.4.0/modules/imgproc/src/samplers.cpp,行573。
My issue is that whenever I run the functions using 16 bit signed (cv_16sC1), I get the error OpenCV Error: Unsupported format or combination of formats () in cvGetRectSubPix, file /media/virtex4/re/OpenCV-2.4.0/modules/imgproc/src/samplers.cpp, line 573.
首先,是否有人知道这个函数是否真正工作于位深度?是否有找出方法?
Firstly, does anyone know whether this function does actually work with that bit depth? Is there a way of finding out?
cv::Mat image_1_in(video_frame->_width, video_frame->_height, CV_16SC1, video_frame->GetPointerToYLine(0));
cv::Mat image_1_out(video_frame->_width, video_frame->_height, CV_16SC1, video_frame_out->GetPointerToYLine(0));
cv::Mat temp_image;
getRectSubPix(image_1_in, cv::Size(100, 200), cv::Point2f(200, 200), temp_image);
resize(temp_image, image_1_out, Size(video_frame_out->_width, video_frame_out->_height));
这是多次尝试之一,每次都给出相同的错误(直到我将格式更改为CV_32f没有给出错误)...
This is one of many attempts each of which gives the same error (until I changed the format to CV_32f which didn't give the error)...
推荐答案
看起来 getRectSubPix
仅适用于{CV_8U,CV_8U},{CV_32F,CV_32F}和{CV_8U,CV_32F}的{src,dst}类型。
It seems getRectSubPix
only work with {src,dst} type of {CV_8U, CV_8U}, {CV_32F, CV_32F} and {CV_8U, CV_32F}.
我深入的源代码,并计算出来。 API参考中没有指定。
I dip into the source code and figure that out. There's no specification in the API reference.
这篇关于使用16位有符号格式打开CV不工作...裁剪和调整图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!