how to flip a segmented image along the major axis

11 views (last 30 days)
I and my friends are doing project on skin cancer detection using image processing, We completed upto segmentation, now we have to find area of non overlapped region of the segmented image.For this we have to flip the image along its major axis andminor axis. so please help us in this matter.
Advance thanks.
  2 Comments
James Morris
James Morris on 19 Mar 2018
Edited: James Morris on 19 Mar 2018
Hi, I have used (and slightly edited) your code to rotate and center my own skin lesions, but I am now struggling on being able to fold it along the X axis, and calculate the difference between the 2 overlapping areas. I need to show the overlapping regions in an image, furthermore I need to also be able sum the differences of the overlapping area, as this data needs to go into a classifier. I have linked my image of what I have so far, and also my code. Any guidance on how to solve my issue will be greatly appreciated. Thanks.
Image Analyst
Image Analyst on 19 Mar 2018
See my answer below Just sum the images if you need a pixel count:
sum1 = sum(overlapped(:));
sum2 = sum(nonOverlapped(:));

Sign in to comment.

Answers (4)

Image Analyst
Image Analyst on 26 Feb 2017
I gave you the initial part of the code already but it appears you need more help so here's some more. See attached m-file below the image. I don't know how you got a very high value for the orientation - I get 14 degrees. The only remaining part you asked for is " we have to flip the image along its major axis" and for that you can use flipud(rotatedImage) - very simple.
  29 Comments
Image Analyst
Image Analyst on 23 Oct 2017
I don't know what help you need beyond the code that I attached. Be more specific.

Sign in to comment.


Image Analyst
Image Analyst on 7 Feb 2016
Edited: Image Analyst on 7 Feb 2016
First align the image so that the major axis is horizontal (or vertical) with imrotate(). Then use imtranslate() to put the center line at the center of the image. Then use flipud (or fliplr) and AND or XOR them together
rotatedBinary = imrotate(binaryImage, angle);
rotatedBinary = imtranslate(rotatedBinary,.....
flipped = flipud(rotatedBinary);
overlapped = flipped & rotatedBinary;
nonOverlapped = xor(flipped, rotatedBinary);
I'm hoping you can find the angle yourself (it comes from Orientation in regionprops), and can find the amount of lines to translate it (it also comes from Centroid in regionprops)
  4 Comments
narayana reddy
narayana reddy on 26 Feb 2016
Orientation which is obtained by regionprops is very high, with this value the image is not looking straight. please help me
anastasia
anastasia on 26 Feb 2017
how to find the major axis initially and then align it using imtranslate()? Please help with the initial part of the code.

Sign in to comment.


sandeep kumar
sandeep kumar on 25 Nov 2017
Edited: sandeep kumar on 25 Nov 2017
Image Analyst I implemented your code testGrayimage.m but iam not able to get a proper segmented image iam attaching below the images, in fig.(1) the inner blob is suppose to be the lesion area but it is selecting the outerleft arc please help ..
  4 Comments
sandeep kumar
sandeep kumar on 26 Nov 2017
Edited: sandeep kumar on 26 Nov 2017
sir images vary in sizes some are bigger some are smaller some has intense blob while in some images their is a very less difference between lesion and skin intensity. sir is there any way that out of all the regions in the binaryImage it could only select a region which is may be say circular or elliptical in shape like in above fig can we select only the inner blob and also in the fig attached
Image Analyst
Image Analyst on 26 Nov 2017
Yes, you can do background division with the / symbol, but you'd need a snapshot of a totally uniform image, like I said. Divide the background image by the max value to get a "percentage image", then divide your sample image by the percentage image and rescale. I'm attaching a demo of a different background correction method.
Why don't you just call imclearborder to get rid of blobs touching the border? It just treats the symptom, not the cause, but I don't think you're skilled enough yet to do a proper background correction.

Sign in to comment.


James Morris
James Morris on 21 Mar 2018
Hi image analyst, from the matlab file you posted, you rotated and calculated the area difference along the x axis. I was just wondering if you could show and explain how to do it along the Y axis too?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!