Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, with this code I am able to find the centroid of the image i.e. whenever the pupil is at the center. But when pupil is at the corner it is giving centroid on sclera part. so how can i move the centroid according to the pupil. And how to create a sliding window to move it on image to find the max dark area i.e. pupil.

clear all;clc;
Ia = imread('eye.jpg');

subplot(121);imshow(Ia);

bw = im2bw(Ia, graythresh(getimage));
figure, imshow(bw);

% Thresholding
Ia_black = uint8(Ia(:,:,1)<20 & Ia(:,:,2)>200 & Ia(:,:,3)<20);

% Centroid
[y1,x1] = find(Ia_black==0);

x1 = round(mean(x1));
y1 = round(mean(y1));
figure;
imshow(Ia); hold on;

alpha(.5);
plot(x1,y1,'r*');
Posted
Updated 1-Nov-14 4:51am
v6
Comments
[no name] 1-Nov-14 9:57am    
This is not a question, this is an order
[no name] 1-Nov-14 10:11am    
If you tried a lot, then extract the esential part of code where you face the Problem and improve your question with this.

Otherwise we grope in the dark and have to speculate
Member 11195643 1-Nov-14 10:15am    
Ok. Thanks...

1 solution

It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.

But be aware: you get what you pay for. Pay peanuts, get monkeys.
 
Share this answer
 
Comments
Member 11195643 1-Nov-14 10:12am    
I found the centroid of the image but not the pupil's. can u suggest how can i apply it for pupil in binary image.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900