Ask Your Question

Igoen's profile - activity

2020-09-24 04:43:12 -0600 received badge  Notable Question (source)
2020-06-04 21:33:43 -0600 received badge  Popular Question (source)
2016-06-01 08:43:36 -0600 received badge  Popular Question (source)
2014-05-20 14:15:18 -0600 asked a question Rotate image(mat or iplimage) with size conversion

I have image at IplImage (there is not problem to convert it to Mat). I have to rotate my image. I have image:

IplImage* mg

My method for rotate:

IplImage *rotateImage2(const IplImage *src, float angleDegrees)
    {
        // Create a map_matrix, where the left 2x2 matrix
        // is the transform and the right 2x1 is the dimensions.
        float m[6];
        CvMat M = cvMat(2, 3, CV_32F, m);
        int w = src->width;
        int h = src->height;
        float angleRadians = angleDegrees * ((float)CV_PI / 180.0f);
        m[0] = (float)(cos(angleRadians));
        m[1] = (float)(sin(angleRadians));
        m[3] = -m[1];
        m[4] = m[0];
        m[2] = w*0.5f;
        m[5] = h*0.5f;

        // Make a spare image for the result
        CvSize sizeRotated;
        sizeRotated.width = cvRound(w);
        sizeRotated.height = cvRound(h);

        // Rotate
        IplImage *imageRotated = cvCreateImage(sizeRotated,
            src->depth, src->nChannels);

        // Transform the image
        cvGetQuadrangleSubPix(src, imageRotated, &M);

        return imageRotated;
    }

But after rotate my new image have incorrect resolution. Rotation occurs in this resolution, but my new image have to take new resolution. Test image(original image - center, left image - rotated by my method, right image - rotated by system service): image description U can see, that my new image crop hat of man, and new image have bigger width. How i could rotate my image without this problem?

2014-03-09 15:41:32 -0600 commented question imread implementation file

berak, thx for answer. i sew this tutorials, and btw src really couldnt help me :( can u tell me, in whick representation the image is stored ? i loaded img in Qt Creator:

QImage image(filename);

representation(data) = 0x6ba6b6e0

And loaded with opencv imread:

Mat img_1 = imread(filename, CV_LOAD_IMAGE_COLOR);

representation(data) = 0x0000000000389810

Representation of images is different. How i can conver my QT representation to cv::Mat representation ? I have to do this cuz i dont know how is work imread. i think that link can help me http://docs.opencv.org/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.html#harris-detector and in particular http://docs.opencv.org/_images/math/4bfccbf6ce004b20fa2ece255b9d24406428c280.png

2014-03-09 04:32:34 -0600 asked a question imread implementation file

Good day! Im study opencv (SIFT and SURF methods). First of all i have to load image

Mat img_1 = imread(.....);

Where is imread implementation ? How its work ? I want to see source code of this method, cuz i cant get thing how its work without implementation. I think its "Integral view of image". But if i want to use it, i have to know how its work. Sure, im using opencv without commercial targets.