Ask Your Question

kimchiboy03's profile - activity

2020-10-27 13:33:04 -0600 received badge  Notable Question (source)
2019-07-21 01:39:48 -0600 received badge  Popular Question (source)
2019-05-08 06:07:38 -0600 received badge  Notable Question (source)
2018-11-28 21:16:08 -0600 received badge  Popular Question (source)
2017-12-20 14:58:03 -0600 received badge  Self-Learner (source)
2017-12-20 14:39:55 -0600 edited answer Making Object Detection Faster

Thanks to @dkurt my fps went up to 5fps. Which is reasonable for my application. Firstly, I used MobileNet-SSD which ma

2017-12-20 14:38:23 -0600 edited answer Making Object Detection Faster

Thanks to @dkurt my fps went up to 5fps. Which is reasonable for my application. Firstly, I used MobileNet-SSD which ma

2017-12-20 14:37:16 -0600 answered a question Making Object Detection Faster

Thanks to @dkurt my fps went up to 5fps. Which is reasonable for my application. Firstly, I used MobileNet-SSD which ma

2017-12-18 13:50:28 -0600 commented question Making Object Detection Faster

@dkurt Yes, the MobileNet-SSD seems to be faster with a fps of 1.8 To make it faster, would installing opencv 3.3.1 and

2017-12-18 13:35:13 -0600 commented question Making Object Detection Faster

@dkurt So does the type of prototxt and caffe model I use affect the speed and accuracy? And I'll try out the MobileNet-

2017-12-18 03:26:55 -0600 asked a question Making Object Detection Faster

Making Object Detection Faster Hello, I am currently trying out the deep neural network in OpenCV 3.3.0 I am currently

2017-12-16 19:34:43 -0600 commented question Using the dnn sample from github

@sturkmen Why? (By the way, thank you for your reply!)

2017-12-16 18:04:46 -0600 asked a question Using the dnn sample from github

Using the dnn sample from github Hello, I am currently using opencv 3.3.0 However, I cannot get this yolo object detect

2017-12-11 05:58:24 -0600 marked best answer Augmented Reality on Google Cardboard

Hello, I am currently trying to make google cardboard do augmented reality. However, I will have to make the image displayed on the screen like the following: https://www.androidcentral.com/sites/...

Is it possible to use the OpenCV functions to duplicate two images like the image above? Sorry, if my questions isn't clear (tell me if it is unclear, I will edit my question).

Thanks in advance.

2017-12-10 19:53:13 -0600 commented question Augmented Reality on Google Cardboard

Nevermind, this answer solved my problem! http://answers.opencv.org/question/86605/barrel-distorsion-for-google-cardboar

2017-12-10 19:03:04 -0600 commented question Augmented Reality on Google Cardboard

@StevenPuttemans I'm actually thinking about using OpenGL with OpenCV as someone did in this video: https://www.youtube.

2017-12-09 21:34:37 -0600 commented question Augmented Reality on Google Cardboard

@StevenPuttemans Oh... That's sad.... Thanks for your reply though!

2017-12-08 16:45:48 -0600 commented question Augmented Reality on Google Cardboard

