5 Replies - 4620 Views - Last Post: 19 April 2011 - 03:50 AM Rate Topic: -----

#1 Marrodriguez  Icon User is offline

  • New D.I.C Head

Reputation: -4
  • View blog
  • Posts: 27
  • Joined: 15-April 11

Image Segmentation C++ code

Posted 18 April 2011 - 06:29 AM

hey, im trying to write a code that will result in image segmentation. I have this so far:

 
#include <cstdio>
#include <cstdlib>
#include <image.h>
#include <misc.h>
#include <pnmfile.h>
#include "segment-image.h"

int main(int argc, char **argv) {
  if (argc != 6) {
    fprintf(stderr, "usage: %s sigma k min input(ppm) output(ppm)\n", argv[0]);
    return 1;
  }
  
  float sigma = atof(argv[1]);
  float k = atof(argv[2]);
  int min_size = atoi(argv[3]);
	
  printf("loading input image.\n");
  image<rgb> *input = loadPPM(argv[4]);
	
  printf("processing\n");
  int num_ccs; 
  image<rgb> *seg = segment_image(input, sigma, k, min_size, &num_ccs); 
  savePPM(seg, argv[5]);

  printf("got %d components\n", num_ccs);
  printf("done! uff...thats hard work.\n");

  return 0;
}




line "image<rgb> *input = loadPPM(argv[4]);" is giving me an error and i cant detect why... :s... also, I would like to know how to insert another image into the code to be analyzed. Thanks for your help in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: Image Segmentation C++ code

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6081
  • View blog
  • Posts: 23,557
  • Joined: 23-August 08

Re: Image Segmentation C++ code

Posted 18 April 2011 - 06:33 AM

It is complete unhelpful to simply tell us "this line is giving me an error". You need to to tell us WHAT the error is EXACTLY.

Also, are we just supposed to know what image<rgb> is, and what the loadPPM function returns or does?
Was This Post Helpful? 1
  • +
  • -

#3 Marrodriguez  Icon User is offline

  • New D.I.C Head

Reputation: -4
  • View blog
  • Posts: 27
  • Joined: 15-April 11

Re: Image Segmentation C++ code

Posted 18 April 2011 - 06:54 AM

View PostJackOfAllTrades, on 18 April 2011 - 06:33 AM, said:

It is complete unhelpful to simply tell us "this line is giving me an error". You need to to tell us WHAT the error is EXACTLY.

Also, are we just supposed to know what image<rgb> is, and what the loadPPM function returns or does?



The error is that the compiler does not recognize the existence of image<rgb> and loadPPM functions. Are there any other functions i could use instead of these?
Was This Post Helpful? -1
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6081
  • View blog
  • Posts: 23,557
  • Joined: 23-August 08

Re: Image Segmentation C++ code

Posted 18 April 2011 - 07:10 AM

I repeat: are we just all supposed to know anything about these non-standard functions you are using?

Let me guess. You found some code on the 'Net and just copied and pasted it and expected it to work without giving a moment's thought as to what it does or otherwise requires.

Ah yes. What a surprise..
Was This Post Helpful? 1
  • +
  • -

#5 Marrodriguez  Icon User is offline

  • New D.I.C Head

Reputation: -4
  • View blog
  • Posts: 27
  • Joined: 15-April 11

Re: Image Segmentation C++ code

Posted 18 April 2011 - 07:27 AM

View PostJackOfAllTrades, on 18 April 2011 - 07:10 AM, said:

I repeat: are we just all supposed to know anything about these non-standard functions you are using?

Let me guess. You found some code on the 'Net and just copied and pasted it and expected it to work without giving a moment's thought as to what it does or otherwise requires.

Ah yes. What a surprise..


I did give it thought which is why i posted it here. And as u may notice it is not the same code because i modified it. I do not know what those two functions are and neither do you aparently, so instead of being a wise ass, let people who do know answer and stop hassling people who are only searching for help and clarification. If you dont know the answer then simply go to another post that might better suit your expertees.

View PostMarrodriguez, on 18 April 2011 - 07:23 AM, said:

View PostJackOfAllTrades, on 18 April 2011 - 07:10 AM, said:

I repeat: are we just all supposed to know anything about these non-standard functions you are using?

Let me guess. You found some code on the 'Net and just copied and pasted it and expected it to work without giving a moment's thought as to what it does or otherwise requires.

Ah yes. What a surprise..


I did give it thought which is why i posted it here. And as u may notice it is not the same code because i modified it. I do not know what those two functions are and neither do you aparently, so instead of being condesending, let people who do know answer and want to help post, and stop hassling people who are only searching for help and clarification. If you dont know the answer then simply go to another post that might better suit your expertees.


I a not demanding anyone to fix my code, nor write code for me. I just want clarification on those two functions and posibly how to include the image.h variable in my program. Thats all. And there is no crime in using some code as a frame of reference. If everyone knew everything all the time, then there would be no need for these forums would there?
Was This Post Helpful? -1
  • +
  • -

#6 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: Image Segmentation C++ code

Posted 19 April 2011 - 03:50 AM

View PostMarrodriguez, on 19 April 2011 - 12:27 AM, said:

I just want clarification on those two functions


How can anyone 'clarify' what those functions do if you don't share them with us?

If you thought that maybe they were standard functions then it has been explained to you that they are non-standard.
So, knowing they are not standard functions and not having a copy of them to share with us then your thread died as something that was going to get a meaningful answer at that point. Yet you keep posting. I don't understand why.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1