2017-07-13 11:28:41 -0600 received badge ● Popular Question (source) 2017-07-07 03:03:05 -0600 received badge ● Popular Question (source) 2015-01-13 02:20:31 -0600 commented answer background subtraction with a moving camera how did you do ? 2015-01-12 01:09:31 -0600 received badge ● Enthusiast 2015-01-11 10:36:52 -0600 asked a question OpenCV C++ / Multiple histograms on Camshift I try to improve the initial camshift algorithm by computing lbp (locally binary pattern) histogram and hue distance histogram. I have some issues about using camshift with those data. I've already compute the lpb cv::Mat on one hand, and the other hand i computed the hue distance cv::Mat. So at this point i have two features: lbp and hue distance. Now i would like to compute the two histograms corresponding to each feature but i don't know how to process in order to do that. Indeed in the original camshift there is the calchist function, which take in parameter the HSV picture. Then it computes the histogram with simply hue or hue-saturation histogram. Do i have to gather those features into one matrix in order to then compute the histogram on it ? Thank you in advance. 2015-01-08 01:16:56 -0600 commented answer How to make a hue distance histogram ? Thank again ! 2015-01-07 10:40:21 -0600 commented answer How to make a hue distance histogram ? Thank you for your answer ! Finally i was able to do some stuff but without pointer... I did only: for (int i=0;i(i,j),val_href); hue_distance_mat.at(i,j)=val_hue_distance; } retun hue_distance_mat  where ComputeHueDistance is the implementation of the formula which takes in parameters the huechannel image and the Href value i computed before... It seems very simple in comparison with you, so i don't know if it makes senses what i did. 2015-01-05 02:17:18 -0600 commented answer How to make a hue distance histogram ? Thank you so much for your answer ! Why do you use pointer ? Is not more simpler to so something like image.at(x,y)? Actually i don't understand those lines int temp_value_y = abs(img_hsv_ptr[((y-1)img_hsv.cols+3)+(x3)+0] - img_hsv_ptr[((y+1)img_hsv.cols+3)+(x3)+0]); //subtract right pixel from left pixel int temp_value_x = abs(img_hsv_ptr[(yimg_hsv.cols+3)+((x-1)3)+0] - img_hsv_ptr[(yimg_hsv.cols+3)+((x+1)3)+0]); I suppose you apply the formula ? But that's true i'm a bit destabilized with the way you do the calculation like : distance_hue_img_ptr[(y*img_hsv.cols)+x] Thank again 2015-01-05 01:18:56 -0600 received badge ● Supporter (source) 2015-01-02 06:06:34 -0600 commented question How to make a hue distance histogram ? Happy new year ! sorry i don't understand. When i do an histogram i don't use edge detection. Can you explain me again ? Thank you 2014-12-28 06:18:16 -0600 commented question How to make a hue distance histogram ? I know how to make a histogram based on HUE or saturation value but here it's a histogram based on the distance...And i don't know how to do it 2014-12-26 08:52:58 -0600 asked a question How to make a hue distance histogram ? Hi, I would like to improve CamShift algorithm by using a Hue distance histogram. It consists to compute a hue reference Href which is the hue value which has the highest frequency in the histogram h(x) obtained from a region of interest at the step 1 of CAMShift. Then using this Href, we compute the distance like that: I know there is a method called CalcHist in Opencv to compute a histogram, but how i can handle with that ? Thank you in advance, 2014-12-04 09:12:05 -0600 asked a question C++/OpenCV - Kalman filter for video stabilization I try to Stabilize video with a Kalman filter for smoothing . But i have some problems Each time, i have two frames: one current and another one. Here my workflow: Compute goodFeaturesToTrack() Compute Optical Flow using calcOpticalFlowPyrLK() Keep only good points Estimate a rigid transformation Smoothing using Kalman filter Warping of the picture. But i think there is something wrong with Kalman because at the end my video is still not stabilized and it's not smooth at all, it even worse than the original... Here my code of Kalman  cv::Mat StabilizationTestSimple2::computeMask(Mat& frame,int lh,int lw){ int height=frame.rows; int width=frame.cols; /// Creation du masque pour le calcul de point d'interet int limitH=lh; int limitW=lw; cv::Mat mask = cv::Mat::zeros(frame.size(), CV_8UC1); //NOTE: using the type explicitly cv::Mat roi1=frame(Range(0,limitH),Range(0,limitW));//Coin haut à gauche cv::Mat roi2=frame(Range(height-limitH,height),Range(0,limitW));//Coinbas à gauche cv::Mat roi3=frame(Range(0,limitH),Range(width-limitW,width));//Coin haut à droite cv::Mat roi4=frame(Range(height-limitH,height),Range(width-limitW,width));//Coin haut à droite roi1.copyTo(mask(Range(0,limitH),Range(0,limitW))); roi2.copyTo(mask(Range(height-limitH,height),Range(0,limitW))); roi3.copyTo(mask(Range(0,limitH),Range(width-limitW,width))); roi4.copyTo(mask(Range(height-limitH,height),Range(width-limitW,width))); return mask; } void StabilizationTestSimple2::init_kalman(double x, double y) { KF.statePre.at(0) = x; KF.statePre.at(1) = y; KF.statePre.at(2) = 0; KF.statePre.at(3) = 0; KF.transitionMatrix = *(Mat_(4,4) << 1,0,1,0, 0,1,0,1, 0,0,1,0, 0,0,0,1); KF.processNoiseCov = *(Mat_(4,4) << 0.2,0,0.2,0, 0,0.2,0,0.2, 0,0,0.3,0, 0,0,0,0.3); setIdentity(KF.measurementMatrix); setIdentity(KF.processNoiseCov,Scalar::all(1e-6)); setIdentity(KF.measurementNoiseCov,Scalar::all(1e-1)); setIdentity(KF.errorCovPost, Scalar::all(.1)); }  and here how i use it. I put only the interesting part. All this code is inside a flor loop. cornerPrev2 and cornerCurr2 contains all the features points detected just before (with calcOpticalFlowPyrLK())  /// Transformation Mat transformMatrix = estimateRigidTransform(cornersPrev2,cornersCurr2 ,false); // in rare cases no transform is found. We'll just use the last known good transform. if(transformMatrix.data == NULL) { last_transformationmatrix.copyTo(transformMatrix); } transformMatrix.copyTo(last_transformationmatrix); // decompose T double dx = transformMatrix.at(0,2); double dy = transformMatrix.at(1,2); double da = atan2(transformMatrix.at(1,0), transformMatrix.at(0,0)); // Accumulated frame to frame transform x += dx; y += dy; a += da; std::cout << "accumulated x,y: (" << x << "," << y << ")" << endl; if (compteur==0){ init_kalman(x,y); } else { vector smooth_feature_point; Point2f smooth_feature=kalman_predict_correct(x,y); smooth_feature_point.push_back(smooth_feature); std::cout << "smooth x,y: (" << smooth_feature.x << "," << smooth_feature.y << ")" << endl; // target - current double diff_x = smooth_feature.x - x;// double diff_y = smooth_feature.y - y; dx = dx + diff_x; dy = dy + diff_y; transformMatrix.at(0,0) = cos(da ... 2014-12-04 05:30:42 -0600 commented question Smooth point feature trajectories by Kalman Filter in Video Stabilization @Jenny , are you able to smooth the data ? What do you have in output of Kalman ? Because i would like to smooth the trajectory but there is something wrong... 2014-12-03 03:36:47 -0600 asked a question c++ - Video stabilization pipeline . I certainly missed something I'm trying to implement a video stabilization. I'm a beginner in this field, but after reviewing lots of post, i chose to do these steps: Each time, i have two frames: one current and another one, separeted by one frame. Frame 1 and 3, 3 and 5 etc. Compute goodFeaturesToTrack() Compute Optical Flow using calcOpticalFlowPyrLK() Keep only good points Compute the homography using findHomography() Wrap the frame using wrapPerspective() I certainly missed something because my video is still not stable. I searched on the internet but didn't find a solution. I also saw different posts of stackOverflow like video stabilization using opencv or Video Stabilization with OpenCV Here my code: //Read the video VideoCapture cap(path1); Mat currImg, colorImg, outImg, grayImg, backupColorImg; cap.read(colorImg); VideoUtil::geometricalCrop(colorImg,70,0);//Crop the picture cvtColor(colorImg,grayImg,CV_BGR2GRAY); currImg = grayImg.clone();// Current picture Mat refFrame; cap.read(refFrame);//Frame +1 VideoUtil::geometricalCrop(refFrame,70,0); cvtColor(refFrame,refFrame,CV_BGR2GRAY); // Frame +1 namedWindow("Stabilize"); namedWindow("GoodMatches"); Mat temp; Mat currentFrame=refFrame; for (;;){ int nbreCurrentFrame=cap.get(CV_CAP_PROP_POS_FRAMES);//Get the number of current frame cap.read(colorImg); VideoUtil::geometricalCrop(colorImg,70,0);// Crop the video Debug::trace("Current frame: " + to_string(nbreCurrentFrame)); currentFrame.copyTo(refFrame);//Get the reference frame cap.read(colorImg); VideoUtil::geometricalCrop(colorImg,70,0); cvtColor(colorImg,grayImg,CV_BGR2GRAY); currentFrame = grayImg.clone();//Get the current frame vector cornersPrevious;//Stock features of reference Frame cornersPrevious.reserve(400); vector cornersCurr;//Stock features of current frame cornersCurr.reserve(400); goodFeaturesToTrack(refFrame,cornersPrevious,400,0.01,5.0); Debug::trace("Size of feature track : " + to_string(cornersPrevious.size())); vector featureFound; // status of tracked features featureFound.reserve(400); vector featureErrors; // error in tracking featureErrors.reserve(400); calcOpticalFlowPyrLK(refFrame,currentFrame,cornersPrevious,cornersCurr,featureFound,featureErrors,Size(20,20),3, cvTermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.3),0,0.0001); // keep the good points std::vector initialPoints; std::vector trackedPoints; for (int i=0;i4 && trackedPoints.size()>4){ cv::Mat mask; cv::Mat transformMatrix = findHomography(initialPoints,trackedPoints,CV_RANSAC,3); warpPerspective(refFrame,outImg,transformMatrix,refFrame.size(), INTER_LINEAR |WARP_INVERSE_MAP,BORDER_CONSTANT ,0); namedWindow("Stabilized"); imshow("stabilizedVideo",outImg); } namedWindow("Tracking features"); imshow("tracking",finalImage); if(waitKey(27) >= 0) break; }  Thank 2014-12-02 09:32:46 -0600 commented answer video stabilization @Jenny did you solve your problem ? I had the same, maybe you can help me ? Thank 2014-12-02 09:30:54 -0600 commented answer C++ - Using Bag of Words for matching pictures together? I finally used BoW with FLANN 2014-12-02 09:29:55 -0600 commented answer C++ - Using Bag of Words for matching pictures together? I used BoW with FLANN 2014-08-20 03:01:07 -0600 asked a question C++/OpenCV - Why FLANN::index with ORB and LSH works very badly? I'm looking for a picture inside a database (1000 pictures). In order to do that, i use Bag of Features with ORB. Then, i use LSH. There is something i don't understand at all. With KD-TREE i got among my 3 nearest neighbor one good match then, the other results are very bad. I think it's because KD-TREE works very badly in highly dimentional data. Index : [47, 194, 1118] Dist : [0, 0.01984383, 0.021690277] Then when i use LSH with hamming distance, i always get the same bad results results whatever my query image. Index : [0, 1, 2] Dist : [0, 0, 0]  responseDatabase.convertTo(responseDatabase,CV_8U); cv::flann::Index flannIndex(responseDatabase,cv::flann::LshIndexParams(20,10,2), cvflann::FLANN_DIST_HAMMING); cv::Mat results, dists; int k=3; // find the 3 nearest neighbors // search (nearest neighbor) responseQuery.convertTo(responseQuery,CV_8U); flannIndex.knnSearch(responseQuery, results, dists, k, cv::flann::SearchParams() );  and  cv::flann::Index flannIndex(responseDatabase,cv::flann::KDTreeIndexParams,cvflann::FLANN_DIST_EUCLIDEAN); cv::Mat results, dists; int k=3; // find the 3 nearest neighbors // search (nearest neighbor) flannIndex.knnSearch(responseQuery, results, dists, k, cv::flann::SearchParams() );  responseQuery --> cv::Mat which contains the response histogram of the query databaseQuery --> cv::Mat which contains the response histogram of all my pictures of my database Do i miss something ? Maybe with ORB there is something i have to do besides the others things ? I precise that firstly i used SIFT and SURF with LSH and KD-TREE and i got pretty good results even if it was not perfect. Can anyone explain me why ? I really don't understand why. However i use BruteForce-Hamming as a matcher. 2014-08-20 03:00:08 -0600 commented question C++/OpenCV - How can i get my image after using flann::index? (With BoF) Yes this is what i did. Simply. But i don't know if it was the best way. Anyway thank ! 2014-08-19 05:32:18 -0600 commented question C++/OpenCV - How can i get my image after using flann::index? (With BoF) Yes i know but the responseDatabase correspond to histograms and not the picture ! I would like to display the picture corresponding to this histogram...Do you know ? 2014-08-19 05:20:12 -0600 asked a question C++/OpenCV - How can i get my image after using flann::index? (With BoF) I use BoW with SURF and FlannBasedMatcher for image retrieval inside a database. I extracted all my features of my database (Training) using SURF , then i builded the vocabulary and finally i got the BOF frequency histograms for each pictures inside my database (training). to be clear, i don't put the details of all of this process but tell me if you need some details. So at this step i have : cv::Mat allDescriptors --> descriptors of my all database (training) cv::Mat Vocabulary --> codebook representation cv::Mat responseDatabase --> frequency histograms for each pictures inside my database Then i used a query and compute its reponse according to the vocabulary computed just before. Finally i have this data : cv::Mat responseQuery --> frequency histogram of my query Now i have some difficulties. I used  cv::flann::Index flannIndex(responseDatabase, cv::flann::KDTreeIndexParams(), cvflann::FLANN_DIST_EUCLIDEAN); cv::Mat results, dists; int k=2; flannIndex.knnSearch(responseQuery, results, dists, k, cv::flann::SearchParams() );  It worked well and i got this results : cv::Mat results --> [38, 117] cv::Mat dist --> [0.0010655867, 0.013091294] But now with those results, how can i recover the two pictures corresponding to my 2 nearest neighbors ? Indeed, i don't have any trace of the pictures inside each of my data. Maybe, i missed one step but which one ? Thank 2014-08-18 05:10:09 -0600 asked a question How to build an index of a database for image retrieval ? I would like to use BoW with FLANN in order to index all my pictures inside my database.(For a CBIR project) What i did : Loop over all ma database in order to compute the descriptors of each pictures. Clustering descriptors using K-MEAN Extraction of BoWDescriptors (Visual words) in order to have a big histogram with all my features Use FLANN Index to compute an index in each pictures Code: // Create Flann LSH index cv::flann::Index flannIndex(this->descDescriptorbow, cv::flann::LshIndexParams(12, 20, 2), cvflann::FLANN_DIST_HAMMING); cv::Mat results, dists; int k=2; // find the 2 nearest neighbors // search (nearest neighbor) flannIndex.knnSearch(responseHist, results, dists, k, cv::flann::SearchParams() );  DescriptorBow contains all my BoWfeatures of my database. ResponseHist constains all my BoWfeatures of my folder which contains the test database (Some pictures to evaluate in order to find the nearest neighbor). but i got an error OpenCV Error: Bad argument (Only continuous arrays are supported) in buildIndex_, file /home/samoun/Bureau/opencv-2.4.6.1/modules/flann/src/miniflann.cpp, line 317 terminate called after throwing an instance of 'cv::Exception' what(): /home//opencv-2.4.6.1/modules/flann/src/miniflann.cpp:317: error: (-5) Only continuous arrays are supported in function buildIndex_ In order to see the structure of my cv::Mat descDescriptorbow i used  ofstream compute_info("info.txt", ios::out | ios::trunc); //responseVector = responseHist.reshape(0,1); compute_info << descDescriptorbow << std::endl; compute_info.close();  Indeed in my file.txt which contains the boWFeatures,it's not a continious array. So i don't know if if did well or i missed a step ? Maybe do you know a tutorial step-by-step because i'm a bit lost ? Can someone help me ? 2014-08-08 02:29:47 -0600 commented answer C++ - Using Bag of Words for matching pictures together? Thank for your answer. The problem is i can't use SIFT or SURF because they are patented. So i used ORB with BoW but yeah it's not good as SIFT or SURF. I get a bit confusing because some people told me that BoW is for classificatino ( i agree) but other told me that i can use for matching but i don't know how because i have more than 2000 differents pictures so it assumes that i have to have 2000 class ? 2014-07-17 07:35:07 -0600 commented answer C++ / mean of value CvSVM::predict() I understood what you told me but i follow a tutorial when they say that the code i used is for image classification with lots of classes...Therefore i'm a bit lost. I follow this trame : 1. Obtain the set of bags of features. Select a large set of images. Extract the SIFT feature points of all the images in the set and obtain the SIFT descriptor for each feature point that is extracted from each image. Cluster the set of feature descriptors for the amount of bags we defined and train the bags with clustered feature descriptors (we can use the K-Means algorithm). Obtain the visual vocabulary. Therefore it's cluster the 4 classes no ? Maybe i'm mistaken... Otherwise, how can i do a 1 vs all classifier for each class or make a classifier for each combination of 2 class please ? 2014-07-17 06:55:05 -0600 asked a question C++ / mean of value CvSVM::predict() I'm actually working on a project of logos classification using SURF + BOW + SVM. This is my first time i'm work on a kind of project and especially with SVM. So i have two folders : train and eval which contains 4 classes of differents elements.My class are distinctive because i have a class of boat,class of car,class of plane and class of animals. Train has about 255 pictures (so 255/4) Eval has about 340 pictures (so 340/4) I followed a tutorial which explain how use BoW. I think that's fine for me but i have a problem with the value of my svm.predict(). for (int i=0;i