@StevenPuttemans So basically I am trying to duplicate an image which is placed side by side (like the image in the link

2017-12-08 00:19:17 -0600 asked a question Augmented Reality on Google Cardboard

Augmented Reality on Google Cardboard Hello, I am currently trying to make google cardboard do augmented reality. Howeve

2017-10-08 02:57:00 -0600 marked best answer Problems with Augmented Reality

Hello, I am trying to create a program which uses augmented reality. However, I am currently stuck on drawing the object. This is my code so far:

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"

using namespace std;
using namespace cv;

Mat camMat;
Mat distortion;

//Initializes augmented reality
void initAR()
{
    FileStorage fs("out_camera_data.xml", FileStorage::READ);

    fs["Camera_Matrix"] >> camMat;
    fs["Distortion_Coefficients"] >> distortion;
}

//Load 3d model
void loadModel(vector<Mat> squares, Mat colorImg)
{
    vector<Point3f> objectPt = { Point3f(-1, -1, 0), Point3f(-1, 1, 0), Point3f(1, 1, 0), Point3f(1, -1, 0) };
    Mat objectMat(objectPt);

    Mat rvec;
    Mat tvec;
    solvePnP(objectMat, squares[0], camMat, distortion, rvec, tvec);

    vector<Point3f> line3d[4];
    line3d[0] = { { 1, 1, 0 }, { 1, 0, 0 }, { 0, 0, 0 } };
    //line3d[1] = { { -1, 0, 0 },{ 1, 0, 1 } };
    //line3d[2] = { { 1, 0, 0 },{ -1, 0, 1 } };
    //line3d[3] = { { 1, 0, 0 },{ 1, 0, 1 } };

    vector<Point2f> line2d[4];
    projectPoints(line3d[0], rvec, tvec, camMat, distortion, line2d[0]);

    polylines(colorImg, line2d[0][0], true, Scalar(255, 0, 0), 2);
}

//Displays 3d object
void doAR(Mat colorImg)
{
    Mat bwImg;
    Mat blurImg;
    Mat threshImg;
    vector<vector<Point> > cnts;

    if (!colorImg.empty())
    {
        cvtColor(colorImg, bwImg, CV_BGR2GRAY);
        blur(bwImg, blurImg, Size(5, 5));
        threshold(blurImg, threshImg, 128.0, 255.0, THRESH_OTSU);
        findContours(threshImg, cnts, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);

        vector<Mat> squares;
        for (auto contour : cnts)
        {
            vector<Point> approx;
            approxPolyDP(contour, approx, arcLength(Mat(contour), true)*0.02, true);
            if (approx.size() == 4 && fabs(contourArea(Mat(approx))) > 1000 && isContourConvex(Mat(approx)))
            {
                Mat square;
                Mat(approx).convertTo(square, CV_32FC3);
                squares.push_back(square);
            }
        }

        if (squares.size() > 0)
        {
            loadModel(squares, colorImg);
        }

        cvNamedWindow("AR", 0);
        cvSetWindowProperty("AR", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
        imshow("AR", colorImg);
        waitKey(1);
    }
}

I am trying to draw a triangle with the points in line3d. Can someone please tell me why this isn't drawing? If anyone needs to see more of my code, I will post more on my answer.

Thanks in advance.

2017-10-08 02:56:57 -0600 commented answer Problems with Augmented Reality

Thank you. My programs seems to work now. Thanks once again.

2017-10-08 02:45:53 -0600 commented answer Problems with Augmented Reality

I'm currently struggling to integrate this into my code. Firstly, I cannot convert vector<point2f> to vector<ve

2017-10-08 01:56:56 -0600 received badge  Editor (source)
2017-10-08 01:56:56 -0600 edited question Problems with Augmented Reality

Problems with Augmented Reality Hello, I am trying to create a program which uses augmented reality. However, I am curre

2017-10-08 01:55:26 -0600 commented question Problems with Augmented Reality

@berak That's just part of my code. I'll post more of my code.

2017-10-08 00:38:18 -0600 asked a question Problems with Augmented Reality

Problems with Augmented Reality Hello, I am trying to create a program which uses augmented reality. However, I am curre

2017-10-08 00:30:19 -0600 commented answer Using multithreading in opencv

Thank you. I just realised I didn't really need to use threads.

2017-10-08 00:29:50 -0600 marked best answer Using multithreading in opencv

Hello, I am currently trying to use multithreading in opencv. However, this code is not working.

#include <iostream>
#include <thread>

#include "opencv2/nonfree/features2d.hpp"

#include "FeatureMatching.h"
#include "FaceDetection.h"
#include "AugmentedReality.h"

Mat colorImg;
VideoCapture capture(0);

//Captures image from camera
void doCapture(VideoCapture capture)
{
    while (true)
    {
        capture.read(colorImg);
        imshow("HUD", colorImg);
        cvWaitKey(1);
    }
}

//Deicides what to do
void doDecision()
{
    while (true)
    {
        int k = waitKey(1);
        if (k == 49)
        {
            cout << "Detecting..." << endl;
            doMatch(colorImg);
        }
        else if (k == 50)
        {
            cout << "Detecting..." << endl;
            doDetect(colorImg);
        }
        else if (k == 51)
        {
            cout << "Displaying..." << endl;
            while (waitKey(1) != 51)
            {
                doAR(capture);
            }
        }
        else if (k == 27)
        {
            cout << "Stop";
        }
    }
}

//Main function
int main()
{
    thread t1(doCapture, capture);
    thread t2(doDecision);

    //cvNamedWindow("HUD", 0);
    //cvSetWindowProperty("HUD", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);

    initMatch();
    initFace();
    initAR();

    t1.join();
    t2.join();
}

If anyone needs to see more of my code, I'll will do so. Can someone please tell what's the problem? Thanks in advance.

2017-10-07 13:37:59 -0600 received badge  Enthusiast
2017-10-06 02:38:08 -0600 commented question Using multithreading in opencv

@berak When I debugged this code, I saw that in the doDecision() method, the waitKey() was not able to pick up the keybo

2017-10-06 02:30:45 -0600 commented question Using multithreading in opencv

@berak Oops, I have removed that bit of the code

2017-10-06 01:00:01 -0600 commented question Using multithreading in opencv

@berak So, I am trying to display a live video from a camera which is then displayed onto a cvNamedWindow(). While this

2017-10-06 00:52:47 -0600 commented question Using multithreading in opencv

@berak However, the imshow still works. I can still see the camera output. It's just that the methods in the doDecision(

2017-10-06 00:52:34 -0600 commented question Using multithreading in opencv

However, the imshow still works. I can still see the camera output. It's just that the methods in the doDecision() metho

2017-10-06 00:17:48 -0600 asked a question Using multithreading in opencv

Using multithreading in opencv Hello, I am currently trying to use multithreading in opencv. However, this code is not w

2017-07-01 14:23:18 -0600 received badge  Scholar (source)
2017-07-01 14:18:24 -0600 commented question convert opencv code(c++) code to c

Please post the code.

2017-06-30 04:54:19 -0600 asked a question Making Positive Samples Quickly

Hello everyone,

I am currently trying to make my own haar cascade for detecting fishes. So far, I have collected 65 positive samples. However, this took me a very long time.

So I was wondering if there was any fast way to get over 1000 positive samples (as I have noted that this was the recommended number of samples)?

Thanks.

2017-06-20 00:00:57 -0600 commented answer Speeding up my code for object recognition

Haha thank you for your post... However, I have decided to use the haar classifier method instead (and making my own .xml files) for object detection since you say its abusing the system. Thank you though :)

2017-06-19 02:45:30 -0600 commented question Speeding up my code for object recognition

However, on YouTube, I have seen people who has succeeded multiple object detection and their program is quite smooth...

2017-06-19 02:45:28 -0600 commented question Speeding up my code for object recognition

what do you mean?

2017-06-19 02:16:17 -0600 asked a question Speeding up my code for object recognition

I am working on a multi-object recognition program. I have succeeded recognising two objects. However, the speed of my program is really slow and laggy. Can somebody please tell a way to speed the program up?

So far, I have seen that ORB is quite fast at matching features. However, my program is still too slow. I have also noticed that there are three for loops, possibly making the program slow down. Interestingly on YouTube, I have seen videos where the output is really smooth.

Is there a way to fix this? Thanks.

This is my code:

#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"

using namespace std;
using namespace cv;

FlannBasedMatcher matcher(new flann::LshIndexParams(20, 10, 2));

void ttea(vector<KeyPoint> bwImgKP, Mat objectDS, Mat bwImgDS, vector<KeyPoint> objectKP, vector<Point2f> objectCRN, Mat colorImg, string text)
{
    vector<vector<DMatch>> matches;
    vector<DMatch> matchesGD;
    vector<Point2f> obj;
    vector<Point2f> scene;
    vector<Point2f> sceneCRN(4);
    Mat H;

    if (bwImgKP.empty() || objectDS.empty() || bwImgDS.empty())
    {
        return;
    }

    matcher.knnMatch(objectDS, bwImgDS, matches, 2);

    for (int i = 0; i < min(bwImgDS.rows - 1, (int)matches.size()); i++)
    {
        if ((matches[i][0].distance < 0.6*(matches[i][1].distance)) && ((int)matches[i].size() <= 2 && (int)matches[i].size() > 0))
        {
            matchesGD.push_back(matches[i][0]);
        }
    }

    if (matchesGD.size() >= 4)
    {
        for (int i = 0; i < matchesGD.size(); i++)
        {
            obj.push_back(objectKP[matchesGD[i].queryIdx].pt);
            scene.push_back(bwImgKP[matchesGD[i].trainIdx].pt);
        }

        H = findHomography(obj, scene, CV_RANSAC);

        perspectiveTransform(objectCRN, sceneCRN, H);

        line(colorImg, sceneCRN[0], sceneCRN[1], Scalar(255, 0, 0), 4);
        line(colorImg, sceneCRN[1], sceneCRN[2], Scalar(255, 0, 0), 4);
        line(colorImg, sceneCRN[2], sceneCRN[3], Scalar(255, 0, 0), 4);
        line(colorImg, sceneCRN[3], sceneCRN[0], Scalar(255, 0, 0), 4);
        putText(colorImg, text, sceneCRN[1], FONT_HERSHEY_DUPLEX, 1, Scalar(0, 0, 255), 1, 8);
    }
}

int main()
{
    OrbFeatureDetector detector;
    OrbDescriptorExtractor extractor;

    VideoCapture capture(0);

    Mat object0 = imread("Much Ado About Nothing.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    vector<KeyPoint> object0KP;
    detector.detect(object0, object0KP);

    Mat object0DS;
    extractor.compute(object0, object0KP, object0DS);

    vector<Point2f> object0CRN(4);
    object0CRN[0] = (cvPoint(0, 0));
    object0CRN[1] = (cvPoint(object0.cols, 0));
    object0CRN[2] = (cvPoint(object0.cols, object0.rows));
    object0CRN[3] = (cvPoint(0, object0.rows));

    Mat object1 = imread("Popular Science.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    vector<KeyPoint> object1KP;
    detector.detect(object1, object1KP);

    Mat object1DS;
    extractor.compute(object1, object1KP, object1DS);

    vector<Point2f> object1CRN(4);
    object1CRN[0] = (cvPoint(0, 0));
    object1CRN[1] = (cvPoint(object1.cols, 0));
    object1CRN[2] = (cvPoint(object1.cols, object1.rows));
    object1CRN[3] = (cvPoint(0, object1.rows));

    while (true)
    {
        Mat bwImg;
        Mat bwImgDS;
        vector<KeyPoint> bwImgKP;

        Mat colorImg;
        capture.read(colorImg);

        cvtColor(colorImg, bwImg, CV_BGR2GRAY);

        detector.detect(bwImg, bwImgKP);
        extractor.compute(bwImg, bwImgKP, bwImgDS);

        ttea(bwImgKP, object0DS, bwImgDS, object0KP, object0CRN, colorImg, "Play");
        ttea(bwImgKP, object1DS, bwImgDS, object1KP, object1CRN, colorImg, "Magazine");

        imshow("Fish Smart", colorImg);

        if (waitKey(1) == 27)
        {
            return 0;
        }
    }
}