+ 3

C++ project. Help!

hi everyone. I'm a beginner and i need help with a university project in c++. I'm not asking you to do it, but since the professor is not really into answering questions i thought you guys could help to visualize what i actually have to do in order to start the project right! this is the task: Template class showing images with 1,2,3,4 channels. Class which implements kernel image processing. Reading and writing in PPM / PGM format. the first point is not a problem. the second seems a little worrying but overall i think i could manage to do it. I do have some issues with the PPM/PGM format part though. I literally have no clues about how to implement it, could someone give me a hint? also, how may classes should i create? 1 template class, 1 for kernel image processing 1 for writing in ppm format, 1 for writing in pgm format, and finally 1 for reading pgm and 1 for reading ppm? i think it should be like this according to the single responsibility principle, shouldn't it? I'm pretty confused... Help anyone?

20th Aug 2019, 8:53 AM
Frangiax
Frangiax - avatar
3 Respuestas
+ 3
I don't even have an idea what a PPM/PGM format looks like, so take these advices with a grain of salt. The core task sounds to me like reading and displaying a PPM / PGM file. A bit of Googling shows that it's binary, I imagine you would need something like fread() http://www.cplusplus.com/reference/cstdio/fread/ We want a minimal working example first, so we can put aside the issue of figuring out how many classes you want. Instead, focus on researching the PPM / PGM format. https://cboard.cprogramming.com/cplusplus-programming/172486-reading-ppm-format-images.html https://people.cs.clemson.edu/~levinej/courses/S15/1020/handouts/lec05/ppm.pdf You are supposed to figure out how to read the file and put it into a 2D array. unsigned char img[x][y]; If you manage to do this, I imagine you'd want to display this array as an image, do you have any resource or ideas on how to do that? You'll need something like SDL to put write (coloured) pixels onto an output window. http://www.libsdl.org/
20th Aug 2019, 10:33 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Hatsy Rei Okay thank you very much! I'll be working on it I had not thought about the output so SDL will definitely come in handy. Thanks again
20th Aug 2019, 1:12 PM
Frangiax
Frangiax - avatar