unexpected figure with inverted child photo pops up when i run my code
68 ビュー (過去 30 日間)
i'm trying to count people in a video but i dont want to display the video .the code works fine but every time i run the code a figure pops up. i have no idea why can some one help me
here's my code:
mov = mmreader('SampleVideo.avi'); for i=1:mov.NumberOfFrames img = read(mov,i); th = graythresh(image);
binaryImage = im2bw(image,th); cc = bwconncomp(binaryImage,4); number_of_people= cc.NumObjects; end display(number_of_people )
回答 (2 件)
Image Analyst 2014 年 9 月 14 日
It could be an easter egg: http://www.mathworks.com/matlabcentral/answers/2001#answer_3188
but I don't really know since the deprecated function mmreader has finally been removed by R2014a and so I can't run it. Why don't you use one of the function that they've been recommending to replace it, such as VideoReader?
David Young 2014 年 9 月 23 日
編集済み: David Young 2014 年 9 月 23 日
It's because you are assigning a value to img but using the value of image, which has the side effect of displaying the boy.
th = graythresh(image);
th = graythresh(img);
and likewise wherever you use image, to make your code consistent.