Ask Your Question

keghn's profile - activity

2017-02-05 10:00:52 -0500 answered a question Identifying animals using a raspicam?
2016-06-01 16:25:08 -0500 commented question How to save a video in mp4 format

Try CV_FOURCC('A','V','C','1'). I youtube-dl downloaded a video in the mp4 format and then ran it through a identification program and it it came back A V C 1.

Sixteen line down:

Down load command: youtube-dl -o destiny.mp4 -f 18

2016-05-29 10:45:29 -0500 commented answer Any code examples in C++ for outdoor object detection using Neuronal Network or pattern recognition with Visual Camera?

Ya, That is what i got with the GPU setting OFF.

2016-05-29 08:53:31 -0500 answered a question Any code examples in C++ for outdoor object detection using Neuronal Network or pattern recognition with Visual Camera?

Installing Darknet tested this on Linux and Mac computers:

Convolution Neural Network Step.1 code Raspberry pi:

2016-01-02 08:02:37 -0500 received badge  Supporter (source)
2015-11-24 23:45:10 -0500 commented question Attribute Extraction - SIFT - SURF - BRIEF

The name of the file that has the detected feature. The location in the image where the detection happened. The algorithm that detected it. Format of the data base that hold detected features.

2015-11-20 08:45:19 -0500 received badge  Enthusiast
2014-02-06 15:14:32 -0500 commented question imshow() and waitKey()

I used wait(1); sleep(3); image stayed around for 3 sec.

2014-02-04 15:34:40 -0500 commented question Cannot read a 10-bit, 3-channel encoded video file as 10-bit

What about using:


It is 16 bits big or 6 bit bigger than 10, and it is 3 channels.

2014-02-04 15:18:06 -0500 commented question Image processing project with an error I can not solve

Yes. But sense I am new to OpenCV I am stopping and dwelling on all of interesting little detail I come across. Am is seeing three gray scale for each mono colored image? Or one gray scale image for each mono colored picture?

2014-02-02 16:23:39 -0500 commented answer How to detect scratches in wood

Thank you Goosebumps Sure any info wold be great.

2014-02-01 14:34:28 -0500 commented question Image processing project with an error I can not solve

Maybe part c) would be more like take one of the mono colored images say the green mat, and then for each green pixel change it over to grey scale pixel. Then move it on to a new image at the same, intensity, and location. Then hit that gray pixel with an optional constant. Then do the same for blue and red mono colored images?

2014-01-31 18:06:04 -0500 commented question How to take a photo then say its color ?

Hi, You wand to detect the color of the file or real time video image, under cross hairs, and have audio output of the color, in audio, for some one color blind?

2014-01-31 17:58:11 -0500 commented question Image processing project with an error I can not solve

Hello residentelvio

So you are taking an image: a) make a copy of, blue, copy green, and red, from the original image.

b) turn all the single color images to a gray scale.

c) get and average gray scale for all gray scale images.

Am i close?

2014-01-31 16:32:08 -0500 commented question Installing OpenCV easily by YouTube video

On Linux, I would just down load the tar of other software companies, than at the terminal then type in "./configue&&make&&sudo make install" and then go live happily ever after.

This year is the first time i am using OpenCV. They have a Cmake install. Cmake has A 99% fail rate across on all other software i tried over over 5 distros of Ubuntu and Mint over the past 5 years. More company are using it lately and I found out how to use it by accidently while doing a google search for something else. A direct Google search did not fine anything useful.

It is very nice that OpneCV put the install instructions on their web site, few software companies do.

It is a noobe killer.

Cmake was not a clean install on my machine

2014-01-31 15:44:54 -0500 answered a question opencv2 crash on Linux ubuntu 3.8.0-29


cv::Mat src = cv::Imread("filepath.jpg",CV_LOAD_IMAGE_COLOR);


cv::Mat src = cv::Imread("/home/you/pictures/filepath.jpg",CV_LOAD_IMAGE_COLOR);

2014-01-30 12:31:07 -0500 answered a question How to detect scratches in wood

selvaline said:

Thank you for the reply Keghn. Has this solution got a name or it's a filtering technique invented by you? It's a kind of mean-filtering without the division by the number of box's pixels, or am I wrong? selvaline (Jan 28 '14)

