Ask Your Question

nicknguyen071093's profile - activity

2017-08-19 10:59:37 -0600 received badge  Popular Question (source)
2015-06-28 02:31:40 -0600 commented question Image captured by opencv is not good as normal.

I will try. Thank you so much.

2015-06-27 22:30:55 -0600 commented question Image captured by opencv is not good as normal.

But the quality image captured by VideoCapture before using imwrite, it is also like that. It is not good at the one captured by v4l2-ctl.

2015-06-27 12:54:39 -0600 asked a question Image captured by opencv is not good as normal.

I have captured two images, one by opencv Image captured by Opencv

another one by these command lines,

v4l2-ctl --set-fmt-video=width=640,height=480,pixelformat=3
v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg

Image captured by another software

As the result, image captured by opencv is not good as the remaining. The size of image captured by opencv is just 50kB and the remaining size is 110kb. Why are they different?
How can I set the setting of VideoCapture to get the good image? Please help me, thanks.

2015-05-14 10:18:53 -0600 asked a question Sign Language Recogintion

I have a project about sign language recoginition. Please show me the way to recognize a paticular hand sign (hand shape). Which algorithm has the highest accuracy? As I know, we have some algortithm such as SVM Trainning, CascadeClassifier. Please help me.

2014-11-24 10:55:41 -0600 asked a question Opencv in Raspberry pi. Error when capturing video

I have posted my problem in stackoverflow. Please read and help me. How can i resolve it.

2014-11-24 10:50:42 -0600 asked a question OpenCV in Raspberry Pi - Error when capturing video.

I have posted my problem in stackoverflow. Please read and help me. How can i resolve it.

2014-11-09 06:50:01 -0600 received badge  Editor (source)
2014-11-08 05:21:45 -0600 commented answer Opencv 3.0.0 alpha build error with library opencv_contrib

Thanks for your help!

2014-11-08 05:19:16 -0600 asked a question Face Recoginition - Process is very slow if images from camera doesn't contain face.

I have used face cascade to tracking face through webcame. And loop function is very fast if image from camera contains face. However, if not, it is very slow. Please help.

My source:

void camera() {
String face_cascade_name = "haarcascade_frontalface_alt.xml";
String eye_cascade_name = "haarcascade_eye.xml";
CascadeClassifier face_cascade;
CascadeClassifier eyes_cascade;
String window_name = "Capture - Face detection";
VideoCapture cap(0);
if (!face_cascade.load(face_cascade_name)) {
    printf("--(!)Error loading\n");
};
if (!eyes_cascade.load(eye_cascade_name)) {
    printf("--(!)Error loading\n");
};
if (!cap.isOpened()) {
    cerr << "Capture Device ID " << 0 << "cannot be opened." << endl;
} else {
    Mat frame;
    vector<Rect> faces;
    vector<Rect> eyes;
    for (;;) {
            cap.read(frame);
        Mat original = frame.clone();
        Mat frame_gray;
        cvtColor(original, frame_gray, CV_BGR2GRAY);
        equalizeHist(frame_gray, frame_gray);
        face_cascade.detectMultiScale(frame_gray, faces, 1.1, 2,
                CASCADE_FIND_BIGGEST_OBJECT | CASCADE_DO_ROUGH_SEARCH,
                Size(30, 30));
        if (faces.size() > 0) {
            rectangle(original, faces[0], Scalar(0, 0, 255), 2, 8, 0);
            Mat face = frame_gray(faces[0]);
            eyes_cascade.detectMultiScale(face, eyes, 1.1, 2,
                    0 | CASCADE_SCALE_IMAGE, Size(30, 30));
            Mat veFace = original(faces[0]);
            for (int i = 0; i < eyes.size(); i++) {
                rectangle(veFace, eyes[i], Scalar(255, 0, 255), 2, 8, 0);
            }
            namedWindow(window_name, CV_WINDOW_AUTOSIZE);
            imshow(window_name, original);
        }
        if (waitKey(30) == 27) {
            cout << "esc key is pressed by user" << endl;
            break;
        }
    }
}}

