Ask Your Question

Mahdi's profile - activity

2016-02-17 18:57:57 -0600 received badge  Nice Answer (source)
2015-03-23 12:15:36 -0600 received badge  Nice Answer (source)
2013-07-13 19:18:16 -0600 commented question Database(DBMS) for Computer Vision

How about saying that when we query on a database there functionalitys that databases use to make processes faster like caching. Like querying for similar strings, sorting, filtering or what ever else. So more precisely, is there any database that makes similar search or some basic vector operations as its primitive functionalitys? Thanks again

2013-07-13 13:59:28 -0600 edited question How to change the dimension of the Mat so that previous data remain?

I want to change the dimension of Mat dynamically but remain my previous data in Mat when create the Mat again clear precious data.

2013-07-13 13:49:09 -0600 asked a question Database(DBMS) for Computer Vision

I am searching to gain some knowledge for database system that best fits computer vision(and/or machine learning) systems. A database and methods for storing SIFT or any other popular image features and query for finding matches. So please name database and frameworks used for professional purposes like MySQL, PostgreSQL, MongoDB, HBase or any other suitable solutions that is best for numerical and high performance applications and explain your opinion. I wonder if I am thinking on the issue or asking the question in the right manner so please correct me if you find any misunderstandings.

Thanks in advance.

2013-06-10 23:55:27 -0600 answered a question flann & circular parameters

A simple answer to this(But not definitely efficient):

  1. Do use the FLANN(knnSearch) with your default feature matrix as a regular procedure.
  2. Then check the Dist vector for values larger than 180 and just replace them by their complementary(The other half of 360!)!
  3. resort your feature matrix regarding to your new Distance vector!
2013-06-07 13:52:32 -0600 commented question convert from iplimage to cvArry
2013-06-07 12:37:57 -0600 commented answer convert from iplimage to cvArry

@StevenPuttemans Before commenting its a good idea to read the OpenCV docs! cvArr is only a meta type!!! http://docs.opencv.org/modules/core/doc/old_basic_structures.html?highlight=cvarr#CvArr

2013-06-07 03:28:57 -0600 answered a question convert from iplimage to cvArry

The note below is from Norman's blog.

Step, Width and Height

Both IplImage and CvMat have the above three elements, which make them compatible. For CvMat, the three element are named as step, cols and rows; while for IplImage, they are denoted as widthStep, width and height.

The step element in the matrix array is the length in bytes of a row in the matrix. In that structure, cols or width alone is not enough to move between matrix rows because, for machine efficiency, matrix or image allocation is done to the nearest four-byte boundary. Thus for instance, a matrix of width three bytes would be allocated four bytes with the last one ignored. When using cvCreateMat() and cvCreateImage() to creates the header and allocates data of IplImage and CvMat, the cvCreateImage will align each row on four-byte boundaries while cvCreateMat align rows to minimal possible steps.

Codes for creating a CvMat object according to four-byte alignment rule manually:

CvMat* mat = cvCreateMatHeader(rows, cols, type);
mat->step = 4 * (mat->cols * CV_ELEM_SIZE1(mat->type) * CV_MAT_CN(mat->type) / 4 + 1);//critical
cvCreateData(mat);

Transform between IplImage and CvMat

cvGetMat and cvGetImage are used to perform transformation between IplImage and CvMat, in which there is no new memory allocated for block data. The new object just points to the data block of original object, inheriting the setup of alignment(including width, height and step). To transform from IplImage to CvMat, Use function:

CvMat* cvGetMat( const CvArr* arr, CvMat* mat, int* coi = 0, int allowND );

The function cvGetMat returns matrix header for the input array that can be matrix - CvMat, image - IplImage or multi-dimensional dense array - CvMatND* (latter case is allowed only if allowND != 0) . In the case of matrix the function simply returns the input pointer. In the case of IplImage* or CvMatND* it initializes mat structure with parameters of the current image ROI and returns pointer to this temporary structure. Usage:

CvMat stub, *dst_mat;
dst_mat = cvGetMat(src_img, &stub, 0, 0);

To transform from CvMat to IplImage, Use function:

IplImage* cvGetImage( const CvArr* arr, IplImage* image_header );

