i have following questions: what algorithm bwareafilt uses? weird behaviour: when input matrix totally black, following error error using bwpropfilt (line 73) internal error: p must positive. error in bwareafilt (line 33) bw2 = bwpropfilt(bw, 'area', p, direction, conn); error in colour_reception (line 95) iz=bwareafilt(b,1); actually, using function take snapshots webcam, when block webcam totally, above following error. so believe error due internal implementation mistake. case? how overcome this? let's answer questions 1 @ time: what algorithm bwareafilt use? bwareafilt function image processing toolbox accepts binary image , determines unique objects in image. find unique objects, connected components analysis performed each object assigned unique id. can think of performing flood fill on each object individually. flood fill can performed using variety of algorithms - among them depth-first search can consider image graph edges c...