unexpected figure with inverted child photo pops up when i run my code
이전 댓글 표시
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 )
댓글 수: 1
David Young
2014년 9월 23일
Please format your code by putting two spaces at the start of each line.
답변 (2개)
Image Analyst
2014년 9월 14일
0 개 추천
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?
댓글 수: 1
Ayesha ayub
2014년 9월 23일
편집: Ayesha ayub
2014년 9월 23일
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.
Replace
th = graythresh(image);
with
th = graythresh(img);
and likewise wherever you use image, to make your code consistent.
카테고리
도움말 센터 및 File Exchange에서 Image Preview and Device Configuration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
