Ask Your Question

AlecTheLion's profile - activity

2018-01-01 04:23:19 -0500 received badge  Student (source)
2016-04-06 10:51:15 -0500 commented question OpenCV for iOS - Linking Libraries in Xcode

I am also having the same issue, does anybody know?

2016-04-06 06:48:54 -0500 commented question Framework search paths iOS build.

any ideas?

2016-04-05 10:57:59 -0500 asked a question Framework search paths iOS build.

Hi guys,

So I recently wrote an OpenCV application to apply a filter to an image. I now want to port this to iOS so I can see the performance on a mobile device. So I created a new iOS application. Changed all of the file extensions from .h to .hpp and from .m to .mm as advised. I also downloaded the opencv2.framework file so that I could add that to Link Binary with Libraries (done). I then added the search paths:

Framework Search Paths: /usr/local/lib
Header Search Paths: /usr/local/include
Library Search Paths: <path to OpenCV lib>

not sure if the last one is correct, I used the OpenCV version I was using for my command line application. I thought using the .framework file was probably wrong?

Anyway I'm not sure what to do now as I'm still getting the error:

image description

please can someone help me to understand what I need to achieve in order to correctly link the framework so I can begin using it in my mobile application.

Thank you, Alec.

2016-04-04 05:13:37 -0500 commented answer C++ Sort Array and Create Matrix

This is really amazing! thank you so much for your help.

2016-04-01 07:01:41 -0500 commented question C++ Sort Array and Create Matrix

Sorry what do you mean by this? is it fixed if I'm using Mat intensityLUT(im.rows,im.cols,CV_8UC1); as per the example below?

2016-04-01 06:33:52 -0500 received badge  Scholar (source)
2016-03-31 11:15:39 -0500 received badge  Editor (source)
2016-03-31 10:22:54 -0500 asked a question C++ Sort Array and Create Matrix

A while back I followed a tutorial (or maybe an answer from another question or something) on how to apply an oil painting filter (http://jsfiddle.net/loktar/96arS/) to an image and write it to a canvas using javascript. Now I want to achieve the same effect using openCV and C++.

I was also using: http://supercomputingblog.com/graphic... as a reference for the psuedo-code.

So far I am as far as reading the image and iterating through the pixels and finding the intensity values.

int main()
{
    Mat im = imread(...);
    Mat outline;
    Mat paint;

    int intensityLUT[im.rows][im.cols];
    int rgbLUT[im.rows][im.cols][3]; //r/g/b
    int intensity = 20;
    int radius = 3;
    int pixelIntensityValue[100];
    int pixelIntensityCount[100][4];

    for(int y = 0; y < im.rows; y++)
    {
        for (int x = 0; x < im.cols; x++)
        {
            int r = im.at<cv::Vec3b>(y,x)[0];
            int g = im.at<cv::Vec3b>(y,x)[1];
            int b = im.at<cv::Vec3b>(y,x)[2];

            intensityLUT[y][x] = round(  ((r+g+b)/3)  * intensity/255);

            rgbLUT[y][x][0] = r;
            rgbLUT[y][x][1] = g;
            rgbLUT[y][x][2] = b;

        }
    } //first itteration to get rgb values

    for(int y = 0; y < im.rows; y++)
    {
        for (int x = 0; x < im.cols; x++) //for each pixel
        {
            for(int yy = -radius; yy <= radius; yy++)
            {
                for(int xx = -radius; xx <= radius; xx++)
                {
                    if(y + yy > 0 && y+yy < im.rows && x+xx > 0 && x+xx < im.cols)
                    {
                        int intensityVal = intensityLUT[y+yy][x+xx];
                        pixelIntensityCount[intensityVal][0] ++; // priority
                        pixelIntensityCount[intensityVal][1] += rgbLUT[y+yy][x+xx][0]; //red
                        pixelIntensityCount[intensityVal][2] += rgbLUT[y+yy][x+xx][1]; //green
                        pixelIntensityCount[intensityVal][3] += rgbLUT[y+yy][x+xx][2]; //blue

                    }
             //
             //pixelIntensityCount.sort(function (a, b)
             //{
             //return b.val - a.val;
             //});

             //var curMax = pixelIntensityCount[0].val,
             //dIdx = (y*w+x) * 4;

             //destPixData[dIdx] = ~~ (pixelIntensityCount[0].r / curMax);
             //destPixData[dIdx+1] = ~~ (pixelIntensityCount[0].g / curMax);
             //destPixData[dIdx+2] = ~~ (pixelIntensityCount[0].b / curMax);
             //destPixData[dIdx+3] = 255;
        }
    }
    //imshow("Result", paint);
    waitKey();
    return 0;
}

so the part I'm stuck on is converting the array sort function and then creating a new matrix to store the image for showing / writing at the end. I think apart from that it should work? Can anyone suggest to me, the correct way to do that please?

Thanks.