The function cvGetImage returns image header for the input array that can be matrix - CvMat, or image - IplImage. In the case of image the function simply returns the input pointer. In the case of CvMat* it initializes image_header structure with parameters of the input matrix. Usage:

IplImage stub, *dst_img;
dst_img = cvGetImage(src_mat, &stub);

Note that if we transform IplImage to CvMat and then transform CvMat back to IplImage, we can get different headers if the ROI is set, and thus some IPL functions that calculate image stride from its width and align may fail on the resultant image. These two functions are error prone due to the directly pointing to the original data block and the different default alignment rules of CvMat and IplImage. A practical way to avoid conflicts is to align CvMat manually.

2013-06-07 03:07:49 -0600 commented answer Fill an image with the content of RotatedRect

Thanks to Ben for the nice answer! So you should only compute fillConvexPoly(myImage, rRect.points(vertices), 4, Scalar(0));

2013-06-07 02:53:11 -0600 answered a question Fill an image with the content of RotatedRect

Here is an answer to this: The idea is to check whether every pixel is in the region respect to rectangle edges:

for(int i=0; i<myImage.rows; ++i)
{
    for(int j=0; j<myImage.cols; ++j)
    {
        if(isInRotatedRect( Point(j,i), rotated_rect))
        {
            myImage.at<uchar>(i,j) = 0;
        }
    }
}

for computing isInRotatedRect:

bool isInRotatedRect(Point p, RotatedRect rRect)
{
    double line_pro[4];
    Point2f vertices[4];
    rRect.points(vertices);
    for(int i=0; i<4; ++i)
    {
        line_pro[i] = computeProduct(p, vertices[i], vertices[(i+1)%4]);
    }
    if(line_pro[1]*line_pro[3]<0 && line_pro[0]*line_pro[2]<0)
    {
        return true;
    }
    return false;
}

//finding whether  point p is at the left or right side of rectangle edge ab.  
double computeProduct(Point p, Point2f a, Point2f b)
{
    double m = (a.y-b.y) / (a.x-b.x);
    double c = a.y - k * a.x;
    return m * p.x - p.y + c;
}

A better and more intuitive way would be rather than doing this for every image make a zero one mask and the cross product original image! This may be more efficient specially in video.

2013-06-06 02:40:26 -0600 commented answer smooth edges
2013-06-06 01:54:21 -0600 commented answer smooth edges

I understand how it is hard when you deal with it first time! At last if you found my answer correct and helpful please select the tik mark on the left side. :)

2013-06-06 01:42:05 -0600 commented answer smooth edges

Thats not even a problem! Do the edge detection operation on the gray image. Once you found the locations do the blurring operation on every image channel! :)

2013-06-06 01:39:06 -0600 answered a question Scale a RECT from its center ?

I don't think that ROI * scale is implemented in opencv, but here are some notes:

  • It is a good idea to write a modular function for this task but a better interface would be scaleROI(Rect& sampleRect, float scale) and do other computations like center in the function.
  • There is some thing that should get corrected in your implementation: (Remember top left image starts with (0, 0)):
    tl.y = queryCenter.y - shiftY;
    br.y = queryCenter.y + shiftY;

  • If you are familiar with operator overloading in CPP, It may be a better idea to implement '*' for cv::Rect class!

2013-06-06 00:43:29 -0600 answered a question smooth edges

Here a simple answer to this but not an exact one:

  1. first of all you should extract sharp edges. Like if you use Canny for edge detection set the thresholds somehow to that is responsive to sharp edges.
  2. Then you could simply use a smoothing filter(e.g Gaussian) where a sharp edges where detected.
2013-03-11 02:29:39 -0600 received badge  Nice Answer (source)
2013-02-22 13:55:34 -0600 answered a question 32 vs 64 bit, Ubuntu

Ones you want to install OpenCV you make it on your system and you can use it properly on every system. But about the difference of 32-bit and 64-bit systems:

  1. More bits means that data can be processed in larger chunks which also means more accurately.
  2. More bits means our system can point to or address a larger number of locations in physical memory.

    In computer vision, computation tasks are Memory and processor intensive. So 64-bit memory may allow us to use larger RAM memory in our computer system.
    If your hardware supports 64-bit OS it is good decision to try Ubuntu 64-bit.
