Ask Your Question
0

Smoothing image

asked 2012-10-24 03:16:59 -0600

dhendrakusuma gravatar image

updated 2012-10-24 03:37:55 -0600

AlexanderShishkov gravatar image

Hey, I'am "newbie" about OpenCV. Can you tell me what's wrong in the code?

// SmoothingImage.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "highgui.h"
#include "cv.h"

void example(IplImage* img);

int main( int argc, char** argv)
{
    cvNamedWindow ("example4-in", CV_WINDOW_AUTOSIZE);
    cvNamedWindow ("example4-gaussian", CV_WINDOW_AUTOSIZE);
    IplImage* img = cvLoadImage("Desert.jpg");
    cvShowImage ("example4-in", img);
    IplImage* out = cvCreateImage(
        cvGetSize(img),
        IPL_DEPTH_8U, 
        3
        );
    cvSmooth(img, out, CV_GAUSSIAN, (75, 75),0);
    cvShowImage("example4-gaussian", out);
    cvReleaseImage(&out);
    cvWaitKey(0);
    cvReleaseImage(&img);
    cvDestroyWindow("example4-in");
    cvDestroyWindow("example4-gaussian");
}
edit retag flag offensive close merge delete

Comments

Do you have any troubles with this?

Daniil Osokin gravatar imageDaniil Osokin ( 2012-10-24 04:27:58 -0600 )edit

Which version of OpenCV you are using? Did it at least compiled?

icedecker gravatar imageicedecker ( 2012-10-24 04:52:25 -0600 )edit

If anyone came looking for a C++ smoothing question using OpenCV 3.0.0, maybe you can find what you need here: http://bit.ly/1tYZjsq

Rodrigo Berriel gravatar imageRodrigo Berriel ( 2014-10-27 08:56:47 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-10-24 04:36:53 -0600

icedecker gravatar image

updated 2012-10-24 04:51:42 -0600

I think that you forgot to remove the parenthesis in one of the parameters of cvSmooth (the (75,75) ). The documentation (here, about cvSmooth) says that you specifies separately the width and the height of the mask.

EDIT: I think that don't matter if you use (75,75) or 75, 75. I run your program and worked nice. Did it really found your image? Try to verify if it really loaded with a if, for example:

if(!img) printf("Could not load image file: %s\n",fileName);

. Don't forget that OpenCV is case-sensitive on the name of images (at least in linux).

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-10-24 03:16:59 -0600

Seen: 459 times

Last updated: Oct 24 '12