I do allot of research in this area and developed this process in the year of 2013 and have not coined a name for it yet.

2014-01-29 18:57:24 -0500 answered a question how to use imshow in class member?


#include <opencv/cv.h>

#include <opencv/highgui.h>

#include <cmath>

#include <iostream>

using namespace cv;

using namespace std;

int main()

          Mat M = imread("scenetext03.jpg",CV_LOAD_IMAGE_COLOR);
          double MAX_blue = 0.0;
          double MAX_green = 0.0;
          double MAX_red = 0.0;

cout << "M.rows " << M.rows << "\n"; cout << "M.cols " << M.cols << "\n";

          for (unsigned int i = 0; i < M.rows; i++)

              for (int unsigned j = 0; j < M.cols; j++)
                  Vec3b data =<Vec3b>(i, j);
                  if (abs(data.val[0]) > MAX_blue) MAX_blue = pow(abs(data.val[0]), 2);
                  if (abs(data.val[1]) > MAX_green) MAX_green = pow(abs(data.val[1]), 2);
                  if (abs(data.val[2]) > MAX_red) MAX_red = pow(abs(data.val[2]), 2);

          for (int i = 0; i < M.rows; i++)
                  for (int j = 0; j < M.cols; j++)
                <Vec3b>(i,j)[0] = pow(abs(<Vec3b>(i,j)[0]), 2) / MAX_blue * 255;
                <Vec3b>(i,j)[1] = pow(abs(<Vec3b>(i,j)[1]), 2) / MAX_blue * 255;
                <Vec3b>(i,j)[2] = pow(abs(<Vec3b>(i,j)[2]), 2) / MAX_green * 255;

          namedWindow("Intensity", WINDOW_AUTOSIZE);
          imshow("Intensity", M);


          destroyAllWindows(); //destroy all open windows

  return 0;
2014-01-29 13:49:29 -0500 commented question how to use imshow in class member?

Do you want color?

2014-01-28 18:32:47 -0500 answered a question How to detect scratches in wood

Hello selvaline.

I am using support vector machines classes:

I am classifying data by the texture in the box as a class and when the texture changes it will be seen as another class.

If you want to, the distance between each of the class you but a dot on another empty image. it should build up an out line of all the shades and objects, and then get the length of the line for matching to other captured out lines.

The add up in the box was to lower the resolution of the texture for pattern capture.

I am new to OpenCV and do not know all the trick they have to offer yet.

But I am glad their are other help you.



2014-01-27 15:23:21 -0500 answered a question How to detect scratches in wood


Assuming that this image is 1000x1000 pixels and is

using gray scale or black and white, and is one channel.

Have a box scan the image. Say 10 pixel by 10 pixels. All of the pixel values, inside the box are added up into a box value and saved with location x, y.

Comparing the box value with one another for the one that has the lowest box value, assuming that the scratches will be lighter and will cause a lower box value.

The box size may be too big or small and my need to adjusted, too small it will pick up the grains, too big it will pick up the glare. You might have to do the the scan up and down and left to right.

You can move the box one pixel at time for accuracy or 10 pixels for fast scan.

Lots of luck,


2014-01-27 14:45:55 -0500 answered a question video reading

g++ p.cpp -o p `pkg-config --cflags --libs opencv`

#include <stdio.h>

#include <opencv/cv.h>

#include <opencv/highgui.h>

#include <math.h>

#include <iostream>

using namespace cv;

using namespace std;

int main(int argc, char* argv[]) {

VideoCapture cap("test.avi"); // open the video file for reading

IplImage* img =0;



    Mat frame;

// img = cvQueryFrame(frame);

bool img =; if(!img) break;





return 0;


2014-01-27 13:18:57 -0500 commented question problems with cvCalcOpticalFlowFarneback and intrusion detection

I am new to OpenCV and do not know more complicated code that OpenCV has.

Could you put few of these in your code to see where it cwap out at:

printf("made it to here 1 to 10\n");

Good hunting

2014-01-26 18:26:48 -0500 commented question Help to Open Video File

The video works on my computer but I get no sound. I am using Mint 14 mate 64 bit .

I compile the program from the terminal.

ffmpeg is a sound library software but is this program suppose to play sound too?

2014-01-25 14:52:15 -0500 answered a question Double* from cv::Mat.ptr

CV_64FC1 give you only one channel 0.

CV_64FC2 will give you channel 0 and 1


fastJx[1] = 255;

is accessing a channel that does not exist.

Could be wrong, keghn

2014-01-24 18:26:19 -0500 answered a question process specific pixels from an image
Vec3b intensity =<Vec3b>(y, x);
blue = intensity.val[0];
green = intensity.val[1];
intensity.val[2] = 128;//ya, I can write to the image this way
red = intensity.val[2];
2014-01-23 19:03:06 -0500 answered a question process specific pixels from an image


I am new to OpenCV. I was thinking my be you could hit the pixels you want with this program:




using namespace cv;
using namespace std;

int main()
    Mat img = imread("red.jpg",CV_LOAD_IMAGE_COLOR);

    unsigned char *input = (unsigned char*)(;
    unsigned int i,j,r,g,b;
    unsigned int r_Old,g_Old,b_Old;
    unsigned int r_average,g_average,b_average;
    uchar blue, green, red;
// dead center image read of a pixels of my image.jpg

   unsigned int y, x;

    y = 300;
    x = 300;
    Vec3b intensity =<Vec3b>(y, x);

//The same method can be used to change pixel intensities:<uchar>(y, x) = 128;
//have not written to image yet.

    blue = intensity.val[0];
    green = intensity.val[1];
    red = intensity.val[2];

    b_Old = blue;
    g_Old = green;
    r_Old = red;

    cout << "\n";
    cout << "b_Old " << b_Old << "\n";
    cout << "g__Old " << g_Old << "\n";
    cout << "r__Old " << r_Old << "\n";

        b_average = b_Old;
        g_average = g_Old;
        r_average = r_Old;

// i scaned the whole screen and averaged for an average color value:

    for( y = 0;y < img.rows;y++)
    for( x = 0;x < img.cols;x++)

    Vec3b intensity =<Vec3b>(y, x);
    blue = intensity.val[0];
    green = intensity.val[1];
    red = intensity.val[2];

            b_average = b_average + blue;
            g_average = g_average + green;
            r_average = r_average + red;


    cout << "\n";

    b_average = b_average/(img.rows * img.cols);
    g_average = g_average/(img.rows * img.cols);
    r_average = r_average/(img.rows * img.cols);

    cout << "b_average " << b_average << "\n";
    cout << "g_average " << g_average << "\n";
    cout << "r_average " << r_average << "\n";
    cout << "img.rows " << img.rows << "\n";
    cout << "img.cols " << img.cols << "\n";

    return 0;

g++ -ggdb `pkg-config --cflags opencv` -o `basename p.cpp .cpp` p.cpp `pkg-config --libs opencv`

g++ p.cpp -o p `pkg-config --cflags --libs opencv`

Worked on Mint Linux 14 in the terminal.


2014-01-23 12:42:13 -0500 answered a question OpenCV 2.4.8 cannot load cascade

Hello. Where is the code or link to its location?

Is there any error output you can post?

2014-01-18 18:45:22 -0500 received badge  Editor (source)
2014-01-18 18:43:47 -0500 answered a question Ubuntu 12.04 64 bit gcc linking problem with static openCV libraries


g++ pro.cpp -lopencv_calib3d -lopencv_imgproc -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_features2d -lopencv_objdetect -lopencv_flann -lopencv_video -lopencv_highgui -o pro

It was a BBBBEEEEEiiiiiiiCCCCHHHHH installing then is was a nightmare compiling code. cmake install cmake to compile code. Cmake dose not work that well!!!!!!!!!!!!!!!!!!!!!!!!!!! for anything!!!!!

I use this to compile my code:

    "g++ p.cpp -o p `pkg-config --cflags --libs opencv`"

This web site help allot:

Could not find my .bash_profile so I just type the each line into the terminal:



I run it with:


or if i am to supply an image:

./pro butterfly.jpg

#include <opencv2/objdetect/objdetect.hpp>

#include <opencv2/highgui/highgui.hpp>

#include <opencv2/imgproc/imgproc.hpp>

#include <opencv/highgui.h>

#include <ostream>

#include <stdio.h>

#include <stdlib.h>

using namespace cv;

using namespace std;

In old code i replace includes with the above and it work fine and as well with the new stuff.

Good luck,