2013-02-19 16:39:45 -0600 answered a question Silly question - but why is it so hard to find the source code?

Hi, Here is the source code: https://github.com/Itseez/opencv/tree/master/modules, in every folder there is a src folder for your purpose.
I do not know what you have searched but you may find every thing in the GitHub page!

2013-02-19 16:33:36 -0600 asked a question Using HOGDescriptor in Python

Hi,
I want to use HOGDescriptor in python implementation but I can find anything except a peopledetect.py example in sample folder for using pre-trained detector (documentation exist only for GPU and OpenCL)! I want to compute the feature for images. Does anyone have any idea how I can deal with this?
Any help is appreciated!

2013-02-18 22:32:19 -0600 edited question Using Matlab data files (.mat) in C++

I want to use the data in .mat file inside c++ code. I am using visual studio 2010 and Matlab r2011b. is there any library or function or anything in c++ language enable me to read mat file?

2013-02-18 22:30:08 -0600 answered a question Using Matlab data files (.mat) in C++

You could try the matio library. It seems to be actively developed.

Here you could find its user guide: Link

2013-02-15 13:05:22 -0600 answered a question from matlab to c++

Hi,
There is not a specific technique for this! You should get your hands dirty in the job!:)

Some Advice for starting:

  1. Get familiar with essential structures in OpenCV: Mat, Point,... and their functions and element accessing techniques while using Mat.
  2. Learn basic image and video i/o in OpenCV: imread, imwrite and VideoCapture class.
  3. There are a lot of image operation that is used widely, like filtering. So take a look at similar ways for doing them in Opencv. OpenCV has nice functions for ease of use.
  4. I recommend to go over OpenCV tutorial. It is nicely written and explained examples line by line!
  5. At last use OpenCV document a lot! It is well-ordered and in my opinion it is one of the richest references a library could have!
2013-02-14 04:28:50 -0600 commented answer Technique to detect a hospital bed by camera

Please mark the answer as correct (click the tick mark) if you found it useful

2013-02-13 10:59:07 -0600 answered a question how to calculate the mean value of multiple pictures

Hi,

You should convert your resultframe to a CV_8UC3 before imshow!

2013-02-13 10:27:56 -0600 answered a question Recognizing a tennis court on a satellite image

The project your are working on is not really a pet project and it is hard enough!:)

I recommend to go over the workshop site to address some new approaches in aerial vision:
ECCV_workshop
But a here I explain an intuitive way for this special problem:
1. You have color cues [Green], so extract the green channel and do a color segmentation using watershed algorithm followed by a Connected Component (an Opencv example here). Then find the area and bounding box area of remaining connected components and they should approximate each other. So trees and green non court areas will be removed.
2. For finding court lines, isolate white pixcels(approx. R=G=B).

2013-02-13 10:02:46 -0600 answered a question Technique to detect a hospital bed by camera

I think one of the best approaches is to use DPM.
It is the state of the art algorithm for object detection since it's publish date.

If speed is one of your concerns use HOG feature and a linear SVM.

2013-01-30 04:01:08 -0600 received badge  Nice Answer (source)
2013-01-12 10:07:16 -0600 answered a question Where are my OpenCV development libraries installed?

It is here: /usr/local/include/opencv2 if you are using linux.
for libs: /usr/local/lib/

2013-01-09 02:33:56 -0600 answered a question Symbol Detection in Video (looking for guidance)

I dont think that there are a very well defined algorithm for your purpose.
I found these state of the art articles that you could get some help from!:)
Efficient video text detection using edge features
Detecting Texts of Arbitrary Orientations in Natural Images

2013-01-09 02:21:41 -0600 answered a question I cant access my webcam Opencv 2.4.3

Hi

I have run your code and I think you should use IplImage* rather than IplImage!

2012-12-18 20:51:38 -0600 received badge  Necromancer (source)
2012-11-28 01:43:38 -0600 answered a question Need good method for grabbing image from webcam every 10 seconds

You only need to put a waitKey(10000) before san_cap.read(san);