ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Somebody has a working median filter for gray and color images written in C or C++ and can share it ? I made a simple QT interface to load picture, now i want to make a median filter to that picture. But i have no ideer how to do that Don`t have alot experience in picture processing.
I can also give the code for my interface if asked, im willling to share it (well its not much anyway).
I have to use language C++ or C (with standard libs) and QT to implement them to my GUI. So extra software or programs dont count. Its a school project, which i am scared i am not gona make without some help
Sorry for long post. This is a GUI that can open image, save it back, reload it, scale, zoom in, zoom out, fit to window. Now im stuck with making median filter so i can apply it to that image. Or atleast some example of something done to that image, so i get a grasp how i can get to the pixels, and make something with them.
Im not lazy in any way, i just cant figure this one out
Never had a spot for C++ or C, and never we done any work on image processing so i even dont have the right knowledge how things go.
If you can help, well probably thx is not enough, but you would realy help me out.
Of *COURSE* you want to use a library like ImageMagick, if at all possible.
When you're a professional, do you think you'll have the luxury of re-inventing the wheel?
The whole beauty of Open Source is that you can see how somebody did something (instead of just buying or licensing closed, "black boxes" like in the commercial world) which (in theory, at least) will educate and empower you to ultimately make your own contributions back to the open source community.
Please ask your professor if you can use a library like ImageMagick (or GTK+, or any number of other alternatives) in your project:
a) If he/she says "yes", please make the extra effort to look into the ImageMagick source and figure out how the particular filter you're using actually works. Make sure your professor knows you took that effort.
b) If he/she says "no", then get a book from the library on "Image Processing 101", read what you need, and post back any specific questions you have about the median filter (or convolution filter, or color quantization, or whatever you happen to be working with).
If you wind up having to "reinvent the wheel", then take it one piece at a time, and post back specific questions about that one piece.
I have to implement it myself into that code i posted. So it works in my QT GUI i made. Well its not so hard i know how median filter works. I am just stuck, how do i acess pixels with QT so i can use them in my algorithm. So i have to acess pixels. Maybe someone can wrote me a simple example of acessing pixels, and then making dunno each pixel -5 and then write them back to the picture, so i get how i do those steps, i can do the rest myself.
Can you make some simple example how to implement that, im not the brightest when i have to read some manual for some programming language, and not realy good at QT or C++ so i understand hard whats going on, good in java but thats a completly diffrent approach :S
Ok got filter mediana for black and white pictures.
/***************************************************************************
* Func: median_filt *
* *
* Desc: median filters an image using a block mask *
* *
* Params: source - pointer to image in memory *
* cols - number of columns in image *
* rows - number of rows in image *
* filename - name of output file *
* side - width of block *
***************************************************************************/
void median_filt(image_ptr source, int cols, int rows, char *filename,int side)
Now i need to supply it with these parameters. I got cols and rows from image.width(); and image.height(); filename i specify, it will be filename to which picture will be saved. Now i dunno how do i get width of block in QT, or what width of block actualy is. And source says its pointer to image in memory. Can i make a pointer in QT to image to memory (notice that the algorithm for mediana is written in C, compiles fine), or how do i make a pointer to image ? If i have QImage image; How can i make pointer to location of that ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.