Ask Your Question

zipzit's profile - activity

2015-12-27 03:38:43 -0600 commented answer how do i configure opencv with code blocks in ubuntu

Not quite sure what is going on here. 1) Use CodeBlocks to create a new OpenCV project (which simply loads up a lena.jpg for viewing) That creates a directory. 2) go to that current directory and run cmake per your instructions. 3) Now that directory has two different .cbp files contained within. 4) Build and run = error, can't find opencv2/core/core.hpp This answer is clear as mud. Can you help? How do you configure opencv with codeblocks in ubuntu?

2015-12-21 02:12:53 -0600 commented question Odd imshow() results during debug

LoranaGdl Not sure I'm getting that... is the WaitKey() before or after the imshow() call?

2015-12-20 23:53:49 -0600 asked a question Odd imshow() results during debug

I'm trying to learn exactly how OpenCV works. Right now I'm working thru the sample programs provided with the book ("Mastering OpenCV with Practical Computer Vision Projects") Source code available (here), and here at Github.

I'm working on a fun example, Cartoonify, from "Chapter 1. Cartoonifier and Skin Changer for Android", written by Daniel Lelis Baggio. I'm just working the sample in desktop mode. The sample, updated to run on Win10, Microsoft Visual Studio 2015, and OpenCV3.0 compiled anew from github works generally well.

However, I'm unable to get the alien mode (cast to green skin color) to function at all. No errors, just no output. I'm attempting to step through the code in debugger mode. So I understand what the code is doing, I'm just not sure what is going south when I enter the following code...

I'm getting weird display failures after a simple if statement. Anybody been here before? What am I doing wrong?

