1 | initial version |
ok ok ..... I add a comment in a nice post .... I have an idea:
1-hougline 2-findcontour contourArea as filter 3-the result --> become a mask 4- than see code below
absdiff(previousframe, nextframe, n);
absdiff(currentframe, nextframe, n);
bitwise_and(n, l, result);
5-matchshape or hierarchy to find the orientation and angle of the cards ( this assumption that the cards are for example sugar packets ) .
what do you think ??
2 | No.2 Revision |
ok ok ..... I add a comment in a nice post .... I have an idea:
1-houglinehougline link to a tutorial
2-findcontour contourArea as filter
3-the result --> become a mask
4- than see code below
absdiff(previousframe, nextframe, n);
absdiff(currentframe, nextframe, n);
bitwise_and(n, l, result);
5-matchshape or hierarchy to find the orientation and angle of the cards ( this assumption that the cards are for example sugar packets ) .
what do you think ??
3 | No.3 Revision |
ok ok ..... I add a comment in a nice post .... I have an idea:
1-hougline link to a tutorial 2-findcontour contourArea as filter 3-the result --> become a mask 4- than see code below
absdiff(previousframe, nextframe, n);
absdiff(currentframe, nextframe, n);
bitwise_and(n, l, result);
5-matchshape or hierarchy to find the orientation and angle of the cards ( this assumption that the cards are for example sugar packets ) .
what do you think ??
I resume the request on this my old post .... (because only one reply is possible for each one, and because I recently addressed the issue again).... the best answer for me now is these strategy (in opencv3 it has better performance respect opencv2.4.x):
cvtColor(dest_image, imgHSV, CV_RGB2HSV); //Change the color format from BGR to HSV
inRange(imgHSV, Scalar(a,b,c), Scalar(a1,b1,c1), imgThresh);
equalizeHist(imgThresh, imgThresh);
imgThresh.copyTo(imgThresh1);
if(imgThresh1.empty()) break;
blur(imgThresh1, imgThresh1, Size( d2, d3 ), Point(-1,-1));
next step ... find contour and find centroid and area for each figure red rhomboid of playing cards ... do so (with blur erode dilate) to make invisible the numbers ... even filtering out the size of the contour found ...
next step ... create a class or function that calculate if centroid is part of rectangle (green rectangle of my previous draw) and store it in a vector with 5d rectangle point ... 4d for 4 point of rectangle + 1d for center of these rectangle...
next step ... using hug filter find all contour (2th time of use contour) card and only complete contour (centroid & area) store it in a vector
next step ... compare vector to vector centroid of vector5d(5d-last point) and centroid of contour card find with some tolerance ....
In these way you can fin all complete card which you are seen to be above all other...
I think only 4 loop program is enought for do these ....
Regards Giorgio
4 | No.4 Revision |
ok ok ..... I add a comment in a nice post .... I have an idea:
1-hougline link to a tutorial 2-findcontour contourArea as filter 3-the result --> become a mask 4- than see code below
absdiff(previousframe, nextframe, n);
absdiff(currentframe, nextframe, n);
bitwise_and(n, l, result);
5-matchshape or hierarchy to find the orientation and angle of the cards ( this assumption that the cards are for example sugar packets ) .
what do you think ??
I resume the request on this my old post .... (because only one reply is possible for each one, and because I recently addressed the issue again).... the best answer for me now is these strategy (in opencv3 it has better performance respect opencv2.4.x):
cvtColor(dest_image, imgHSV, CV_RGB2HSV); //Change the color format from BGR to HSV
inRange(imgHSV, Scalar(a,b,c), Scalar(a1,b1,c1), imgThresh);
equalizeHist(imgThresh, imgThresh);
imgThresh.copyTo(imgThresh1);
if(imgThresh1.empty()) break;
blur(imgThresh1, imgThresh1, Size( d2, d3 ), Point(-1,-1));
next step ... find contour and find centroid and area for each figure red rhomboid of playing cards ... do so (with blur erode dilate) to make invisible the numbers ... even filtering out the size of the contour found ...
next step ... create a class or function that calculate if centroid is part of rectangle (green rectangle of my previous draw) and store it in a vector with 5d rectangle point ... 4d for 4 point of rectangle + 1d for center of these rectangle...
next step ... using hug filter LineSegmentDetector::detect find all contour (2th time of use contour) card and only complete contour (centroid & area) store it in a vector
next step ... compare vector to vector centroid of vector5d(5d-last point) and centroid of contour card find with some tolerance ....
In these way you can fin all complete card which you are seen to be above all other...
I think only 4 loop program is enought for do these ....
Regards Giorgio