Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [centers, radii] = imfindcircles(cF_EDGE,[R_MIN R_MAX]);
- % We have saved all the centers and radii of the circles detected
- n_circles = length(radii);
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % If n_circles = 0, we have to do something (Later)
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Now we will mark these circles in the copied_Frame
- % As we want to process the circles one by one we will add new changes to
- % already changed version
- cF_ACM = copyFrame; % Copying again
- for n_c = 1:n_circles % For all detected circles
- % Color detection by analyzing RGB components
- color_CRC;
- n_points = 0;
- cX = uint8(centers(n_c,1));
- cY = uint8(centers(n_c,2));
- % for npx = (cX - RNG_PXL:cX + RNG_PXL)
- % for npy = (cY - RNG_PXL:cY + RNG_PXL)
- % R_component = R_component + copyFrame(npx,npy,1);
- % G_component = G_component + copyFrame(npx,npy,2);
- % B_component = B_component + copyFrame(npx,npy,3);
- %
- % n_points = n_points + 1;
- %
- % end
- % end
- % Normalizing / Averaging
- R_component = extraCop(cY,cX,1) %= R_component/n_points;
- G_component = extraCop(cY,cX,2) %= G_component/n_points;
- B_component = extraCop(cY,cX,3) %= B_component/n_points;
- % Too dark
- if (R_component <= DRK_RNG && G_component <= DRK_RNG && B_component <= DRK_RNG)
- color_CRC = 'Balck';
- % Red color
- elseif (R_component/G_component > RED_RAT && R_component/B_component > RED_RAT)
- color_CRC = 'Red';
- % By default White color
- else
- color_CRC = 'White';
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement