Generate Cropped and Masked IRIS - Eye Image [closed]

asked 2019-05-17 03:09:31 -0500

Hello all I want to generate below type of image from given eye image using opencv.

image description

i am using c# and opencv. i successfully generate below type of image but i cannot find way to generate what i need. image description

so anyone has suggestion welcome.

current code as below:

    private void SegmentIris()
    {
        //Clone the filled contour
        Image<Gray, Byte> InputImageCloneOne = FilledContourForSegmentation.Clone();

        Image<Gray, Byte> InputImageCloneTwo = FilledContourForSegmentation.Clone();
        MCvScalar k = new MCvScalar(255, 255, 255);

        //Draw the circle for mask in white
        CvInvoke.cvCircle(mask, PupilCenter, OuterBoundaryRadius, IrisConstants.WhiteColor, -1, Emgu.CV.CvEnum.LINE_TYPE.CV_AA, 0);

        //Create the optimised circle using pupil center and outer boundary iris -> so that circles appear proper around the iris
        if (IsContourDetectionSatisfactory)
        {
            OptimisedIrisBoundaries = FilledContourForSegmentation.Clone();
            CvInvoke.cvCircle(OptimisedIrisBoundaries, PupilCenter, OuterBoundaryRadius, IrisConstants.WhiteColor, 2, Emgu.CV.CvEnum.LINE_TYPE.CV_AA, 0);
        }
        else
        {
            OptimisedIrisBoundaries = ApproximatedPupilImage.Clone();
            CvInvoke.cvCircle(OptimisedIrisBoundaries, PupilCenter, OuterBoundaryRadius, IrisConstants.WhiteColor, 2, Emgu.CV.CvEnum.LINE_TYPE.CV_AA, 0);
        }

        //now make the mask circle black
        CvInvoke.cvNot(mask, mask);

        //Subtract the input image and filled contour image over the mask created
        CvInvoke.cvSub(InputImage, InputImageCloneOne, InputImageCloneTwo, mask);

        //Put clonetwo to segmented image
        CvInvoke.cvCopy(InputImageCloneTwo, SegmentedIrisImage, new IntPtr(0));

    }

-thanks

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2019-05-17 03:10:15.815553

Comments

1

unfortunately, we cannot help you with anything c#

berak gravatar imageberak ( 2019-05-17 03:10:59 -0500 )edit