LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2010, 05:04 AM   #1
mukhram
LQ Newbie
 
Registered: Jul 2010
Location: LONDON
Posts: 11

Rep: Reputation: 0
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
 
Old 07-31-2010, 06:34 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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.
 
Old 07-31-2010, 06:53 AM   #3
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by mukhram View Post
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

Last edited by Aquarius_Girl; 07-31-2010 at 06:55 AM.
 
Old 08-03-2010, 03:24 PM   #4
mukhram
LQ Newbie
 
Registered: Jul 2010
Location: LONDON
Posts: 11

Original Poster
Rep: Reputation: 0
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.
 
Old 08-03-2010, 07:49 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
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 ?
 
Old 08-05-2010, 01:01 PM   #6
mukhram
LQ Newbie
 
Registered: Jul 2010
Location: LONDON
Posts: 11

Original Poster
Rep: Reputation: 0
Hello Friends,

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

Thanks and Regards.
 
Old 08-05-2010, 01:54 PM   #7
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
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

Last edited by John VV; 08-05-2010 at 02:02 PM.
 
Old 08-05-2010, 03:09 PM   #8
mukhram
LQ Newbie
 
Registered: Jul 2010
Location: LONDON
Posts: 11

Original Poster
Rep: Reputation: 0
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;

}
 
Old 08-05-2010, 03:18 PM   #9
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Quote:
but its showing errors
what errors ?
please post the errors .
 
Old 08-05-2010, 03:32 PM   #10
mukhram
LQ Newbie
 
Registered: Jul 2010
Location: LONDON
Posts: 11

Original Poster
Rep: Reputation: 0
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
 
Old 08-05-2010, 04:50 PM   #11
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
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
 
Old 08-11-2010, 05:09 AM   #12
mukhram
LQ Newbie
 
Registered: Jul 2010
Location: LONDON
Posts: 11

Original Poster
Rep: Reputation: 0
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
 
Old 08-17-2010, 04:43 AM   #13
mukhram
LQ Newbie
 
Registered: Jul 2010
Location: LONDON
Posts: 11

Original Poster
Rep: Reputation: 0
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
 
Old 08-17-2010, 04:49 AM   #14
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
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.
 
1 members found this post helpful.
Old 08-18-2010, 04:28 AM   #15
mukhram
LQ Newbie
 
Registered: Jul 2010
Location: LONDON
Posts: 11

Original Poster
Rep: Reputation: 0
Unhappy

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

Last edited by mukhram; 08-18-2010 at 04:36 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dansguardian - Won't filter new addresses added to filter list TechnoBod Linux - Software 1 01-08-2008 01:40 AM
IP Filter jasone Linux - Security 6 12-19-2005 03:21 PM
Spam filter to external mail filter deadlock Linux - Software 1 06-16-2004 02:28 AM
L7 Filter Xing Linux - Software 0 09-17-2003 04:56 AM
filter.pl where? jfisk Linux - Software 5 09-04-2003 02:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration