Ask Your Question

Revision history [back]

Generate Cropped and Masked IRIS - Eye Image

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

Generate Cropped and Masked IRIS - Eye Image

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