LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   mean filter (https://www.linuxquestions.org/questions/programming-9/mean-filter-823181/)

mukhram 07-31-2010 05:04 AM

mean filter
 
hi,

i am new to linux mint. I am doing project on image quality. how to implement mean filter on images using openCV. Please do the needful.

Thanks

pixellany 07-31-2010 06:34 AM

Welcome to LQ!!

What is a "mean filter"?

What is "OpenCV"?

Have you tried GIMP? If GIMP does not do what you need, you can also search for GIMP plugins.

Aquarius_Girl 07-31-2010 06:53 AM

Quote:

Originally Posted by mukhram (Post 4050773)
hi,
how to implement mean filter on images using openCV.

I just Googled this "mean filter on images using openCV"
Have a look below, see if it helps you somehow:

See the last paragraph of this link:
http://www.cs.auckland.ac.nz/~tobi/openCV-Examples.html

http://www.seas.upenn.edu/~bensapp/o...mgproc_filters

mukhram 08-03-2010 03:24 PM

Thank you very much giving me information but I am doing mean(average) filter on images in 'c'. could u pls tell me how to implement it.

Thanks.

John VV 08-03-2010 07:49 PM

mukhram

just so you know " we will not do your homework "

by 'mean" do you mean
px value ?
mean or median ?
color or b&w tone?
as a "box car" ?

what !!!

what examples HAVE YOU looked at ?
what is it you DO want to do ?
and what is it you DO NOT want to do ?

mukhram 08-05-2010 01:01 PM

Hello Friends,

Could u pls help me in how to read and write images in 'C'.

Thanks and Regards.

John VV 08-05-2010 01:54 PM

help?
pointers yes
here is a link to a very nice and small bit of code that dose A BUNCH of things
http://cimg.sourceforge.net/
and the tutorials
http://cimg.sourceforge.net/referenc..._tutorial.html
and examples -- part of the tutorials
http://cimg.sourceforge.net/screenshots.shtml

-------- but for "OpenCV"---
read there docs
http://opencv.willowgarage.com/wiki/
http://opencv.willowgarage.com/docum...cpp/index.html

-- and buy there BOOK ---
http://www.amazon.com/Learning-OpenC.../dp/0596516134

mukhram 08-05-2010 03:09 PM

i tried to execute a program to read and write images, but its showing errors. Please help me to rectify the error.


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


int main( int argc, char** argv )
{
char* filename = argc == 2 ? argv[1] : (char*)"example2.jpeg";

if( (image = cvLoadImage( filename, 1)) == 0 )
return -1;
cvNamedWindow(wndname, 1);
cvShowImage(wndname, image);
cvWaitKey(0);
cvReleaseImage(&image);
cvDestroyWindow(wndname);

return 0;

}

John VV 08-05-2010 03:18 PM

Quote:

but its showing errors
what errors ?
please post the errors .

mukhram 08-05-2010 03:32 PM

Errors:

/home/moiz/Desktop/example4/example4.cxx: In function ‘int main(int, char**)’:
/home/moiz/Desktop/example4/example4.cxx:14: error: ‘image’ was not declared in this scope
/home/moiz/Desktop/example4/example4.cxx:16: error: ‘wndname’ was not declared in this scope
/home/moiz/Desktop/example4/example4.cxx:17: error: ‘image’ was not declared in this scope
make[2]: *** [CMakeFiles/example4.dir/example4.o] Error 1
make[1]: *** [CMakeFiles/example4.dir/all] Error 2
make: *** [all] Error 2

John VV 08-05-2010 04:50 PM

please also post the full build command that is giving you the error

i take it you are not doing this
gcc -o example4 example4.cxx
also WHERE did you git this "example"
a url would be nice

mukhram 08-11-2010 05:09 AM

Hi,

i wrote the code to read and write images using OpenCV. the code is compiled with no errors. but when i tried to execute it, i got error. Please help me.
here is the code:

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>
#include <cxcore.h>
#include <cxtypes.h>

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

IplImage* img=0;
img=cvLoadImage("images.jpeg",3);
if(img) printf("Could not load image file: %s\n","images.jpeg");

if(!cvSaveImage("im.jpeg",img)) printf("Could not save: %s\n","im.jpeg");
}


error is:

OpenCV Error: Null pointer (NULL array pointer is passed) in cvGetMat, file /home/moiz/OpenCV-2.1.0/src/cxcore/cxarray.cpp, line 2376
terminate called after throwing an instance of 'cv::Exception'
what(): /home/moiz/OpenCV-2.1.0/src/cxcore/cxarray.cpp:2376: error: (-27) NULL array pointer is passed in function cvGetMat

Aborted

mukhram 08-17-2010 04:43 AM

Hi,

i wrote the code to read and write images using OpenCV. the code is compiled with no errors. but when i tried to execute it, i got error. Please help me.
here is the code:

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>
#include <cxcore.h>
#include <cxtypes.h>

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

IplImage* img=0;
img=cvLoadImage("images.jpeg",3);
if(img) printf("Could not load image file: %s\n","images.jpeg");

if(!cvSaveImage("im.jpeg",img)) printf("Could not save: %s\n","im.jpeg");
}


error is:

OpenCV Error: Null pointer (NULL array pointer is passed) in cvGetMat, file /home/moiz/OpenCV-2.1.0/src/cxcore/cxarray.cpp, line 2376
terminate called after throwing an instance of 'cv::Exception'
what(): /home/moiz/OpenCV-2.1.0/src/cxcore/cxarray.cpp:2376: error: (-27) NULL array pointer is passed in function cvGetMat

Aborted

Aquarius_Girl 08-17-2010 04:49 AM

Code:

IplImage* img=0;
img=cvLoadImage("images.jpeg",3);
if(img) printf("Could not load image file: %s\n","images.jpeg");

I am not very sure but perhaps you can try recompiling after allocating memory (through malloc or new) to the pointer *img in the above quoted code.

mukhram 08-18-2010 04:28 AM

hi

i tried to write a code for reading and writing images. this program is executed with no errors but it is not saving or writing the image. Please do the needful. Please help me.

code:
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "cv.h"
#include "highgui.h"
#include <cxcore.h>
#include <cxtypes.h>

int main(int argc, char* argv[])
{
IplImage* img=0;
img=cvLoadImage("images.jpeg",4);


if(!img) printf("Could not load image file: %s\n","images.jpeg");
int cvSaveImage( const char* img, const CvArr* im);

}


i took above instructions from the following link:
http://opencv.jp/opencv-1.0.0_org/do...ef_highgui.htm


All times are GMT -5. The time now is 09:36 PM.