MATLAB vision.TextInserter does not insert text -


enter image description here

i trying insert text message image. not display , no error.

close clear clc  hvideoplayer = vision.videoplayer; hvideofilereader = vision.videofilereader; hvideofilereader.filename = 'img1.jpg';  frame = step(hvideofilereader);   hcsc = vision.colorspaceconverter; hcsc.conversion = 'rgb intensity'; frame = step(hcsc, frame);  @ = vision.autothresholder; frame = step(at, frame);   ccl = vision.connectedcomponentlabeler; [l num] = step(ccl, frame);  holeobjcount = 0;  i=1:num     framei = changem(l==i, 1, i);      framei = imcomplement(framei);      [li numi] = step(ccl, framei);      if numi > 1         holeobjcount = holeobjcount + 1;     end  end  message = sprintf('%d of %d objects have holes.', holeobjcount, num); disp(message);  osdmsg = vision.textinserter('%d of %d objects have holes.',...                               'color', uint8([255, 255, 255]), ...                              'location', [10 10],...                              'fontsize', 22); %the problem here frame = step(osdmsg, frame, int32([holeobjcount num]));  step(hvideoplayer, frame);   release(hvideofilereader);  release(hvideoplayer); 

the problem because of color space of image. have attempted display rgb colored text on b/w image can not show natutally.

after removing color attribute, see text

osdmsg = vision.textinserter('%d of %d objects have holes.',...                               'location', [10 10],...                              'fontsize', 22); 

the problem now, text inserted black , cannot read clearly.

the problem after thresholding frame logical array. make text show use im2uint8 convert uint8.

a few other pointers: since working single image rather video can use imread instead of vision.videofilereader read in. can use imshow instead of vision.videoplayer same reason. also, if have matlab version r2013a or later, can use inserttext function instead of vision.textinserter.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -