robby987
robby987

Reputation: 827

Open CV using 16 bit signed format not working... Cropping and re-sizing an image

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).

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));

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)...

Upvotes: 2

Views: 1603

Answers (1)

luhb
luhb

Reputation: 666

It seems getRectSubPix only work with {src,dst} type of {CV_8U, CV_8U}, {CV_32F, CV_32F} and {CV_8U, CV_32F}.

I dip into the source code and figure that out. There's no specification in the API reference.

Upvotes: 4

Related Questions