How can i produce that time, please help me.

2014-11-02 04:45:07 -0600 asked a question Opencv 3.0.0 alpha build error with library opencv_contrib

I'm developing a project about face recognition.

And i know the library for face recognition is opencv_contrib. And this is my source code.

#include "opencv2/objdetect.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/core.hpp"
#include "opencv2/contrib/contrib.hpp"
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
using namespace std;
using namespace cv;

static void read_csv(const string& filename, vector<Mat>& images,
    vector<int>& labels, char separator = ';') {
std::ifstream file(filename.c_str(), ifstream::in);
if (!file) {
    string error_message =
            "No valid input file was given, please check the given filename.";
    // CV_Error(CV_StsBadArg, error_message);
}
string line, path, classlabel;
while (getline(file, line)) {
    stringstream liness(line);
    getline(liness, path, separator);
    getline(liness, classlabel);
    if (!path.empty() && !classlabel.empty()) {
        images.push_back(imread(path, 0));
        labels.push_back(atoi(classlabel.c_str()));
    }
}}


int main() {
String face_cascade_name = "face.xml";
String csvPath = "/home/longnhkse60984/csv.ext";
String eye_cascade_name = "haarcascade_eye.xml";
CascadeClassifier face_cascade;
CascadeClassifier eyes_cascade;
String window_name = "Capture - Face detection";
vector<Mat> images;
vector<int> labels;
try {
    read_csv(csvPath, images, labels);
} catch (cv::Exception& e) {
    cerr << "Error opening file \"" << csvPath << "\". Reason: " << e.msg
            << endl;
    // nothing more we can do
    exit(1);
}
int im_width = images[0].cols;
int im_height = images[0].rows;
// Create a FaceRecognizer and train it on the given images:
Ptr<FaceRecognizer> model = createFisherFaceRecognizer();
model->train(images, labels);
//CascadeClassifier haar_cascade;
face_cascade.load(face_cascade_name);
Mat frame = imread("aaa.jpg");
Mat original = frame.clone();
vector<Rect> faces;
Mat frame_gray;

cvtColor(original, frame_gray, COLOR_BGR2GRAY);
equalizeHist(frame_gray, frame_gray);

//-- Detect faces
face_cascade.detectMultiScale(frame_gray, faces, 1.1, 2,
        CASCADE_FIND_BIGGEST_OBJECT | CASCADE_DO_ROUGH_SEARCH,
        Size(30, 30));
Mat face = frame_gray(faces[0]);
Mat face_resized;
resize(face, face_resized, Size(im_width,im_height),1.0,1.0,INTER_CUBIC);
int prediction = model->predict(face_resized);
cout << prediction;
// That's it for learning the Face Recognition model. You now
// need to create the classifier for the task of Face Detection.
// We are going to use the haar cascade you have specified in the
// command line arguments:
//
waitKey(0);
return 0;}

When i build this i have received errors of opencv_contrib. Please help me.

Opencv_contrib Error

2014-11-02 04:23:51 -0600 commented question Don't see library opencv_contrib in opencv 3.0.0-alpha

i don't understand clearly. i'm looking for the facerecoginition, what i must download and install. please, help.

2014-11-02 00:48:38 -0600 commented answer Don't see library opencv_contrib in opencv 3.0.0-alpha

Thank you, can you help me how to install it and how to tell ubuntu where lib. :)

2014-11-01 23:39:38 -0600 asked a question Don't see library opencv_contrib in opencv 3.0.0-alpha

I have installed opencv 3.0.0 follow this site Install opencv 3.0.0 on ubuntu.

After that, everything is good except library opencv_contrib, i don't see it in folder "usr/local/lib" of ubuntu. Library folder

So i find it folder "modules" in folder "build" of opencv 3.0.0 and i still don't see it.

Modules folder

And folder "lib" in folder "build"

Library folder

Error when i built my project with opencv_contrib

image description