Ask Your Question

D. Sanz's profile - activity

2016-06-16 07:09:33 -0500 received badge  Enthusiast
2016-06-12 11:21:32 -0500 asked a question Documentatio for neural networks in OpencV 3.0 +

Hello, OpenCV forums. I've been looking for documentation and/or plain examples of using the Machine Learning libraries of OpenC 3.1.0, but most of what I've found is 2.4 related and the names of things have changed a little bit, so I've had a hard time translating it from one version to the other. Where could I find more information on the subject?

2016-04-14 09:13:57 -0500 commented answer Trying to do some basic operations with images, code keeps crashing and I don't know why.

Oh, another thing. If I create a ROI of a certain size, why can I access values of said Mat element that are supposedly outside of my original intended scale?

2016-04-14 08:35:47 -0500 commented answer Trying to do some basic operations with images, code keeps crashing and I don't know why.

Thank you, I can't believe I had missed that part. Thanks for the part about ROIs. I think they're a much better solution.

2016-04-14 08:34:01 -0500 received badge  Scholar (source)
2016-04-14 08:33:52 -0500 received badge  Supporter (source)
2016-04-14 01:01:09 -0500 asked a question Trying to do some basic operations with images, code keeps crashing and I don't know why.

Hello. I'll start by saying that I'm just now starting to learn to use OpenCV libraries and I never was an expert on C++.

I want to create a smaller Mat element out of an image and do some simple processing to it. So I created a simple function with iterations to introduce elements of the original image in a 3x3 Mat element and return it, but the code keeps crashing, even when I don't crate a function, but use it outside. I haven't been able to identify a cause. I'd appreciate help making it clear to me as to why it doesn't work. Thanks beforehand, here's my very simple piece of code:

    #include <opencv2\opencv.hpp>

using namespace cv;
using namespace std;

cv::Mat Sort3x3(cv::Mat source, int y, int x) {
    int i=0, j=0;
    cv::Mat Wind9;
    Wind9 = (3,3,CV_8UC1, (0));


    while (i<2){
        j=0;
        while (j<2){
            Wind9.at<uchar>(i,j) = source.at<uchar>(y-1+i,x-1+j);
            j=j+1;
        }
        i = i+1;
    }

    return(Wind9);
}


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

    Mat Source = imread("saltpepper1.png", IMREAD_GRAYSCALE);
    cv::Mat Wind9;
    int i=40,j=40; //Some random test numbers for a position in the image
    Wind9 = Sort3x3(Source, i, j);






       waitKey(0);

}