roi

Define image ROI with OpenCV in C

拟墨画扇 提交于 2019-11-30 07:01:24
问题 I have a question about how to define a ROI with OpenCV. I know what the definition of the function cvSetImageROI but I want to know if is possible to define a ROI with OpenCV with a different shape than rectangle. For example, define a ROI in a circle or in different form. It is possible to do this? cvSetImageROI(img1, cvRect(a, b, c, d)); 回答1: The following code, which you could have found here or even here sets a circular ROI using a bit mask on your image. #include "cv.h" #include

Using ROI in OpenCV?

▼魔方 西西 提交于 2019-11-30 06:41:09
问题 ROI can only be implemented with an rectangle. I however have a contour that I want to set as an ROI. Does anyone have an idea of how I would go about using a contour as an ROI rather than a rectangle? Otherwise if not possible, how could I focus my actions only in pixels in a specific contour? Thanks PS: Sorry for all these OpenCV questions. Just really confused :$ 回答1: OpenCV supports only rectangular ROIs. However, to make some processing for specific pixels, you can use some helper

roipoly matlab function equivalent in OpenCV

懵懂的女人 提交于 2019-11-29 17:20:18
I am converting a matlab code into C++ using OpenCV libraries. Can anyone tell me roipoly matlab function equivalent in OpenCV?? Or how to get the same functionality using OpenCV? BW = roipoly(I, c, r) BW = roipoly(I, c, r) returns the ROI specified by the polygon described by vectors c and r, which specify the column and row indices of each vertex, respectively. c and r are of same size. In my case I want to extract triangular roi from the image, so c and r are of size 3x1. Can anyone tell me how to do this in C++ using OpenCV?? There is no corresponding inbuilt function like roipoly in

OpenCv assertion failed

孤者浪人 提交于 2019-11-29 12:39:35
I am working on application for finding face in 2D image and later inside same image I want to find mouth, but I have some problem right now. This is my code so far: for (int i = 0; i < faces.size(); i++) { Point pt1(faces[i].x, faces[i].y); Point pt2((faces[i].x + faces[i].height), (faces[i].y + faces[i].width)); rectangle(frame, pt1, pt2, Scalar(255,0 , 0), 2, 8, 0); //I WANT ROI(FOR MOUTH DETECTION) TO BE ONLY HALF OF THE RECTANGLE WITH FACE Rect mouthROI; mouthROI.x = (faces[i].x); mouthROI.y = faces[i].y*(1.5); mouthROI.width = (faces[i].x + faces[i].height); mouthROI.height = (faces[i].y

Error setting ROI OpenCV Android

一笑奈何 提交于 2019-11-29 11:45:24
I am trying to figure out how to set the ROI for an Image in OpenCV on Android. I have done this on other operating systems, so I think HOW I am doing it is semantically correct, but there is an error somewhere. So far I have tried this Rect roi = new Rect(0, 0, inputFrame.cols(), inputFrame.rows()); Mat cropped = new Mat(inputFrame, roi); However I get an error somewhere in the OpenCV classes that looks like this Utils.matToBitmap() throws an exception:/home/reports/ci/slave/opencv/modules/java/generator/src/cpp/utils.cpp:107: error: (-215) src.dims == 2 && info.height == (uint32_t)src.rows &

OpenCV extract area of an image from a vector of squares

Deadly 提交于 2019-11-29 11:22:39
I have an image that contains a square, and I need to extract the area contained in that square. After applying the squares.c script (available in the samples of every OpenCV distribution) I obtain a vector of squares, then I need to save an image for each of them. The user karlphillip suggested this: for (size_t x = 0; x < squares.size(); x++) { Rect roi(squares[x][0].x, squares[x][0].y, squares[x][1].x - squares[x][0].x, squares[x][3].y - squares[x][0].y); Mat subimage(image, roi); } in order to generate a new Mat called subimage for all the squares detected in the original image As karl

Define image ROI with OpenCV in C

那年仲夏 提交于 2019-11-29 00:36:14
I have a question about how to define a ROI with OpenCV. I know what the definition of the function cvSetImageROI but I want to know if is possible to define a ROI with OpenCV with a different shape than rectangle. For example, define a ROI in a circle or in different form. It is possible to do this? cvSetImageROI(img1, cvRect(a, b, c, d)); Matteo The following code, which you could have found here or even here sets a circular ROI using a bit mask on your image. #include "cv.h" #include "highgui.h" int main(int argc, char** argv) { IplImage* src, * res, * roi; /* usage: <prog_name> <image> */

OpenCV C++, getting Region Of Interest (ROI) using cv::Mat

那年仲夏 提交于 2019-11-28 21:22:27
I'm very new to OpenCV (started using it two days ago), I'm trying to cut a hand image from a depth image got from Kinect, I need the hand image for gesture recognition. I have the image as a cv::Mat type. My questions are: Is there a way to convert cv::Mat to cvMat so that I can use cvGetSubRect method to get the Region of interest? Are there any methods in cv::Mat that I can use for getting the part of the image? I wanted to use IplImage but I read somewhere that cv::Mat is the preferred way now. Michael Koval You can use the overloaded function call operator on the cv::Mat : cv::Mat img = .

Using ROI in OpenCV?

◇◆丶佛笑我妖孽 提交于 2019-11-28 20:54:36
ROI can only be implemented with an rectangle. I however have a contour that I want to set as an ROI. Does anyone have an idea of how I would go about using a contour as an ROI rather than a rectangle? Otherwise if not possible, how could I focus my actions only in pixels in a specific contour? Thanks PS: Sorry for all these OpenCV questions. Just really confused :$ OpenCV supports only rectangular ROIs. However, to make some processing for specific pixels, you can use some helper functions. One of them is pointPolygonTest(), which tells you a given pixel belongs on not to a polygon. So you

论文笔记 Fast R-CNN细节

拟墨画扇 提交于 2019-11-28 14:08:43
当我决心认真地看Faster R-CNN代码的时候,我就觉得有必要把 Fast R-CNN的论文的细节再从新完整地看一遍了。对,是细节,如何实现的部分,于是有了此篇博客。请注意是 Fast R-CNN笔记。 其网络结构流程如上图,将整个图片输入卷积层和pooling层,得到卷积层特征图。然后针对每一个proposal带来的感兴趣区域RoI,通过RoI pooling layer得到在特征图中RoI区域部分,通过全连接层得到特征向量。 网络结构与训练 RoI pooling layer: 该层主要将感兴趣区域提取出来单独进行max pooling操作得到一个H*W(如7*7)的固定大小的小的特征图。文章中的RoI主要是卷积层特征图中的一个矩形窗口。每一个RoI用四维量表示(r,c,h,w),(r,c)是top-left点坐标,(h,w)是RoI的高和宽。因此,该层的操作主要是将h*w大小的RoI通过池化操作,变成一个 H*W大小的特征图。 预训练模型初始化: 主要实验了三种情况,每次都是使用5个max pooling 层和3-5层卷积层。第一种直接将最后一个max pooling层变成RoI pooling层,第二种网络最后的全连接层和softmax层替换成上图中的结构,第三种修改网络使其分别输入图像和RoI两种数据。 Fine-tuning for detection: