I am using following code to differentiate between a blue region (required region) in my image C:\fakepath\input image.jpg and the background. I have applied PyrMeanShiftFiltering function to do segmentation of the image. After applying code the result C:\fakepath\result.jpg image have successfully segmented blue section but now i want to know the location of this blue region (mid point). Can any one help me how i can know the coordinates of this blue region in my image after doing this image segmentation.
///Code///
include "cv.h"
include "highgui.h"
include "math.h"
include <iostream.h>
int main(int argc, char* argv) { IplImage output_image;
IplImage* image = cvLoadImage("31.jpg",CV_LOAD_IMAGE_COLOR);
CvMemStorage* storage = cvCreateMemStorage(0); cvNamedWindow( "origional image", 1 ); cvShowImage( "origional image", image); cvWaitKey(0);
IplImage *filtered = cvCreateImage(cvGetSize(image),image->depth,image->nChannels);
cvCopy(image,filtered,NULL);
int level = 3; int spatial_radius = 40; int color_radius = 40;
//Here comes the thing filtered->width &= -(1<<level); filtered-="">height &= -(1<<level);< p="">
//Now you are free to do your thing cvPyrMeanShiftFiltering(filtered, filtered,spatial_radius,color_radius,level); cvNamedWindow( "fourth", 1 ); cvShowImage( "fourth", filtered); cvWaitKey(0);
return 0; }