croptectd image by user using imrect() functions
Mostra commenti meno recenti
i am capturing infinite no of images from gige vision camera .The camera gives infinite no of screenshot that i converted RGB to binary images but i am not saving these screenshots but only show it.Now i want to crop a perticular region of interest will crop by user only one time by using imrect() and applying the cropted region for multiple live images,coming from camera .How it is possible by matlab? my code is
if true
obj=videoinput('gige',1,'BayerBG8');
set(obj,'SelectedSourceName','input1');
preview(obj);
Folder1='C:\MATLABS\Arka2';
for i=1:5
frame=getsnapshot(obj);
im = rgb2gray(frame);
frame1=imbinarize(im,.4);
imshow(frame1);
end
h_rect = imrect();
pos_rect = h_rect.getPosition();
pos_rect = round(pos_rect);
for i=1:5
img_cropped = frame1(pos_rect(2) + (0:pos_rect(4)), pos_rect(1) + (0:pos_rect(3)));
imshow(img_cropped);
imwrite(img_cropped, fullfile(Folder1, sprintf('%01d.jpg', i)));
end
end
but the problem is that the cropted position of last image is selected only and it prints 5 times.
1 Commento
arkaprava mandal
il 3 Ott 2018
Risposte (0)
Categorie
Scopri di più su GigE Vision Hardware in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!