void cartoonifyImage(Mat srcColor, Mat dst, bool sketchMode, bool alienMode, bool evilMode, int debugType)
{
    // Convert from BGR color to Grayscale
    Mat srcGray;
    cvtColor(srcColor, srcGray, CV_BGR2GRAY);

    // Remove the pixel noise with a good Median filter, before we start detecting edges.
    medianBlur(srcGray, srcGray, 7);

    Size size = srcColor.size();
    Mat mask = Mat(size, CV_8U);
    Mat edges = Mat(size, CV_8U);

    // Generate a nice edge mask, similar to a pencil line drawing.
    Laplacian(srcGray, edges, CV_8U, 5);
    threshold(edges, mask, 80, 255, THRESH_BINARY_INV);
    // Mobile cameras usually have lots of noise, so remove small
    // dots of black noise from the black & white edge mask.
    removePepperNoise(mask);

    if (debugType >= 2) {
        imshow("edges", edges);
        imshow("mask", mask);
    }

    // Do the bilateral filtering at a shrunken scale, since it
    // runs so slowly but doesn't need full resolution for a good effect.
    Size smallSize;
    smallSize.width = size.width/2;
    smallSize.height = size.height/2;
    Mat smallImg = Mat(smallSize, CV_8UC3);
    resize(srcColor, smallImg, smallSize, 0,0, INTER_LINEAR);

    // Perform many iterations of weak bilateral filtering, to enhance the edges
    // while blurring the flat regions, like a cartoon.
    Mat tmp = Mat(smallSize, CV_8UC3);
    int repetitions = 7;        // Repetitions for strong cartoon effect.  
    for (int i=0; i<repetitions; i++) {
        int size = 9;           // Filter size. Has a large effect on speed.
        double sigmaColor = 9;  // Filter color strength.
        double sigmaSpace = 7;  // Positional strength. Effects speed.
        bilateralFilter(smallImg, tmp, size, sigmaColor, sigmaSpace);
        bilateralFilter(tmp, smallImg, size, sigmaColor, sigmaSpace);
        //imshow("smallImg"+ std::to_string(i), smallImg);   // <--- works fine in debug mode
    }
    imshow("smallImg", smallImg);// Testing <---   Works fine in debug mode

    if (alienMode) {
        imshow("smallImg_prealien_call", smallImg);// <--- FAIL!   I get a flat gray box here?

        // Apply an "alien" filter, when given a shrunken image and the full-res edge mask.
        // Detects the color of the pixels in the middle of the image, 
        // then changes region color to green.
        changeFacialSkinColor(smallImg, edges, debugType);
    }

    // Go back to the original scale.
    resize(smallImg, srcColor, size, 0,0, INTER_LINEAR);

    // Clear the output image to black, so that the cartoon line drawings will be black (ie: not drawn).
    memset ...
(more)
2015-12-19 13:35:20 -0600 received badge  Supporter (source)
2015-12-01 02:28:06 -0600 received badge  Enthusiast
2015-11-30 06:36:50 -0600 received badge  Nice Answer (source)
2015-11-30 02:45:32 -0600 received badge  Teacher (source)
2015-11-30 02:28:06 -0600 commented question Visual Studio 2015 Compatibility Issue using OpenCV3.0

I just went thru this exercise. See http://dogfeatherdesign.com/opencv-3-... It works reasonably well with legacy openCV code. I had to do a minor mod on header file include calls.

2015-11-29 22:13:32 -0600 commented question during run time the program hangs on raspberry pi 2 at cvLabel

What does pfm signify How do you know the CPU on the raspberry PI will run as fast as 15 frames/second? I'd guess you would be around 3 to 5 fps or even less. What is the most vehicles that will be on screen at any given time? Are you using docker as your virtual machine?

2015-11-29 17:08:58 -0600 received badge  Self-Learner (source)
2015-11-29 16:54:14 -0600 received badge  Scholar (source)
2015-11-29 16:53:08 -0600 answered a question First Time User - What am I doing wrong?

I had many slight mistakes and false starts. I found some hints on this. I've sinced learned a lot about Visual Studio, about CMake and about OpenCV. Got it all working now, took me a day or two.

It turns out you have to compile the openCV library from git repository in order to be compatible with Visual Studio (VS14) 2015.

I've organized what I've learned, placed it online here in case anybody else has the same frustrations. Its pretty detailed, too much content to post here.

2015-11-27 16:22:38 -0600 received badge  Editor (source)
2015-11-27 16:20:50 -0600 asked a question First Time User - What am I doing wrong?

So I'm trying to understand how to use OpenCV. I'm using:

Heres my program, copied from this video tutorial from Kyle Hounslow entitled OpenCV (All Versions) - Easy Installation Guide and Sample Project -- VS 2010 C++

//#include<opencv\cv.h>   // couldn't get this one VideoCapture class to function with this.
#include<opencv\highgui.h>
#include <opencv2/opencv.hpp>

using namespace cv;

int main() {
    Mat image;          //Create Matrix to store image
    VideoCapture cap;          //initialize capture
    cap.open(0);
    namedWindow("window", 1);          //create window to show image
    while (1) {
        cap >> image;          //copy webcam stream to image
        imshow("window", image);          //print image to screen
        waitKey(33);          //delay 33ms
    }
    return 0;
}

The linker tools are using the libraries @ C:\opencv_3_0_0\build\x86\vc12\staticlib (Its not clear on which of the six directories I should be using, vc12 or vc11, bin, lib or staticlib. I'm looking at a whole lot of errors.

Note: I've tried using Cmake and the latest version of github's opencv library from https://github.com/Itseez/opencv . I can build both 32 debug and 32 release libraries up fine, but when I do that a whole lot of tools (which should be in the directory C:\opencv_3_0_0\build\include\opencv2) are missing. It looks like they aren't there in the github repository at all. (What's up with that?)

Anybody know how to use current tools (win10 & visual studio) to run opencv?

Note: I'm looking at qty: 500 errors, generally unresolved external symbol too many to list here...

Update: So I'm figuring out that using the pre-configured library with my version of Visual Library is out. So I'm looking again at the Cmake version I built up from the Github version. Not sure what I was thinking before, in my Cmake generated "mybuild" directory, I do see all the classes and headers I missed before. Cmake created the directories C:\opencv_git\mybuild\install\x86\vc14... and I can see the bin and lib and samples and staticlib directories there.

Unfortunately I'm seeing very few .lib files and a whole lot of .exe files Was that something I did wrong with my Cmake setup? Or perhaps a new feature of the Windows compiler tools? Are .exe files the new .lib files?

2015-11-27 00:21:48 -0600 answered a question OpenCV 3.0 Missing files

I thought this was a much better guide to creating your own: http://inside.mines.edu/~whoff/course... The link referenced above is very much outdated.

And one comment. You said you downloaded Microsoft Visual studio to use on your Win64 bit Operating system. I just tried that, but was only able to download the 32bit version of Visual Studio. That's just the way they are releasing it now. Not sure that really matters, but as I understand it, you do need 32bit compilers for that tool. Just be careful, that's all.

The two things that were odd:
finding Cmake-gui.exe, was only available on the windows version of Cmake, not the generic version. the other issue was trying to find the right CMakeLists.txt file. Normally that is contained inside the OpenCV package, but I couldn't find it in the normal download. Instead I used the download from github

That one worked with Cmake pretty well.

But I will say, for some odd reason, I'm missing some header files, its not clear why. They are all related to .c classes. I'm still working on it, but my initial guess is the Cmake missed it somehow, perhaps related to my compilers?