currently working on matlab image processing project , simpley capturing image webcam, saving it, processing image using hough transform , trying save it. when use imwrite function on transformed image error:
??? error using ==> imwrite>validatesizes @ 596 unsupported image datatype 'struct'. error in ==> imwrite @ 422 validatesizes(data); error in ==> findline @ 48 imwrite(tapes,fullimagefilename2); i dont know whats going on here use imwrite function when image first taken webcam , saves no errors. second time try save image, transformed image error. ideas?
this code far:
vidobj = videoinput('winvideo'); preview(vidobj); pause(10); snapshot = getsnapshot(vidobj); fullimagefilename = fullfile(pwd, 'line.jpg'); imwrite(snapshot,fullimagefilename); imagesc(snapshot); imshow(snapshot); %load image tape = imread('c:\users\mustafa\documents\matlab\line.jpg'); %displays valid values image processing iptsetpref imshowborder tight imshow(tape) %segment thresh holding thresh1 = 100; tapes = im2bw(tape, thresh1/255); imshow(tapes) %clean image %morphology assist segmentation tapes = bwareaopen(tapes,100);%area under 100 pixels imshow(tapes) %clear objects touching line %suppresses structures lighter surroundings , connected image border. %(in other words, use function clear image border.) %tapes = imclearborder(tapes, 26); %imshow(tapes) %find tape %find connected regions [b,l] = bwboundaries(tapes, 'noholes'); numregions = max(l(:)); imshow(label2rgb(l)) %hough transform [h, theta, rho] = hough(tapes); peaks = houghpeaks(h, 2); tapes = houghlines(tapes, theta, rho, peaks, 'fillgap', 50, 'minlength', 30); fullimagefilename2 = fullfile(pwd, 'linedetect.png'); imwrite(tapes,fullimagefilename2,'bitdepth',16);
houghlines returns struct. type help houghlines understand output more thoroughly.
(hint, it's not image.)
at bottom of page houghlines gives example of do output.
Comments
Post a Comment