Thread: strains finder code - bmp c

  1. #1
    Registered User
    Join Date
    Jun 2017
    Posts
    1

    strains finder code - bmp c

    hi im trying to find all the strains in a given image, but something is wrong with my code. cant find the problem

    Code:
    void StrainFinder(pix** pixel, int H, int W){
    	int i, j, sum = 1, size, J, I;
    	double intens;
    	Strain strain;
    	Dtrain* strainp = &strain;
    	final* head;
    	int counter = 0;
    	head = NULL;
    	for (i = 0; i < H; i++)
    	{
    		for (j = 0; j < W; j++)
    		{
    			if (pixel[i][j].marker == 0 && pixel[i][j].intens >= <intens value>) 
    			{
    				dustp->totalintens = 0;
    				dustp->size = 0;
    				dustp->Jmax = j;
    				dustp->Jmin = j;
    				dustp->Imax = i;
    				dustp->Imin = i;
    				Summerize(pixel, H, W, i, j, strainp);
    				if (strainp->size >= <minimum size of stain to find>)
    				{
    					counter++;
    					if (counter == 1)
    					{
    						intens = (strainp->totalintens / strainp->size);
    						strainp->Jmax++;
    						strainp->Imax++;
    						J = ceil((double)(strainp->Jmax - strainp->Jmin) / 2)+ strainp->Jmin;
    						I = ceil((double)(strainp->Imax - strainp->Imin) / 2)+ strainp->Imin;
    						size = strainp->size;
    						head = malloc(sizeof(Strain));
    						head->intens = strainp->totalintens / strainp->size;
    						head->J = (strainp->Jmax - strainp->Jmin) / 2;
    						head->I = (strainp->Imax - strainp->Imin) / 2;
    						head->size = strainp->size;
    						head->next = NULL;
    					}
    					else
    					{
    						Collector(head, strainp);
    					}
    
    
    				}
    
    
    			}
    		}
    	}
    }

  2. #2
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    Quote Originally Posted by Hezi View Post
    hi im trying to find all the strains in a given image, but something is wrong with my code. cant find the problem
    Translation: "I've stolen this code and can't figure it out."

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    > if (pixel[i][j].marker == 0 && pixel[i][j].intens >= <intens value>)
    > if (strainp->size >= <minimum size of stain to find>)
    I guess the first thing is fill in the blanks.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calender Finder
    By ARYAA in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 04-10-2016, 01:03 PM
  2. C word finder
    By gabs in forum C Programming
    Replies: 2
    Last Post: 02-22-2016, 02:53 PM
  3. X, Y finder?
    By cwn11 in forum Tech Board
    Replies: 3
    Last Post: 12-27-2008, 02:59 PM
  4. error finder
    By lilhawk2892 in forum C++ Programming
    Replies: 7
    Last Post: 09-01-2006, 09:44 AM
  5. Section Finder
    By Soul.India in forum C Programming
    Replies: 6
    Last Post: 11-23-2003, 01:43 PM

Tags for this Thread